From fbc667b321debe6625937a34cc746dd44dd59604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20H=C3=B6rdt?= <6329417-neop_@users.noreply.gitlab.com> Date: Sun, 4 Aug 2024 15:58:14 +0200 Subject: [PATCH] error handling --- main.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/main.cpp b/main.cpp index fa8ba93..5c6d88b 100644 --- a/main.cpp +++ b/main.cpp @@ -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 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));