From 54ff18bd32c932b47aa77497bc8a6fb6344894b6 Mon Sep 17 00:00:00 2001 From: zlago Date: Thu, 3 Oct 2024 15:50:44 +0200 Subject: refactor entities --- src/loader.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/loader.h') diff --git a/src/loader.h b/src/loader.h index 016b8b2..61f9e3c 100644 --- a/src/loader.h +++ b/src/loader.h @@ -10,6 +10,11 @@ struct blob { size_t size; }; +struct funs { + struct entity *(*newfun)(void); + int (*setfun)(struct entity *const restrict self, char const *const restrict key, char const *const restrict value); +}; + void res_init(void); void res_init_texture(void); @@ -24,12 +29,8 @@ void res_init_collision(void); void res_free_collision(void); struct blob res_get_collision(name_T const name); -void res_free_newfun(void); -void res_push_newfun(struct entity *(*newfun)(void), name_T name); -struct entity *(*res_get_newfun(name_T const name))(void); - -void res_free_setfun(void); -void res_push_setfun(int (*setfun)(struct entity *const restrict self, char const *const restrict key, char const *const restrict value), name_T name); -int (*res_get_setfun(name_T const name))(struct entity *const restrict self, char const *const restrict key, char const *const restrict value); +void res_free_fun(void); +void res_push_fun(struct entity *(*newfun)(void), int (*setfun)(struct entity *const restrict self, char const *const restrict key, char const *const restrict value), name_T name); +struct funs res_get_fun(name_T const name); int loadResources(char *filename); -- cgit 1.4.1-2-gfad0