diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index c0f20911..8768f066 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -1922,7 +1922,7 @@ void editorinput(void) game.my = (float) key.my; ed.tilex=(game.mx - (game.mx%8))/8; ed.tiley=(game.my - (game.my%8))/8; - if (gameScreen.scalingMode == 1) { + if (gameScreen.scalingMode == SCALING_STRETCH) { // In this mode specifically, we have to fix the mouse coordinates int winwidth, winheight; gameScreen.GetWindowSize(&winwidth, &winheight); diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 947347e1..57425fbf 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -318,12 +318,13 @@ static void menurender(void) switch (gameScreen.scalingMode) { - case 2: + case SCALING_INTEGER: graphics.Print( -1, 85, "Current mode: INTEGER", tr, tg, tb, true); break; - case 1: + case SCALING_STRETCH: graphics.Print( -1, 85, "Current mode: STRETCH", tr, tg, tb, true); break; + case SCALING_LETTERBOX: default: graphics.Print( -1, 85, "Current mode: LETTERBOX", tr, tg, tb, true); break; diff --git a/desktop_version/src/Screen.cpp b/desktop_version/src/Screen.cpp index 8f181bec..4785bad1 100644 --- a/desktop_version/src/Screen.cpp +++ b/desktop_version/src/Screen.cpp @@ -14,7 +14,7 @@ void ScreenSettings_default(struct ScreenSettings* _this) _this->windowHeight = 240; _this->fullscreen = false; _this->useVsync = true; // Now that uncapped is the default... - _this->scalingMode = 0; + _this->scalingMode = SCALING_LETTERBOX; _this->linearFilter = false; _this->badSignal = false; } @@ -163,7 +163,7 @@ void Screen::ResizeScreen(int x, int y) SDL_SetWindowPosition(m_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); } } - if (scalingMode == 1) + if (scalingMode == SCALING_STRETCH) { int winX, winY; GetWindowSize(&winX, &winY); @@ -183,7 +183,7 @@ void Screen::ResizeScreen(int x, int y) else { SDL_RenderSetLogicalSize(m_renderer, 320, 240); - int result = SDL_RenderSetIntegerScale(m_renderer, (SDL_bool) (scalingMode == 2)); + int result = SDL_RenderSetIntegerScale(m_renderer, (SDL_bool) (scalingMode == SCALING_INTEGER)); if (result != 0) { vlog_error("Error: could not set scale: %s", SDL_GetError()); @@ -331,7 +331,7 @@ void Screen::toggleFullScreen(void) void Screen::toggleScalingMode(void) { - scalingMode = (scalingMode + 1) % 3; + scalingMode = (scalingMode + 1) % NUM_SCALING_MODES; ResizeScreen(-1, -1); } diff --git a/desktop_version/src/ScreenSettings.h b/desktop_version/src/ScreenSettings.h index 9e5e6a32..5369844d 100644 --- a/desktop_version/src/ScreenSettings.h +++ b/desktop_version/src/ScreenSettings.h @@ -1,6 +1,14 @@ #ifndef SCREENSETTINGS_H #define SCREENSETTINGS_H +enum +{ + SCALING_LETTERBOX = 0, + SCALING_STRETCH = 1, + SCALING_INTEGER = 2, + NUM_SCALING_MODES +}; + struct ScreenSettings { int windowWidth;