From dc8f6319f0b73fad624ec63af22d80e28ca71c42 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 14 Dec 2017 23:10:24 +0100 Subject: [PATCH] Cosmetic: rename windowScale to zoom --- src/blupi.cxx | 22 +++++++++++----------- src/blupi.h | 2 +- src/event.cxx | 43 +++++++++++++++++++++---------------------- src/event.h | 4 ++-- src/menu.cxx | 3 +-- 5 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/blupi.cxx b/src/blupi.cxx index 0f13b6d..3833f70 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -63,7 +63,7 @@ std::thread * g_updateThread = nullptr; std::atomic g_updateAbort (false); bool g_bFullScreen = false; // false si mode de test -Uint8 g_windowScale = 1; +Uint8 g_zoom = 1; Sint32 g_speedRate = 1; Sint32 g_timerInterval = 50; // inverval = 50ms int g_rendererType = 0; @@ -150,9 +150,9 @@ ReadConfig () if (!(g_settingsOverload & SETTING_ZOOM) && j.find ("zoom") != j.end ()) { - g_windowScale = j["zoom"].get (); - if (g_windowScale != 1 && g_windowScale != 2) - g_windowScale = 1; + g_zoom = j["zoom"].get (); + if (g_zoom != 1 && g_zoom != 2) + g_zoom = 1; } if ( @@ -640,9 +640,9 @@ parseArgs (int argc, char * argv[], bool & exit) if (args["zoom"]) { - g_windowScale = args["zoom"]; - if (g_windowScale != 1 && g_windowScale != 2) - g_windowScale = 1; + g_zoom = args["zoom"]; + if (g_zoom != 1 && g_zoom != 2) + g_zoom = 1; g_settingsOverload |= SETTING_ZOOM; } @@ -977,19 +977,19 @@ DoInit (int argc, char * argv[], bool & exit) return EXIT_FAILURE; } - const bool zoom = g_windowScale; + const bool zoom = g_zoom; g_pEvent->Create (g_pPixmap, g_pDecor, g_pSound, g_pMovie); // Load all cursors - g_pPixmap->LoadCursors (g_windowScale); + g_pPixmap->LoadCursors (g_zoom); g_pPixmap->ChangeSprite (SPRITE_WAIT); g_updateThread = new std::thread (CheckForUpdates); if (g_bFullScreen) g_pEvent->SetFullScreen (true); - if (!g_bFullScreen && zoom != g_windowScale) - g_pEvent->SetWindowSize (g_windowScale); + if (!g_bFullScreen && zoom != g_zoom) + g_pEvent->SetWindowSize (g_zoom); g_pEvent->ChangePhase (EV_PHASE_INTRO1); g_bTermInit = true; diff --git a/src/blupi.h b/src/blupi.h index 54b7bd8..950ea10 100644 --- a/src/blupi.h +++ b/src/blupi.h @@ -29,7 +29,7 @@ extern SDL_Window * g_window; extern SDL_Renderer * g_renderer; extern bool g_bFullScreen; -extern Uint8 g_windowScale; +extern Uint8 g_zoom; extern bool g_restoreBugs; extern bool g_restoreMidi; extern bool g_enableRecorder; diff --git a/src/event.cxx b/src/event.cxx index f8817bd..5eb01fc 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1659,10 +1659,10 @@ CEvent::SetFullScreen (bool bFullScreen) { int x, y; SDL_GetMouseState (&x, &y); - x /= g_windowScale; - y /= g_windowScale; + x /= g_zoom; + y /= g_zoom; - g_windowScale = 1; + g_zoom = 1; SDL_SetWindowSize (g_window, LXIMAGE, LYIMAGE); g_bFullScreen = bFullScreen; @@ -1672,7 +1672,7 @@ CEvent::SetFullScreen (bool bFullScreen) SDL_SetWindowPosition ( g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); - m_pPixmap->LoadCursors (g_windowScale); + m_pPixmap->LoadCursors (g_zoom); m_pPixmap->ReloadTargetTextures (); /* Force this update before otherwise the coordinates retrieved with @@ -1696,13 +1696,13 @@ CEvent::SetFullScreen (bool bFullScreen) void CEvent::SetWindowSize (Uint8 newScale) { - auto scale = g_windowScale; - g_windowScale = newScale; + auto scale = g_zoom; + g_zoom = newScale; switch (newScale) { case 1: case 2: - SetWindowSize (scale, g_windowScale); + SetWindowSize (scale, g_zoom); break; default: @@ -2083,8 +2083,8 @@ CEvent::DrawButtons () SetEnable (EV_BUTTON3, !g_bFullScreen); SetEnable (EV_BUTTON4, g_bFullScreen); - SetEnable (EV_BUTTON5, !g_bFullScreen && g_windowScale > 1); - SetEnable (EV_BUTTON6, !g_bFullScreen && g_windowScale < 2); + SetEnable (EV_BUTTON5, !g_bFullScreen && g_zoom > 1); + SetEnable (EV_BUTTON6, !g_bFullScreen && g_zoom < 2); SetEnable (EV_BUTTON7, g_restoreMidi); SetEnable (EV_BUTTON8, !g_restoreMidi); @@ -2570,7 +2570,7 @@ CEvent::DrawButtons () if (!g_bFullScreen) { - snprintf (res, sizeof (res), "%dx", g_windowScale); + snprintf (res, sizeof (res), "%dx", g_zoom); lg = GetTextWidth (res); pos.x = (284 + 40) - lg / 2; pos.y = 330 - 20; @@ -4114,18 +4114,18 @@ CEvent::ChangeButtons (Sint32 message) break; case EV_BUTTON5: { - auto scale = g_windowScale; - if (g_windowScale > 1) - --g_windowScale; - SetWindowSize (scale, g_windowScale); + auto scale = g_zoom; + if (g_zoom > 1) + --g_zoom; + SetWindowSize (scale, g_zoom); break; } case EV_BUTTON6: { - auto scale = g_windowScale; - if (g_windowScale < 2) - ++g_windowScale; - SetWindowSize (scale, g_windowScale); + auto scale = g_zoom; + if (g_zoom < 2) + ++g_zoom; + SetWindowSize (scale, g_zoom); break; } case EV_BUTTON7: @@ -4710,7 +4710,7 @@ CEvent::WriteInfo () : Language::undef); info.musicMidi = g_restoreMidi; info.fullScreen = g_bFullScreen; - info.zoom = g_windowScale; + info.zoom = g_zoom; nb = fwrite (&info, sizeof (info), 1, file); if (nb < 1) @@ -4776,7 +4776,7 @@ CEvent::ReadInfo () if (!(g_settingsOverload & SETTING_FULLSCREEN)) g_bFullScreen = !!info.fullScreen; if (!(g_settingsOverload & SETTING_ZOOM)) - g_windowScale = info.zoom; + g_zoom = info.zoom; } fclose (file); @@ -5154,8 +5154,7 @@ CEvent::DemoStep () pos.y = event.motion.y; } - SDL_WarpMouseInWindow ( - g_window, pos.x * g_windowScale, pos.y * g_windowScale); + SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom); } if (m_pDemoBuffer) diff --git a/src/event.h b/src/event.h index 9ffad9e..4f16e91 100644 --- a/src/event.h +++ b/src/event.h @@ -142,8 +142,8 @@ public: void IntroStep (); - void SetWindowSize (Uint8 newScale); - void SetUpdateVersion (const std::string & version); + void SetWindowSize (Uint8 newScale); + void SetUpdateVersion (const std::string & version); static void PushUserEvent (Sint32 code, void * data = nullptr); diff --git a/src/menu.cxx b/src/menu.cxx index c8e492c..35b1145 100644 --- a/src/menu.cxx +++ b/src/menu.cxx @@ -187,8 +187,7 @@ CMenu::Create ( pos = m_pos; pos.x += DIMBUTTONX / 2; pos.y += DIMBUTTONY / 2; - SDL_WarpMouseInWindow ( - g_window, pos.x * g_windowScale, pos.y * g_windowScale); + SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom); } m_selRank = Detect (pos);