diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-03-22 23:36:10 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-13 22:40:51 +0100 |
commit | a2f113f8ee6f196aa7712a87704b854ac5e2e41d (patch) | |
tree | 239b115e477be96a534cd6bf46c50690a85ff547 | |
parent | 0892c0bbc50625c2a291143407fe482cededf9b1 (diff) | |
download | usdx-a2f113f8ee6f196aa7712a87704b854ac5e2e41d.tar.gz usdx-a2f113f8ee6f196aa7712a87704b854ac5e2e41d.tar.xz usdx-a2f113f8ee6f196aa7712a87704b854ac5e2e41d.zip |
menu/software_mouse_pointer: hide after 2s without movement
Diffstat (limited to '')
-rw-r--r-- | src/menu/software_mouse_pointer.cpp | 6 | ||||
-rw-r--r-- | src/menu/software_mouse_pointer.hpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/menu/software_mouse_pointer.cpp b/src/menu/software_mouse_pointer.cpp index 814f64b6..b86b06ae 100644 --- a/src/menu/software_mouse_pointer.cpp +++ b/src/menu/software_mouse_pointer.cpp @@ -33,6 +33,8 @@ namespace usdx SoftwareMousePointer::SoftwareMousePointer(Container* parent, EventManager* event_manager) : DrawableControl(parent) { + fade_inactive = new Timer(this, 2000, true); + this->vertices[0] = 0.0f; this->vertices[1] = 40.0f; this->vertices[2] = 40.0f; @@ -95,6 +97,9 @@ namespace usdx void SoftwareMousePointer::draw(void) { + if (fade_inactive->is_ready()) + return; + glBindTexture(GL_TEXTURE_2D, texture_normal->get_texture()); glEnableClientState(GL_VERTEX_ARRAY); @@ -115,6 +120,7 @@ namespace usdx void SoftwareMousePointer::on_mouse_move(int x, int y) { set_position(x, y); + fade_inactive->update(); } }; diff --git a/src/menu/software_mouse_pointer.hpp b/src/menu/software_mouse_pointer.hpp index 15e855db..26ffc037 100644 --- a/src/menu/software_mouse_pointer.hpp +++ b/src/menu/software_mouse_pointer.hpp @@ -31,6 +31,7 @@ #include "container.hpp" #include "event_manager.hpp" #include "texture.hpp" +#include "timer.hpp" #include <boost/signals2.hpp> #include <boost/thread/mutex.hpp> @@ -48,6 +49,8 @@ namespace usdx Texture* texture_normal; Texture* texture_pressed; + Timer* fade_inactive; + boost::signals2::connection mouse_move_connection; protected: |