error handling

This commit is contained in:
Jakob Hördt 2024-08-04 15:58:14 +02:00
parent 9a11684363
commit fbc667b321

View file

@ -90,22 +90,13 @@ auto poll_events(bool& continu) {
} // namespace
int main() try {
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
std::println("fuck");
return EXIT_FAILURE;
}
sdl_check(SDL_Init(SDL_INIT_VIDEO));
Defer<SDL_Quit> defer_SDL_Quit;
window_t window{SDL_CreateWindow(
"random walk", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width,
height, SDL_WINDOW_FULLSCREEN
height, 0//SDL_WINDOW_FULLSCREEN
)};
if (!window) {
std::println(
"Window could not be created! SDL_Error: {}", SDL_GetError()
);
return EXIT_FAILURE;
}
// owned by window
auto* window_surface = sdl_check(SDL_GetWindowSurface(window));