Created
January 20, 2022 22:15
-
-
Save flibitijibibo/96d6f64c5486fa043cbfdbeb77709226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* gcc -g -o titlebar titlebar.c `sdl2-config --cflags --libs` | |
* SDL_VIDEODRIVER=wayland ./titlebar | |
*/ | |
#include <SDL.h> | |
int main(int argc, char **argv) | |
{ | |
SDL_Window *window; | |
SDL_Renderer *renderer; | |
SDL_Event evt; | |
SDL_bool run = SDL_TRUE; | |
SDL_Init(SDL_INIT_VIDEO); | |
SDL_CreateWindowAndRenderer( | |
640, | |
480, | |
SDL_WINDOW_FULLSCREEN_DESKTOP, | |
&window, | |
&renderer | |
); | |
while (run) | |
{ | |
while (SDL_PollEvent(&evt) > 0) | |
{ | |
if (evt.type == SDL_QUIT) | |
{ | |
run = SDL_FALSE; | |
} | |
else if (evt.type == SDL_KEYDOWN) | |
{ | |
if (evt.key.keysym.sym == SDLK_SPACE) | |
{ | |
SDL_SetWindowFullscreen(window, 0); | |
} | |
} | |
} | |
SDL_RenderClear(renderer); | |
SDL_RenderPresent(renderer); | |
} | |
SDL_DestroyRenderer(renderer); | |
SDL_DestroyWindow(window); | |
SDL_Quit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment