38 lines
1.0 KiB
C
38 lines
1.0 KiB
C
#ifndef OBJECT_STORE_H
|
|
#define OBJECT_STORE_H
|
|
|
|
#include "Renderer.h"
|
|
#include "SDL_events.h"
|
|
#include "engine_build_config.h"
|
|
#include "reusable_ids.h"
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif // !__cplusplus
|
|
|
|
typedef void (*EventHandlerPtr)(void *object, const SDL_Event *event);
|
|
typedef void (*UpdateFuncPtr)(void *object, float delta);
|
|
typedef void (*RenderFuncPtr)(void *object);
|
|
|
|
typedef struct object_store ObjectStore;
|
|
|
|
ObjectStore *create_object_store();
|
|
ObjectID add_object_to_store(ObjectStore *os, void *object, EventHandlerPtr eh,
|
|
UpdateFuncPtr uf, RenderFuncPtr rf);
|
|
void remove_object_from_store(ObjectStore *os, ObjectID *id_ptr);
|
|
void handle_all_objects_events(ObjectStore *os, const SDL_Event *event);
|
|
void update_all_objects(ObjectStore *os, float delta);
|
|
void render_all_objects(ObjectStore *os);
|
|
void destroy_object_store(ObjectStore **os);
|
|
|
|
#ifdef DEBUG_ENGINE
|
|
void print_objects(ObjectStore *os);
|
|
#endif // !DEBUG_ENGINE
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif // !__cplusplus
|
|
|
|
#endif // !OBJECT_STORE_H
|