Skip to content

Instantly share code, notes, and snippets.

@flibitijibibo
Created January 20, 2022 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flibitijibibo/96d6f64c5486fa043cbfdbeb77709226 to your computer and use it in GitHub Desktop.
Save flibitijibibo/96d6f64c5486fa043cbfdbeb77709226 to your computer and use it in GitHub Desktop.
/* 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