#include #include #include template using sdl_deleter_t = decltype([](auto* ptr) { sdl_destroyfunc(ptr); }); using window_t = std::unique_ptr>; using surface_t = std::unique_ptr>; int main() { if (SDL_Init(SDL_INIT_VIDEO) < 0) { std::println("fuck"); return EXIT_FAILURE; } { auto window = window_t{SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1024, 512, SDL_WINDOW_SHOWN )}; if (!window) { std::println( "Window could not be created! SDL_Error: {}", SDL_GetError() ); return EXIT_FAILURE; } auto surface = surface_t{SDL_GetWindowSurface(window.get())}; SDL_Event e; bool quit = false; while (!quit) { while (SDL_PollEvent(&e)) { if (e.type == SDL_QUIT) { quit = true; } } } } SDL_Quit(); // leaking memory, nothing I can do }