From: <la...@us...> - 2013-08-31 01:07:55
|
Revision: 7417 http://sourceforge.net/p/exult/code/7417 Author: lanica Date: 2013-08-31 01:07:53 +0000 (Sat, 31 Aug 2013) Log Message: ----------- * imagewin/imagewin.cc: Applied Malignant Manor's fix for SDL2 window re sizes. Added NULL-check instead of using test variable. Modified Paths: -------------- exult/trunk/ChangeLog exult/trunk/imagewin/imagewin.cc exult/trunk/imagewin/imagewin.h Modified: exult/trunk/ChangeLog =================================================================== --- exult/trunk/ChangeLog 2013-08-29 03:06:18 UTC (rev 7416) +++ exult/trunk/ChangeLog 2013-08-31 01:07:53 UTC (rev 7417) @@ -1,3 +1,6 @@ +2013-08-30 Lanica Dragon (Phillip T. George <me@PhillipGeorge.com>) + * imagewin/imagewin.cc: Applied Malignant Manor's fix for SDL2 window resizes. Added NULL-check instead of using test variable. + 2013-08-28 Lanica Dragon (Phillip T. George <me@PhillipGeorge.com>) * exult.cc: Fixed SetIcon (mostly...) for SDL2 for non-OSX platforms * sdl-compat.h: Added SDL2 define for SDL_UpdateRect; Added SDL2_INITIAL_FILL for background color Modified: exult/trunk/imagewin/imagewin.cc =================================================================== --- exult/trunk/imagewin/imagewin.cc 2013-08-29 03:06:18 UTC (rev 7416) +++ exult/trunk/imagewin/imagewin.cc 2013-08-31 01:07:53 UTC (rev 7417) @@ -544,7 +544,6 @@ /* * Create the surface. */ - void Image_window::create_surface( unsigned int w, unsigned int h @@ -577,7 +576,13 @@ if (!paletted_surface && !force_bpp) { // No scaling, or failed? uint32 flags = SDL_SWSURFACE | (fullscreen ? SDL_FULLSCREEN : 0) | (ibuf->depth == 8 ? SDL_HWPALETTE : 0); #if SDL_VERSION_ATLEAST(2, 0, 0) - screen_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w / scale, h / scale, flags); + if (screen_window != NULL) { + SDL_SetWindowSize(screen_window, w / scale, h / scale); + SDL_SetWindowFullscreen(screen_window, flags); + SDL_DestroyRenderer(screen_renderer); + SDL_DestroyTexture(screen_texture); + } else + screen_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w / scale, h / scale, flags); if (screen_window == NULL) cout << "Couldn't create window: " << SDL_GetError() << std::endl; @@ -667,7 +672,13 @@ if (!hwdepth) return false; #if SDL_VERSION_ATLEAST(2, 0, 0) - screen_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags); + if (screen_window != NULL) { + SDL_SetWindowSize(screen_window, w, h); + SDL_SetWindowFullscreen(screen_window, flags); + SDL_DestroyRenderer(screen_renderer); + SDL_DestroyTexture(screen_texture); + } else + screen_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags); if (screen_window == NULL) cout << "Couldn't create window: " << SDL_GetError() << std::endl; screen_renderer = SDL_CreateRenderer(screen_window, -1, 0); Modified: exult/trunk/imagewin/imagewin.h =================================================================== --- exult/trunk/imagewin/imagewin.h 2013-08-29 03:06:18 UTC (rev 7416) +++ exult/trunk/imagewin/imagewin.h 2013-08-31 01:07:53 UTC (rev 7417) @@ -307,6 +307,7 @@ fullscreen(fs), game_width(gamew), game_height(gameh), fill_mode(fmode), fill_scaler(fillsclr), paletted_surface(0), display_surface(0), inter_surface(0), draw_surface(0) { + screen_window = NULL; static_init(); create_surface(w, h); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |