GUI: add toggle full-screen keybind

This commit is contained in:
tildearrow 2022-04-17 01:57:50 -05:00
parent 0952d1b2f9
commit 4f59eb2602
5 changed files with 9 additions and 3 deletions

View file

@ -136,6 +136,10 @@ void FurnaceGUI::doAction(int what) {
case GUI_ACTION_FOLLOW_PATTERN:
followPattern=!followPattern;
break;
case GUI_ACTION_FULLSCREEN:
fullScreen=!fullScreen;
SDL_SetWindowFullscreen(sdlWin,fullScreen?(SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP):0);
break;
case GUI_ACTION_PANIC:
e->syncReset();
break;

View file

@ -2476,9 +2476,8 @@ bool FurnaceGUI::loop() {
ImGui::EndMenu();
}
if (ImGui::BeginMenu("settings")) {
if (ImGui::MenuItem("full screen",NULL,fullScreen)) {
fullScreen=!fullScreen;
SDL_SetWindowFullscreen(sdlWin,fullScreen?(SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP):0);
if (ImGui::MenuItem("full screen",BIND_FOR(GUI_ACTION_FULLSCREEN),fullScreen)) {
doAction(GUI_ACTION_FULLSCREEN);
}
if (ImGui::MenuItem("lock layout",NULL,lockLayout)) {
lockLayout=!lockLayout;

View file

@ -297,6 +297,7 @@ enum FurnaceGUIActions {
GUI_ACTION_REPEAT_PATTERN,
GUI_ACTION_FOLLOW_ORDERS,
GUI_ACTION_FOLLOW_PATTERN,
GUI_ACTION_FULLSCREEN,
GUI_ACTION_PANIC,
GUI_ACTION_WINDOW_EDIT_CONTROLS,

View file

@ -167,6 +167,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
D("REPEAT_PATTERN", "Toggle repeat pattern", 0),
D("FOLLOW_ORDERS", "Follow orders", 0),
D("FOLLOW_PATTERN", "Follow pattern", 0),
D("FULLSCREEN", "Toggle full-screen", FURKMOD_ALT|SDLK_RETURN),
D("PANIC", "Panic", SDLK_F12),
D("WINDOW_EDIT_CONTROLS", "Edit Controls", 0),

View file

@ -1249,6 +1249,7 @@ void FurnaceGUI::drawSettings() {
UI_KEYBIND_CONFIG(GUI_ACTION_REPEAT_PATTERN);
UI_KEYBIND_CONFIG(GUI_ACTION_FOLLOW_ORDERS);
UI_KEYBIND_CONFIG(GUI_ACTION_FOLLOW_PATTERN);
UI_KEYBIND_CONFIG(GUI_ACTION_FULLSCREEN);
UI_KEYBIND_CONFIG(GUI_ACTION_PANIC);
KEYBIND_CONFIG_END;