Added runtime checks for window and renderer
This commit is contained in:
parent
b3a3a60bd0
commit
899135b866
11
src/main.cpp
11
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
|
||||
|
|
Loading…
Reference in a new issue