[GameState] Now release the mouse when the window loses focus.
This commit is contained in:
parent
6b0fc907ee
commit
cae6fee434
@ -66,6 +66,16 @@ void GameState::onEvent(const SDL_Event &event) {
|
||||
else if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE && &m_stateStack->top() == this) {
|
||||
m_stateStack->push<PauseMenuState>(this);
|
||||
}
|
||||
else if (event.type == SDL_WINDOWEVENT) {
|
||||
if (event.window.event == SDL_WINDOWEVENT_LEAVE) {
|
||||
Mouse::setCursorGrabbed(false);
|
||||
Mouse::setCursorVisible(true);
|
||||
}
|
||||
else if (event.window.event == SDL_WINDOWEVENT_ENTER) {
|
||||
Mouse::setCursorGrabbed(true);
|
||||
Mouse::setCursorVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_hotbar.onEvent(event);
|
||||
m_blockCursor.onEvent(event, m_hotbar);
|
||||
|
Loading…
x
Reference in New Issue
Block a user