error handling
This commit is contained in:
parent
9a11684363
commit
fbc667b321
1 changed files with 2 additions and 11 deletions
13
main.cpp
13
main.cpp
|
@ -90,22 +90,13 @@ auto poll_events(bool& continu) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main() try {
|
int main() try {
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
sdl_check(SDL_Init(SDL_INIT_VIDEO));
|
||||||
std::println("fuck");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
Defer<SDL_Quit> defer_SDL_Quit;
|
Defer<SDL_Quit> defer_SDL_Quit;
|
||||||
|
|
||||||
window_t window{SDL_CreateWindow(
|
window_t window{SDL_CreateWindow(
|
||||||
"random walk", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width,
|
"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
|
// owned by window
|
||||||
auto* window_surface = sdl_check(SDL_GetWindowSurface(window));
|
auto* window_surface = sdl_check(SDL_GetWindowSurface(window));
|
||||||
|
|
Loading…
Reference in a new issue