X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fsdl2%2Fmain.c;h=fc50b90823a2899c36767640429e7cd64334f0c1;hb=e4b2e65833f9ba8436226956c391e3d6d2ff2951;hp=c1b872ca71a417cf29817d220d91b251dd07e10b;hpb=9b7dd9e2d0728c50f830fff8f5f7c7caa87e5b6f;p=flatwaifu.git diff --git a/src/sdl2/main.c b/src/sdl2/main.c index c1b872c..fc50b90 100644 --- a/src/sdl2/main.c +++ b/src/sdl2/main.c @@ -1,4 +1,4 @@ -#include +#include "SDL.h" #include #include #include // srand exit @@ -127,11 +127,13 @@ static int Y_resize_window (int w, int h, int fullscreen) { assert(h > 0); assert(window != NULL); if (surf != NULL) { - SDL_Surface *s = SDL_CreateRGBSurface(0, w, h, 8, 0, 0, 0, 0); - if (s != NULL) { - SDL_SetPaletteColors(s->format->palette, surf->format->palette->colors, 0, surf->format->palette->ncolors); - SDL_FreeSurface(surf); - surf = s; + if (surf->w != w || surf->h != h) { + SDL_Surface *s = SDL_CreateRGBSurface(0, w, h, 8, 0, 0, 0, 0); + if (s != NULL) { + SDL_SetPaletteColors(s->format->palette, surf->format->palette->colors, 0, surf->format->palette->ncolors); + SDL_FreeSurface(surf); + surf = s; + } } } SDL_SetWindowSize(window, w, h); @@ -187,11 +189,10 @@ void Y_unset_videomode (void) { } } -int Y_set_fullscreen (int yes) { +void Y_set_fullscreen (int yes) { if (window != NULL) { SDL_SetWindowFullscreen(window, yes ? SDL_WINDOW_FULLSCREEN : 0); } - return yes; } int Y_get_fullscreen (void) {