From 582b29a545fed1f4154d60588180622e67e1a483 Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Tue, 17 Dec 2019 16:21:54 +0000 Subject: [PATCH] Add 50% scalines keys. Signed-off-by: Andrea Odetti --- source/frontends/sa2/main.cpp | 49 ++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/source/frontends/sa2/main.cpp b/source/frontends/sa2/main.cpp index 5a64d545..ca4840d9 100644 --- a/source/frontends/sa2/main.cpp +++ b/source/frontends/sa2/main.cpp @@ -103,6 +103,36 @@ namespace SDL_RenderCopyEx(ren.get(), tex.get(), &srect, nullptr, 0.0, nullptr, SDL_FLIP_VERTICAL); SDL_RenderPresent(ren.get()); } + + void cycleVideoType(const std::shared_ptr & win) + { + g_eVideoType++; + if (g_eVideoType >= NUM_VIDEO_MODES) + g_eVideoType = 0; + + SetWindowTitle(); + SDL_SetWindowTitle(win.get(), g_pAppTitle.c_str()); + + Config_Save_Video(); + VideoReinitialize(); + VideoRedrawScreen(); + } + + void cycle50ScanLines(const std::shared_ptr & win) + { + VideoStyle_e videoStyle = GetVideoStyle(); + videoStyle = VideoStyle_e(videoStyle ^ VS_HALF_SCANLINES); + + SetVideoStyle(videoStyle); + + SetWindowTitle(); + SDL_SetWindowTitle(win.get(), g_pAppTitle.c_str()); + + Config_Save_Video(); + VideoReinitialize(); + VideoRedrawScreen(); + } + } int MessageBox(HWND, const char * text, const char * caption, UINT type) @@ -179,26 +209,21 @@ void run_sdl() { case SDL_SCANCODE_F9: { - g_eVideoType++; - if (g_eVideoType >= NUM_VIDEO_MODES) - g_eVideoType = 0; - - SetWindowTitle(); - SDL_SetWindowTitle(win.get(), g_pAppTitle.c_str()); - - Config_Save_Video(); - VideoReinitialize(); - VideoRedrawScreen(); + cycleVideoType(win); break; } case SDL_SCANCODE_F6: { - if (e.key.keysym.mod & KMOD_CTRL) + if ((e.key.keysym.mod & KMOD_CTRL) && (e.key.keysym.mod & KMOD_SHIFT)) + { + cycle50ScanLines(win); + } + else if (e.key.keysym.mod & KMOD_CTRL) { multiplier = multiplier == 1 ? 2 : 1; SDL_SetWindowSize(win.get(), sw * multiplier, sh * multiplier); - break; } + break; } } }