Skip to content

Instantly share code, notes, and snippets.

@tonitch
Created December 19, 2023 23:06
Show Gist options
  • Save tonitch/e22efcfa8b18ab3e67203e08f8a33b20 to your computer and use it in GitHub Desktop.
Save tonitch/e22efcfa8b18ab3e67203e08f8a33b20 to your computer and use it in GitHub Desktop.
#include <SDL2/SDL.h>
#define SIZE 10
#define WIDTH SIZE * 16
#define HEIGHT SIZE * 9
int main(void)
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* win = SDL_CreateWindow("note", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WIDTH, HEIGHT, 0);
SDL_Renderer* ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_PRESENTVSYNC);
SDL_Event e;
SDL_bool should_exit = SDL_FALSE;
SDL_SetRenderDrawColor(ren, 0x18, 0x18, 0x18, SDL_ALPHA_OPAQUE);
while(!should_exit){
while(SDL_PollEvent(&e))
if(e.type == SDL_QUIT)
should_exit = SDL_TRUE;
SDL_RenderClear(ren);
}
SDL_DestroyRenderer(ren);
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment