1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Rename stretch mode to scaling mode internally

It's been long overdue that this variable be named properly. 2.2 added
integer scaling mode (thanks Ethan), 2.3 renamed it to scaling mode. Now
2.4 will properly call it what it is so people won't be confused by it.

The ScreenSettings struct member is renamed from stretch to scalingMode
along with the Screen class member being renamed, as well as the
toggleStretchMode function being renamed to toggleScalingMode as well.
Unfortunately, due to compatibility, we can't change the <stretch> XML
tag.
This commit is contained in:
Misa 2021-12-22 19:54:59 -08:00
parent aa7b63fa5f
commit f7b4ac8322
7 changed files with 15 additions and 15 deletions

View file

@ -1921,7 +1921,7 @@ void editorinput(void)
game.my = (float) key.my; game.my = (float) key.my;
ed.tilex=(game.mx - (game.mx%8))/8; ed.tilex=(game.mx - (game.mx%8))/8;
ed.tiley=(game.my - (game.my%8))/8; ed.tiley=(game.my - (game.my%8))/8;
if (graphics.screenbuffer->stretchMode == 1) { if (graphics.screenbuffer->scalingMode == 1) {
// In this mode specifically, we have to fix the mouse coordinates // In this mode specifically, we have to fix the mouse coordinates
int winwidth, winheight; int winwidth, winheight;
graphics.screenbuffer->GetWindowSize(&winwidth, &winheight); graphics.screenbuffer->GetWindowSize(&winwidth, &winheight);

View file

@ -4127,7 +4127,7 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, ScreenSettings* s
if (SDL_strcmp(pKey, "stretch") == 0) if (SDL_strcmp(pKey, "stretch") == 0)
{ {
screen_settings->stretch = help.Int(pText); screen_settings->scalingMode = help.Int(pText);
} }
if (SDL_strcmp(pKey, "useLinearFilter") == 0) if (SDL_strcmp(pKey, "useLinearFilter") == 0)
@ -4446,7 +4446,7 @@ void Game::serializesettings(tinyxml2::XMLElement* dataNode, const ScreenSetting
xml::update_tag(dataNode, "fullscreen", (int) screen_settings->fullscreen); xml::update_tag(dataNode, "fullscreen", (int) screen_settings->fullscreen);
xml::update_tag(dataNode, "stretch", screen_settings->stretch); xml::update_tag(dataNode, "stretch", screen_settings->scalingMode);
xml::update_tag(dataNode, "useLinearFilter", (int) screen_settings->linearFilter); xml::update_tag(dataNode, "useLinearFilter", (int) screen_settings->linearFilter);

View file

@ -619,7 +619,7 @@ static void menuactionpress(void)
break; break;
case 1: case 1:
music.playef(11); music.playef(11);
graphics.screenbuffer->toggleStretchMode(); graphics.screenbuffer->toggleScalingMode();
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 2: case 2:

View file

@ -314,7 +314,7 @@ static void menurender(void)
graphics.bigprint( -1, 30, "Scaling Mode", tr, tg, tb, true); graphics.bigprint( -1, 30, "Scaling Mode", tr, tg, tb, true);
graphics.Print( -1, 65, "Choose letterbox/stretch/integer mode.", tr, tg, tb, true); graphics.Print( -1, 65, "Choose letterbox/stretch/integer mode.", tr, tg, tb, true);
switch (graphics.screenbuffer->stretchMode) switch (graphics.screenbuffer->scalingMode)
{ {
case 2: case 2:
graphics.Print( -1, 85, "Current mode: INTEGER", tr, tg, tb, true); graphics.Print( -1, 85, "Current mode: INTEGER", tr, tg, tb, true);

View file

@ -25,7 +25,7 @@ ScreenSettings::ScreenSettings(void)
windowHeight = 240; windowHeight = 240;
fullscreen = false; fullscreen = false;
useVsync = true; // Now that uncapped is the default... useVsync = true; // Now that uncapped is the default...
stretch = 0; scalingMode = 0;
linearFilter = false; linearFilter = false;
badSignal = false; badSignal = false;
} }
@ -37,7 +37,7 @@ void Screen::init(const ScreenSettings& settings)
m_screenTexture = NULL; m_screenTexture = NULL;
m_screen = NULL; m_screen = NULL;
isWindowed = !settings.fullscreen; isWindowed = !settings.fullscreen;
stretchMode = settings.stretch; scalingMode = settings.scalingMode;
isFiltered = settings.linearFilter; isFiltered = settings.linearFilter;
vsync = settings.useVsync; vsync = settings.useVsync;
filterSubrect.x = 1; filterSubrect.x = 1;
@ -118,7 +118,7 @@ void Screen::GetSettings(ScreenSettings* settings)
settings->fullscreen = !isWindowed; settings->fullscreen = !isWindowed;
settings->useVsync = vsync; settings->useVsync = vsync;
settings->stretch = stretchMode; settings->scalingMode = scalingMode;
settings->linearFilter = isFiltered; settings->linearFilter = isFiltered;
settings->badSignal = badSignalEffect; settings->badSignal = badSignalEffect;
} }
@ -181,7 +181,7 @@ void Screen::ResizeScreen(int x, int y)
SDL_SetWindowPosition(m_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); SDL_SetWindowPosition(m_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
} }
} }
if (stretchMode == 1) if (scalingMode == 1)
{ {
int winX, winY; int winX, winY;
GetWindowSize(&winX, &winY); GetWindowSize(&winX, &winY);
@ -201,7 +201,7 @@ void Screen::ResizeScreen(int x, int y)
else else
{ {
SDL_RenderSetLogicalSize(m_renderer, 320, 240); SDL_RenderSetLogicalSize(m_renderer, 320, 240);
int result = SDL_RenderSetIntegerScale(m_renderer, (SDL_bool) (stretchMode == 2)); int result = SDL_RenderSetIntegerScale(m_renderer, (SDL_bool) (scalingMode == 2));
if (result != 0) if (result != 0)
{ {
vlog_error("Error: could not set scale: %s", SDL_GetError()); vlog_error("Error: could not set scale: %s", SDL_GetError());
@ -345,9 +345,9 @@ void Screen::toggleFullScreen(void)
} }
} }
void Screen::toggleStretchMode(void) void Screen::toggleScalingMode(void)
{ {
stretchMode = (stretchMode + 1) % 3; scalingMode = (scalingMode + 1) % 3;
ResizeScreen(-1, -1); ResizeScreen(-1, -1);
} }

View file

@ -25,14 +25,14 @@ public:
const SDL_PixelFormat* GetFormat(void); const SDL_PixelFormat* GetFormat(void);
void toggleFullScreen(void); void toggleFullScreen(void);
void toggleStretchMode(void); void toggleScalingMode(void);
void toggleLinearFilter(void); void toggleLinearFilter(void);
void toggleVSync(void); void toggleVSync(void);
bool isWindowed; bool isWindowed;
bool isFiltered; bool isFiltered;
bool badSignalEffect; bool badSignalEffect;
int stretchMode; int scalingMode;
bool vsync; bool vsync;
SDL_Window *m_window; SDL_Window *m_window;

View file

@ -9,7 +9,7 @@ struct ScreenSettings
int windowHeight; int windowHeight;
bool fullscreen; bool fullscreen;
bool useVsync; bool useVsync;
int stretch; int scalingMode;
bool linearFilter; bool linearFilter;
bool badSignal; bool badSignal;
}; };