Skip to content

Commit

Permalink
Adjust the resolution to the window size in SDL_gpu builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Jul 7, 2014
1 parent d7ea8f9 commit a4b14e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/video.cpp
Expand Up @@ -346,7 +346,8 @@ CVideo::CVideo(FAKE_TYPES type) : mode_changed_(false), bpp_(0), fake_screen_(fa
void CVideo::initSDL()
{
#ifdef SDL_GPU
render_target = GPU_Init(1200, 700, GPU_DEFAULT_INIT_FLAGS);
//800x600 is a dummy value, the actual resolution is set in setMode
render_target = GPU_Init(800, 600, GPU_DEFAULT_INIT_FLAGS);

if(render_target == NULL) {
ERR_DP << "Could not initialize window: " << SDL_GetError() << std::endl;
Expand Down Expand Up @@ -477,6 +478,9 @@ int CVideo::setMode( int x, int y, int bits_per_pixel, int flags )

fullScreen = (flags & FULL_SCREEN) != 0;
frameBuffer = SDL_SetVideoMode( x, y, bits_per_pixel, flags );
#ifdef SDL_GPU
GPU_SetWindowResolution(x, y);
#endif

if( frameBuffer != NULL ) {
image::set_pixel_format(frameBuffer->format);
Expand Down

0 comments on commit a4b14e0

Please sign in to comment.