Add blur lua event, called when opening another interface window
This commit is contained in:
parent
9e94abb150
commit
3b3775addf
@ -863,6 +863,14 @@ void GameController::Tick()
|
|||||||
commandInterface->OnTick();
|
commandInterface->OnTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameController::Blur()
|
||||||
|
{
|
||||||
|
// Tell lua that mouse is up (even if it really isn't)
|
||||||
|
MouseUp(0, 0, 0, 1);
|
||||||
|
BlurEvent ev;
|
||||||
|
commandInterface->HandleEvent(LuaEvents::blur, &ev);
|
||||||
|
}
|
||||||
|
|
||||||
void GameController::Exit()
|
void GameController::Exit()
|
||||||
{
|
{
|
||||||
CloseEvent ev;
|
CloseEvent ev;
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
bool KeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
|
bool KeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
|
||||||
bool KeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
|
bool KeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
|
||||||
void Tick();
|
void Tick();
|
||||||
|
void Blur();
|
||||||
void Exit();
|
void Exit();
|
||||||
|
|
||||||
void Install();
|
void Install();
|
||||||
|
@ -1700,9 +1700,7 @@ void GameView::OnBlur()
|
|||||||
disableShiftBehaviour();
|
disableShiftBehaviour();
|
||||||
isMouseDown = false;
|
isMouseDown = false;
|
||||||
drawMode = DrawPoints;
|
drawMode = DrawPoints;
|
||||||
c->MouseUp(0, 0, 0, 1); // tell lua that mouse is up (even if it really isn't)
|
c->Blur();
|
||||||
if (GetModifiers())
|
|
||||||
c->KeyRelease(0, 0, false, false, false, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameView::OnTick(float dt)
|
void GameView::OnTick(float dt)
|
||||||
|
@ -98,6 +98,12 @@ public:
|
|||||||
int PushToStack(lua_State *l) override { return 0; }
|
int PushToStack(lua_State *l) override { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BlurEvent: public Event
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int PushToStack(lua_State *l) override { return 0; }
|
||||||
|
};
|
||||||
|
|
||||||
class CloseEvent: public Event
|
class CloseEvent: public Event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -116,6 +122,7 @@ public:
|
|||||||
mousemove,
|
mousemove,
|
||||||
mousewheel,
|
mousewheel,
|
||||||
tick,
|
tick,
|
||||||
|
blur,
|
||||||
close
|
close
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3314,6 +3314,7 @@ void LuaScriptInterface::initEventAPI()
|
|||||||
lua_pushinteger(l, LuaEvents::mousemove); lua_setfield(l, -2, "mousemove");
|
lua_pushinteger(l, LuaEvents::mousemove); lua_setfield(l, -2, "mousemove");
|
||||||
lua_pushinteger(l, LuaEvents::mousewheel); lua_setfield(l, -2, "mousewheel");
|
lua_pushinteger(l, LuaEvents::mousewheel); lua_setfield(l, -2, "mousewheel");
|
||||||
lua_pushinteger(l, LuaEvents::tick); lua_setfield(l, -2, "tick");
|
lua_pushinteger(l, LuaEvents::tick); lua_setfield(l, -2, "tick");
|
||||||
|
lua_pushinteger(l, LuaEvents::blur); lua_setfield(l, -2, "blur");
|
||||||
lua_pushinteger(l, LuaEvents::close); lua_setfield(l, -2, "close");
|
lua_pushinteger(l, LuaEvents::close); lua_setfield(l, -2, "close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user