diff options
Diffstat (limited to 'src/entityimpl.h')
-rw-r--r-- | src/entityimpl.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/entityimpl.h b/src/entityimpl.h index afc9dc2..e21462d 100644 --- a/src/entityimpl.h +++ b/src/entityimpl.h @@ -5,12 +5,13 @@ #include "entitytag.h" #include <string.h> -//[[maybe_unused]] static void *_draw; -//[[maybe_unused]] static void *_update; +[[maybe_unused]] static void *_draw; +[[maybe_unused]] static void *_update; +[[maybe_unused]] static void *_smash; #define IMPL(X) static void X(Entity *this, Game *g); \ +__attribute__((constructor)) static void init_##X() { _##X = X; } \ static void X([[maybe_unused]] Entity *this, [[maybe_unused]] Game *g) -/*__attribute__((constructor)) static void init_##X() { _##X = X; } \ */ #define IMPL_INIT(X) static void init(Entity *this, int x, int y); \ __attribute__((constructor)) static void init_tag() { \ @@ -20,8 +21,9 @@ __attribute__((constructor)) static void init_tag() { \ static void _init(Entity *this); \ static void init(Entity *this, int x, int y) { \ memset(this, 0, sizeof(*this)); \ - this->update = update; \ - this->draw = draw; \ + this->update = _update; \ + this->draw = _draw; \ + this->smash = _smash; \ this->pos[0] = x; \ this->pos[1] = y; \ this->type = entity_type(#X); \ |