summaryrefslogtreecommitdiff
path: root/src/entityimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/entityimpl.h')
-rw-r--r--src/entityimpl.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/entityimpl.h b/src/entityimpl.h
index bd88df4..5ed9dfa 100644
--- a/src/entityimpl.h
+++ b/src/entityimpl.h
@@ -5,25 +5,27 @@
#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;
#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); \
+#define IMPL_INIT(X) static void init(Entity *, int, int, int, int); \
__attribute__((constructor)) static void init_tag() { \
entitytags[num_entitytags].init = init; \
entitytags[num_entitytags++].name = #X; \
} \
static void _init(Entity *this); \
-static void init(Entity *this, int x, int y) { \
+static void init(Entity *this, int x, int y, int w, int h) { \
memset(this, 0, sizeof(*this)); \
- this->update = update; \
- this->draw = draw; \
+ this->update = _update; \
+ this->draw = _draw; \
this->pos[0] = x; \
this->pos[1] = y; \
+ this->width = w; \
+ this->height = h; \
this->type = entity_type(#X); \
_init(this); \
} \