diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-01 13:26:43 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-01 13:26:43 (GMT) |
| commit | 0e394ed62e4a369bb57fe62137878d255c558cb0 (patch) | |
| tree | d1a25ceb7c31338f187a758de8454fe0b02467ad /src | |
| parent | 58763f090043be8709addc9a7ac33aeaab591d7c (diff) | |
| download | powder-0e394ed62e4a369bb57fe62137878d255c558cb0.zip powder-0e394ed62e4a369bb57fe62137878d255c558cb0.tar.gz | |
Don't highlight menus when the mouse button is down.
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/GameView.cpp | 3 | ||||
| -rw-r--r-- | src/interface/Engine.cpp | 3 | ||||
| -rw-r--r-- | src/interface/Engine.h | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 56f90e3..74a2b5a 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -446,7 +446,8 @@ public: MenuAction(GameView * _v, Menu * menu_) { v = _v; menu = menu_; } void MouseEnterCallback(ui::Button * sender) { - v->c->SetActiveMenu(menu); + if(!ui::Engine::Ref().GetMouseButton()) + v->c->SetActiveMenu(menu); } void ActionCallback(ui::Button * sender) { diff --git a/src/interface/Engine.cpp b/src/interface/Engine.cpp index aabbc62..643a023 100644 --- a/src/interface/Engine.cpp +++ b/src/interface/Engine.cpp @@ -16,6 +16,7 @@ Engine::Engine(): state_(NULL), maxWidth(0), maxHeight(0), + mouseb_(0), mousex_(0), mousey_(0), mousexp_(0), @@ -260,12 +261,14 @@ void Engine::onKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool void Engine::onMouseClick(int x, int y, unsigned button) { + mouseb_ |= button; if(state_) state_->DoMouseDown(x, y, button); } void Engine::onMouseUnclick(int x, int y, unsigned button) { + mouseb_ &= ~button; if(state_) state_->DoMouseUp(x, y, button); } diff --git a/src/interface/Engine.h b/src/interface/Engine.h index c40f3a4..b825eb8 100644 --- a/src/interface/Engine.h +++ b/src/interface/Engine.h @@ -53,6 +53,7 @@ namespace ui void SetFps(float fps); inline float GetFps() { return fps; }; + inline int GetMouseButton() { return mouseb_; } inline int GetMouseX() { return mousex_; } inline int GetMouseY() { return mousey_; } inline int GetWidth() { return width_; } @@ -89,6 +90,7 @@ namespace ui bool break_; int lastTick; + int mouseb_; int mousex_; int mousey_; int mousexp_; |
