#include "sdl2.h" SDLContext context; void sdl_init() { int const width = 1280; int const height = 720; context = (SDLContext){NULL, NULL, .width = 0, .height = 0}; if (SDL_Init(SDL_INIT_VIDEO)) { return; } SDL_Window *window = SDL_CreateWindow("Sokoban", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_SHOWN); if (!window) { return; } SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); context = (SDLContext){ .window = window, .renderer = renderer, .width = width, .height = height}; } void sdl_quit() { SDL_DestroyWindow(context.window); SDL_DestroyRenderer(context.renderer); context.window = NULL; context.renderer = NULL; SDL_Quit(); }