diff -up shippy-1.5.0/shipsdl2.c~ shippy-1.5.0/shipsdl2.c --- shippy-1.5.0/shipsdl2.c~ 2019-05-18 17:27:52.000000000 +0200 +++ shippy-1.5.0/shipsdl2.c 2019-05-20 17:10:32.618036429 +0200 @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -29,6 +30,7 @@ SDL_Texture *BackBuffer = NULL; SDL_Texture *Graphics = NULL; SDL_Joystick *Joystick = NULL; Uint8 key[1337]; +static bool fullscreen = true; SDL_Rect src; SDL_Rect dest; @@ -212,8 +215,10 @@ void SYSTEM_CLEANBMP() void SYSTEM_SETVID() { Uint32 flags = SDL_WINDOW_FULLSCREEN; - if (start_windowed) + if (start_windowed) { flags &= ~SDL_WINDOW_FULLSCREEN; + fullscreen = false; + } screen = SDL_CreateWindow("Shippy1984 by Ryan Broomfield SDL2 VERSION", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen_width, screen_height, flags); SDL_ShowCursor(SDL_DISABLE); renderer = SDL_CreateRenderer(screen, -1, 0); @@ -482,6 +487,12 @@ void SYSTEM_IDLE() key[keyIndx] = 0; } } + if ((event.type == SDL_KEYDOWN) && key[SHIPPY_LALT] && + (event.key.keysym.sym == SDLK_RETURN)) { + fullscreen = !fullscreen; + SDL_SetWindowFullscreen(screen, + fullscreen ? SDL_WINDOW_FULLSCREEN : 0); + } } }