Compare commits
No commits in common. "0524f6ada9e11518a2fbb5db5339ad7af54cbddb" and "2e1eaf4c1c512761c7585267175bed420154172d" have entirely different histories.
0524f6ada9
...
2e1eaf4c1c
|
|
@ -139,15 +139,11 @@ inline void destroy_entity(entity_t *entity)
|
|||
inline void entity_manager_init(entity_manager_t *entity_manager)
|
||||
{
|
||||
linked_list_init(&entity_manager->entities, sizeof(entity_t), (deleter_t)destroy_entity);
|
||||
|
||||
debug_printf("Initialized entity manager.");
|
||||
}
|
||||
|
||||
inline void entity_manager_add_entity(entity_manager_t *entity_manager, entity_t *entity)
|
||||
{
|
||||
linked_list_push_back(&entity_manager->entities, entity);
|
||||
|
||||
debug_printf("Added entity %d to entity manager.", entity->id);
|
||||
}
|
||||
|
||||
// Only for this file
|
||||
|
|
@ -190,6 +186,4 @@ inline void entity_manager_remove_entity(entity_manager_t *entity_manager, unsig
|
|||
inline void entity_manager_exit(entity_manager_t *entity_manager)
|
||||
{
|
||||
linked_list_clear(&entity_manager->entities);
|
||||
|
||||
debug_printf("Exited entity manager.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,21 +9,17 @@
|
|||
#endif
|
||||
|
||||
#if DEBUG > 0
|
||||
#define debug_printf(...) \
|
||||
#define debug_printf(fmt, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "\033[33mINFO\033[m: %s:%d:%s(): ", __FILE__, __LINE__, __func__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fputc('\n', stderr); \
|
||||
fprintf(stderr, "\033[33mINFO\033[m: %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define debug_printf(...) do {} while (0)
|
||||
#define debug_printf(fmt, ...) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define error_printf(...) \
|
||||
#define error_printf(fmt, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "\033[31mERROR\033[m: %s:%d:%s(): ", __FILE__, __LINE__, __func__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fputc('\n', stderr); \
|
||||
fprintf(stderr, "\033[31mERROR\033[m: %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif // ERRORS_H
|
||||
11
src/main.c
11
src/main.c
|
|
@ -1,17 +1,7 @@
|
|||
#include "game.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
game_t game;
|
||||
|
||||
static inline void update_time(void)
|
||||
{
|
||||
static uint32_t last_clock_state = 0;
|
||||
uint32_t start_clock = SDL_GetTicks();
|
||||
game.delta_time_ms = (float)(start_clock - last_clock_state);
|
||||
last_clock_state = start_clock;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int exit_status = EXIT_SUCCESS;
|
||||
|
|
@ -20,7 +10,6 @@ int main(void)
|
|||
|
||||
while(game.is_running)
|
||||
{
|
||||
update_time();
|
||||
game_handle_event();
|
||||
game_update();
|
||||
if(game_render()) exit_status = EXIT_FAILURE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue