Skip to content

Commit

Permalink
switched switch
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasByr committed May 24, 2023
1 parent 5c790cc commit da82aa2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ void Game::run() {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT || quit) { m_running = false; }

// handle key events in menu mode
if (m_state == GameState::MENU && event.type == SDL_KEYDOWN) {
// handle key events in all modes
if (event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) {
// wait for enter key to be pressed
case SDLK_RETURN: m_state = GameState::WAITING; break;
// wait for q key to be pressed (alternative quit)
case SDLK_q: quit = true; break;
default: break;
}
}

// handle key events in all modes
if (event.type == SDL_KEYDOWN) {
// handle key events in menu mode
if (m_state == GameState::MENU && event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) {
// wait for q key to be pressed (alternative quit)
case SDLK_q: quit = true; break;
// wait for enter key to be pressed
case SDLK_RETURN: m_state = GameState::WAITING; break;
default: break;
}
}
Expand Down

0 comments on commit da82aa2

Please sign in to comment.