Don't highlight menus when the mouse button is down.

This commit is contained in:
Simon Robertshaw 2012-10-01 14:26:43 +01:00
parent 58763f0900
commit 0e394ed62e
3 changed files with 7 additions and 1 deletions

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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_;