diff --git a/CMakeLists.txt b/CMakeLists.txt index c7160e4..bad3757 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ install(FILES include/Game.h include/Window.h include/Renderer.h + include/ObjectStore.h CONFIGURATIONS Release DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/include/ObjectStore.h b/include/ObjectStore.h new file mode 100644 index 0000000..384645d --- /dev/null +++ b/include/ObjectStore.h @@ -0,0 +1,13 @@ +#ifndef OBJECT_STORE_H +#define OBJECT_STORE_H + +#include "Renderer.h" + +typedef void (*UpdateFuncPtr)(float delta, void *object); +typedef void (*RenderFuncPtr)(Renderer *renderer, void *object); + +typedef struct object_store ObjectStore; + +void add_object_to_store(ObjectStore *os, UpdateFuncPtr uf, RenderFuncPtr rf); + +#endif // !OBJECT_STORE_H diff --git a/src/Game.c b/src/Game.c index 82077c1..7b6bb6c 100644 --- a/src/Game.c +++ b/src/Game.c @@ -1,5 +1,6 @@ #include "Game.h" #include "SDL.h" +#include "SDL_error.h" #include "SDL_events.h" #include "SDL_pixels.h" #include "Window.h" @@ -21,7 +22,7 @@ bool init_game(const char *game_name, int window_width, int window_height, bool full_screen) { if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { #ifdef DEBUG_ENGINE - printf("Failed to initialise game\n"); + printf("Failed to initialise SDL. Error: %s\n", SDL_GetError()); #endif /* DEBUG_ENGINE */ return false; @@ -30,7 +31,7 @@ bool init_game(const char *game_name, int window_width, int window_height, if (!init_window(&(Game.window), game_name, window_width, window_height, full_screen)) { #ifdef DEBUG_ENGINE - printf("Failed to initialise game\n"); + printf("Failed to initialise window\n"); #endif /* DEBUG_ENGINE */ return false;