Skip to content

Commit

Permalink
Add keybinding to toggle fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
orzechow committed Feb 11, 2025
1 parent ed2cec2 commit 3b6bd50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions demo/include/utils/pacman_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class PacmanWrapper {
bool pause_{false};
bool quit_{false};
bool renderPath_{false};
bool fullscreen_{false};
};

} // namespace utils
10 changes: 10 additions & 0 deletions demo/src/pacman_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ void PacmanWrapper::handleUserInput() {
renderPath_ = !renderPath_;
break;
}
if (event.key.keysym.scancode == SDL_SCANCODE_F) {
fullscreen_ = !fullscreen_;
if (fullscreen_) {
SDL_SetWindowFullscreen(window_.get(), SDL_WINDOW_FULLSCREEN);
} else {
SDL_SetWindowFullscreen(window_.get(), 0);
}
break;
}
}
}
}
Expand Down Expand Up @@ -117,6 +126,7 @@ void PacmanWrapper::printKeybindings() {
<< "\033[1;36m=====================================\033[0m\n"
<< " \033[1;32mESC/Q\033[0m - Quit the demo\n"
<< " \033[1;32mSpace\033[0m - Pause the demo\n"
<< " \033[1;32mF\033[0m - Toggle fullscreen mode\n"
<< " \033[1;32mP\033[0m - Toggle path visualization\n"
<< "\033[1;36m=====================================\033[0m\n"
<< " \033[1;32mGUI\033[0m - Open http://localhost:8080\n"
Expand Down

0 comments on commit 3b6bd50

Please sign in to comment.