From 8ba083cd0b04ee5b16694880bd8af1aabf96a942 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 29 Apr 2017 17:50:14 +0300 Subject: [PATCH] fix snowflakes --- src/gui/GUI.cpp | 16 +++++++++++----- src/gui/ncc/Background.cpp | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/GUI.cpp b/src/gui/GUI.cpp index 926a6319..1507e6a9 100644 --- a/src/gui/GUI.cpp +++ b/src/gui/GUI.cpp @@ -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); + } } } } diff --git a/src/gui/ncc/Background.cpp b/src/gui/ncc/Background.cpp index e7ea31de..95d5f166 100644 --- a/src/gui/ncc/Background.cpp +++ b/src/gui/ncc/Background.cpp @@ -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; }