hyperultra/src/entityimpl.h

24 lines
694 B
C

#pragma once
#include "game.h"
#include "cfg.h"
#include "lzy.h"
#include "entitytag.h"
#include <string.h>
#define IMPL_UPDATE() static Entity * \
update([[maybe_unused]] Entity *this, [[maybe_unused]] Game *g) {
#define IMPL_DRAW() static Entity * \
draw([[maybe_unused]] Entity *this, [[maybe_unused]] Game *g) {
#define IMPL_INIT(X) __attribute__((constructor)) static void init_tag() { \
entitytags[num_entitytags++] = #X; \
} \
Entity *X##_init(Entity *this, int x, int y) { do { \
memset(this, 0, sizeof(*this)); \
this->update = update; \
this->draw = draw; \
this->pos[0] = x; \
this->pos[1] = y; \
this->type = entity_type(#X); \
} while(0);
#define IMPL_END return this; }