mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 04:22:34 +02:00
Don't highlight menus when the mouse button is down.
This commit is contained in:
@@ -446,7 +446,8 @@ public:
|
|||||||
MenuAction(GameView * _v, Menu * menu_) { v = _v; menu = menu_; }
|
MenuAction(GameView * _v, Menu * menu_) { v = _v; menu = menu_; }
|
||||||
void MouseEnterCallback(ui::Button * sender)
|
void MouseEnterCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
v->c->SetActiveMenu(menu);
|
if(!ui::Engine::Ref().GetMouseButton())
|
||||||
|
v->c->SetActiveMenu(menu);
|
||||||
}
|
}
|
||||||
void ActionCallback(ui::Button * sender)
|
void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
|
@@ -16,6 +16,7 @@ Engine::Engine():
|
|||||||
state_(NULL),
|
state_(NULL),
|
||||||
maxWidth(0),
|
maxWidth(0),
|
||||||
maxHeight(0),
|
maxHeight(0),
|
||||||
|
mouseb_(0),
|
||||||
mousex_(0),
|
mousex_(0),
|
||||||
mousey_(0),
|
mousey_(0),
|
||||||
mousexp_(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)
|
void Engine::onMouseClick(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
|
mouseb_ |= button;
|
||||||
if(state_)
|
if(state_)
|
||||||
state_->DoMouseDown(x, y, button);
|
state_->DoMouseDown(x, y, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::onMouseUnclick(int x, int y, unsigned button)
|
void Engine::onMouseUnclick(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
|
mouseb_ &= ~button;
|
||||||
if(state_)
|
if(state_)
|
||||||
state_->DoMouseUp(x, y, button);
|
state_->DoMouseUp(x, y, button);
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,7 @@ namespace ui
|
|||||||
void SetFps(float fps);
|
void SetFps(float fps);
|
||||||
inline float GetFps() { return fps; };
|
inline float GetFps() { return fps; };
|
||||||
|
|
||||||
|
inline int GetMouseButton() { return mouseb_; }
|
||||||
inline int GetMouseX() { return mousex_; }
|
inline int GetMouseX() { return mousex_; }
|
||||||
inline int GetMouseY() { return mousey_; }
|
inline int GetMouseY() { return mousey_; }
|
||||||
inline int GetWidth() { return width_; }
|
inline int GetWidth() { return width_; }
|
||||||
@@ -89,6 +90,7 @@ namespace ui
|
|||||||
bool break_;
|
bool break_;
|
||||||
|
|
||||||
int lastTick;
|
int lastTick;
|
||||||
|
int mouseb_;
|
||||||
int mousex_;
|
int mousex_;
|
||||||
int mousey_;
|
int mousey_;
|
||||||
int mousexp_;
|
int mousexp_;
|
||||||
|
Reference in New Issue
Block a user