Skip to content

Commit

Permalink
[GameState] Fixed #163.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Jul 24, 2020
1 parent 43b0833 commit c518334
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion external/gamekit
5 changes: 4 additions & 1 deletion source/client/states/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ void GameState::init() {
m_eventHandler->addListener<GuiScaleChangedEvent>(&GameState::onGuiScaleChanged, this);
}

void GameState::onStateInactive() {
m_hud.pause();
}

void GameState::connect(const std::string &host, int port, const std::string &username) {
m_player.setName(username.empty() ? "Player" : username);
m_client.connect(host, port, m_player);
Expand Down Expand Up @@ -101,7 +105,6 @@ void GameState::onEvent(const SDL_Event &event) {
}
else if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE) {
m_stateStack->push<PauseMenuState>(m_client, this);
m_hud.pause();
}
else if (event.type == SDL_WINDOWEVENT) {
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
Expand Down
1 change: 1 addition & 0 deletions source/client/states/GameState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class GameState : public gk::ApplicationState {
GameState();

void init() override;
void onStateInactive() override;

void connect(const std::string &host, int port, const std::string &username);

Expand Down

0 comments on commit c518334

Please sign in to comment.