fix snowflakes

This commit is contained in:
nullifiedcat 2017-04-29 17:50:14 +03:00
parent 13308a03c9
commit 8ba083cd0b
2 changed files with 12 additions and 5 deletions

View File

@ -112,14 +112,18 @@ void CatGUI::Update() {
if (changed) {
//logging::Info("Key %i changed! Now %i.", i, down);
if (i == ButtonCode_t::MOUSE_LEFT) {
if (down) root->OnMousePress();
else root->OnMouseRelease();
if (Visible()) {
if (down) root->OnMousePress();
else root->OnMouseRelease();
}
} else {
if (i == ButtonCode_t::KEY_INSERT && down) {
gui_visible = !gui_visible;
}
if (down) root->OnKeyPress((ButtonCode_t)i, false);
else root->OnKeyRelease((ButtonCode_t)i);
if (Visible()) {
if (down) root->OnKeyPress((ButtonCode_t)i, false);
else root->OnKeyRelease((ButtonCode_t)i);
}
}
} else {
if (down) {
@ -134,7 +138,9 @@ void CatGUI::Update() {
}
}
}
if (shouldrepeat) root->OnKeyPress((ButtonCode_t)i, true);
if (Visible()) {
if (shouldrepeat) root->OnKeyPress((ButtonCode_t)i, true);
}
}
}
}

View File

@ -141,6 +141,7 @@ void Background::Particle::Update(float dt) {
vy += (float)particle_gravity * dt;
x += vx * dt;
y += vy * dt;
if (x > draw::width + 16) x = -16;
if (y > (int)particle_safe + 255) dead = true;
}