From 899135b866062682d785f5545159d9d40d859f98 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 28 Oct 2021 23:36:40 +0200 Subject: [PATCH] Added runtime checks for window and renderer --- src/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 3b7893c..39c8436 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,18 @@ int main(int argc, char** argv) SDL_Init(SDL_INIT_VIDEO); SDL_Window* window = SDL_CreateWindow("Gameboy Emulator", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN); + { + std::cerr << "Failed to create window:\n" << SDL_GetError() << std::endl; + return -1; + } + SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); + if(renderer == nullptr) + { + std::cerr << "Failed to create accelerated rendering device:\n" << SDL_GetError() << std::endl; + return -1; + } + SDL_Event e; // Initialize ImGui