mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Implement scaling modes manually
For future PRs, it'll be very nice to have full control over how VVVVVV gets drawn to the window. This means we can use the entire window size for things like touch input, drawing borders, or anything we want.
This commit is contained in:
committed by
Misa Elizabeth Kai
parent
935db27d39
commit
77a571017d
@@ -247,39 +247,8 @@ void Screen::GetScreenSize(int* x, int* y)
|
||||
}
|
||||
}
|
||||
|
||||
void Screen::UpdateScaling(void)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
if (scalingMode == SCALING_STRETCH)
|
||||
{
|
||||
GetScreenSize(&width, &height);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = SCREEN_WIDTH_PIXELS;
|
||||
height = SCREEN_HEIGHT_PIXELS;
|
||||
}
|
||||
int result = SDL_RenderSetLogicalSize(m_renderer, width, height);
|
||||
if (result != 0)
|
||||
{
|
||||
vlog_error("Error: could not set logical size: %s", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
result = SDL_RenderSetIntegerScale(m_renderer, (SDL_bool) (scalingMode == SCALING_INTEGER));
|
||||
if (result != 0)
|
||||
{
|
||||
vlog_error("Error: could not set scale: %s", SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
void Screen::RenderPresent(void)
|
||||
{
|
||||
/* In certain cases, the window size might mismatch with the logical size.
|
||||
* So it's better to just always call this. */
|
||||
UpdateScaling();
|
||||
|
||||
SDL_RenderPresent(m_renderer);
|
||||
graphics.clear();
|
||||
}
|
||||
@@ -299,7 +268,6 @@ void Screen::toggleFullScreen(void)
|
||||
void Screen::toggleScalingMode(void)
|
||||
{
|
||||
scalingMode = (scalingMode + 1) % NUM_SCALING_MODES;
|
||||
UpdateScaling();
|
||||
}
|
||||
|
||||
void Screen::toggleLinearFilter(void)
|
||||
|
||||
Reference in New Issue
Block a user