Skip to content

Commit

Permalink
Removed pointless check for screen mode change, as we are creating th…
Browse files Browse the repository at this point in the history
…e window for the first and only time at that point
  • Loading branch information
Grumbel committed Jul 31, 2014
1 parent f4e16cd commit 4cb5ee2
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions src/video/gl/gl_renderer.cpp
Expand Up @@ -630,43 +630,39 @@ GLRenderer::apply_video_mode(const Size& size, bool fullscreen)
}
else
{
// Only change video mode when its different from the current one
if (screen_size != size || fullscreen_active != fullscreen)
{
int flags = SDL_WINDOW_OPENGL;
int flags = SDL_WINDOW_OPENGL;

if (fullscreen)
{
flags |= SDL_WINDOW_FULLSCREEN;
}
else
{
flags |= SDL_WINDOW_RESIZABLE;
}
if (fullscreen)
{
flags |= SDL_WINDOW_FULLSCREEN;
}
else
{
flags |= SDL_WINDOW_RESIZABLE;
}

window = SDL_CreateWindow("SuperTux",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
size.width, size.height,
flags);
if (!window)
{
std::ostringstream msg;
msg << "Couldn't set video mode " << size.width << "x" << size.height << ": " << SDL_GetError();
throw std::runtime_error(msg.str());
}
else
{
glcontext = SDL_GL_CreateContext(window);
screen_size = size;
window = SDL_CreateWindow("SuperTux",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
size.width, size.height,
flags);
if (!window)
{
std::ostringstream msg;
msg << "Couldn't set video mode " << size.width << "x" << size.height << ": " << SDL_GetError();
throw std::runtime_error(msg.str());
}
else
{
glcontext = SDL_GL_CreateContext(window);
screen_size = size;

PHYSICAL_SCREEN_WIDTH = size.width;
PHYSICAL_SCREEN_HEIGHT = size.height;
PHYSICAL_SCREEN_WIDTH = size.width;
PHYSICAL_SCREEN_HEIGHT = size.height;

SCREEN_WIDTH = size.width;
SCREEN_HEIGHT = size.height;
SCREEN_WIDTH = size.width;
SCREEN_HEIGHT = size.height;

fullscreen_active = fullscreen;
}
fullscreen_active = fullscreen;
}
}
}
Expand Down

0 comments on commit 4cb5ee2

Please sign in to comment.