Added runtime checks for window and renderer

This commit is contained in:
Robert 2021-10-28 23:36:40 +02:00
parent b3a3a60bd0
commit 899135b866

View file

@ -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