diff options
| author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-24 10:46:32 +0200 | 
|---|---|---|
| committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-24 10:46:32 +0200 | 
| commit | 5447ddd896eb49ea9fd9f9191a277fd1d5730aa3 (patch) | |
| tree | 96e09b8fb5d757aafef33da50a93204bae54ba9f /src/crepe/SDLContext.cpp | |
| parent | 0b08b742fffa63188c89d760a5aecd55d585403b (diff) | |
add PR #9 comments as code comments
Diffstat (limited to 'src/crepe/SDLContext.cpp')
| -rw-r--r-- | src/crepe/SDLContext.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/src/crepe/SDLContext.cpp b/src/crepe/SDLContext.cpp index 5a93679..8bc5bc6 100644 --- a/src/crepe/SDLContext.cpp +++ b/src/crepe/SDLContext.cpp @@ -40,6 +40,9 @@ SDLContext::~SDLContext() {  		SDL_DestroyWindow(this->game_window);  	} +	// TODO: how are we going to ensure that these are called from the same +	// thread that SDL_Init() was called on? This has caused problems for me +	// before.  	IMG_Quit();  	SDL_Quit();  } @@ -48,8 +51,10 @@ void SDLContext::clear_screen() { SDL_RenderClear(this->game_renderer); }  SDLContext::SDLContext() {  	dbg_trace(); +	// FIXME: read window defaults from config manager  	if (SDL_Init(SDL_INIT_VIDEO) < 0) { +		// FIXME: throw exception  		std::cerr << "SDL could not initialize! SDL_Error: " << SDL_GetError()  				  << std::endl;  		return; @@ -59,6 +64,7 @@ SDLContext::SDLContext() {  		"Crepe Game Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,  		1920, 1080, SDL_WINDOW_SHOWN);  	if (!this->game_window) { +		// FIXME: throw exception  		std::cerr << "Window could not be created! SDL_Error: "  				  << SDL_GetError() << std::endl;  	} @@ -66,6 +72,7 @@ SDLContext::SDLContext() {  	this->game_renderer  		= SDL_CreateRenderer(this->game_window, -1, SDL_RENDERER_ACCELERATED);  	if (!this->game_renderer) { +		// FIXME: throw exception  		std::cerr << "Renderer could not be created! SDL_Error: "  				  << SDL_GetError() << std::endl;  		SDL_DestroyWindow(this->game_window); @@ -74,6 +81,7 @@ SDLContext::SDLContext() {  	int img_flags = IMG_INIT_PNG;  	if (!(IMG_Init(img_flags) & img_flags)) { +		// FIXME: throw exception  		std::cout << "SDL_image could not initialize! SDL_image Error: "  				  << IMG_GetError() << std::endl;  	} |