Skip to content

Commit

Permalink
Reintroduce fullscreen support
Browse files Browse the repository at this point in the history
The option was just ignored - parse it again to set
SDL_FULLSCREEN.

Previously the SDL_Quit() call was missing. This function should always
be called during shutdown independent of this commit, but in this case
it also resulted in the resolution not being reset on exit.

Also see issue #359.
  • Loading branch information
laenion committed Feb 3, 2021
1 parent 9740a7d commit 2118fd0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/display/graphics.cpp
Expand Up @@ -38,6 +38,7 @@ LegacySurface *Graphics::legacyScreen()

void Graphics::create(const std::string &title, bool fullscreen)
{
uint32_t modeFlag = 0;

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
throw std::runtime_error(SDL_GetError());
Expand All @@ -50,9 +51,11 @@ void Graphics::create(const std::string &title, bool fullscreen)
//END:TODO


if (fullscreen) {
modeFlag = SDL_FULLSCREEN;
}


_display = SDL_SetVideoMode(WIDTH * SCALE, HEIGHT * SCALE, 24, 0);
_display = SDL_SetVideoMode(WIDTH * SCALE, HEIGHT * SCALE, 24, modeFlag);

if (!_display) {
throw std::runtime_error(SDL_GetError());
Expand Down Expand Up @@ -101,6 +104,8 @@ void Graphics::destroy()
_scaledScreen = NULL;
_screen = NULL;
_display = NULL;

SDL_Quit();
}

void Graphics::setForegroundColor(char color)
Expand Down

0 comments on commit 2118fd0

Please sign in to comment.