0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 10:13:42 +00:00

added more descriptive error messages

This commit is contained in:
Benedikt Galbavy 2024-01-29 17:41:47 +01:00
parent 2500b5b01f
commit 8c5c216838

View File

@ -1,7 +1,8 @@
#include "Game.h" #include "Game.h"
#include "Components.h" #include <SDL_error.h>
#include "Components.h"
#include "AssetManager.h" #include "AssetManager.h"
#include "Map.h" #include "Map.h"
#include "TextureManager.h" #include "TextureManager.h"
@ -37,21 +38,21 @@ void Game::init(const char* title, int xpos, int ypos, int width, int height, bo
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{ {
std::cout << "ERROR. Subsystem couldnt be initialized!" << std::endl; std::cout << "ERROR. Subsystem couldnt be initialized! " << SDL_GetError() << std::endl;
return; return;
} }
window = SDL_CreateWindow(title, xpos, ypos, width, height, flags); window = SDL_CreateWindow(title, xpos, ypos, width, height, flags);
if (!window) if (!window)
{ {
std::cout << "ERROR: Window couldnt be created!" << std::endl; std::cout << "ERROR: Window couldnt be created! " << SDL_GetError() << std::endl;
return; return;
} }
renderer = SDL_CreateRenderer(window, -1, 0); renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer) if (!renderer)
{ {
std::cout << "ERROR: Renderer couldnt be created!" << std::endl; std::cout << "ERROR: Renderer couldnt be created! " << SDL_GetError() << std::endl;
return; return;
} }
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);