mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +03:00
Simplify Flip Mode rendering code with SDL_RenderCopyEx
Previously, Flip Mode rendering had to be complicated and allocate another buffer to call FlipSurfaceVerticle, and it was just a mess. Instead, why not just do SDL_RenderCopyEx, and let SDL flip the screen for us? This ends up pretty massively simplifying the rendering code.
This commit is contained in:
@@ -306,19 +306,32 @@ const SDL_PixelFormat* Screen::GetFormat(void)
|
||||
return m_screen->format;
|
||||
}
|
||||
|
||||
void Screen::FlipScreen(void)
|
||||
void Screen::FlipScreen(const bool flipmode)
|
||||
{
|
||||
SDL_RendererFlip flip_flags;
|
||||
if (flipmode)
|
||||
{
|
||||
flip_flags = SDL_FLIP_VERTICAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
flip_flags = SDL_FLIP_NONE;
|
||||
}
|
||||
|
||||
SDL_UpdateTexture(
|
||||
m_screenTexture,
|
||||
NULL,
|
||||
m_screen->pixels,
|
||||
m_screen->pitch
|
||||
);
|
||||
SDL_RenderCopy(
|
||||
SDL_RenderCopyEx(
|
||||
m_renderer,
|
||||
m_screenTexture,
|
||||
isFiltered ? &filterSubrect : NULL,
|
||||
NULL
|
||||
NULL,
|
||||
0.0,
|
||||
NULL,
|
||||
flip_flags
|
||||
);
|
||||
SDL_RenderPresent(m_renderer);
|
||||
SDL_RenderClear(m_renderer);
|
||||
|
||||
Reference in New Issue
Block a user