Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "stretchy_buffer.h"
- typedef enum {
- DRAWABLE = 1 << 0,
- COLLIDABLE = 1 << 1,
- CONTROLLABLE = 1 << 2,
- } flag_t;
- typedef struct entity_t entity_t;
- typedef struct world_t world_t;
- typedef struct callback_t callback_t;
- struct callback_t {
- unsigned int filter;
- void(*func)(world_t *, entity_t *);
- };
- struct entity_t {
- unsigned long type, destroy, id;
- void *self;
- };
- struct world_t {
- unsigned int count;
- entity_t *entities;
- callback_t *cb;
- };
- world_t *world_new() {
- world_t *self = calloc(1, sizeof(*self));
- self->count = 0;
- self->entities = NULL;
- self->cb = NULL;
- return self;
- }
- void world_push(world_t *self, entity_t *e) {
- sb_push(self->entities, e);
- self->count = sb_count(self->entities);
- }
- int main(void) {
- // entity_t bar = { .type = DRAW | COLLISION, .data = NULL };
- return 0;
- }
Add Comment
Please, Sign In to add comment