#pragma once #include #define from_fixed(a) (a / 16) #define to_fixed(a) (a * 16) struct vec2 { signed x, y; }; struct hitbox { unsigned left, right, top, bottom; }; struct anim { unsigned frame; SDL_Rect rect; unsigned length; }; struct entity { int (*update)(struct entity *self); int (*hurt)(struct entity *self, int damage); int (*draw)(struct entity *self, int camx, int camy); void (*free)(struct entity *self); int x, y; // unsigned results in a bunch of weird edge cases struct vec2 velocity; struct hitbox hitbox; struct anim anim; unsigned state; int hp; int timer; int iframes; signed facing; void *texture; void *ext; }; struct warp { int (*update)(struct warp *); unsigned x, y; unsigned w, h; unsigned tox, toy; struct hitbox hitbox; unsigned timer; void *ext; }; struct projectile { int (*update)(struct projectile *self); int (*draw)(struct projectile *self, int camx, int camy); void (*free)(struct projectile *self); int x, y; // unsigned results in a bunch of weird edge cases struct vec2 velocity; struct hitbox hitbox; struct anim anim; unsigned state; int hp; int timer; int iframes; signed facing; void *texture; void *ext; }; struct particle { int x, y; struct vec2 velocity; struct vec2 acceleration; SDL_Rect rect; int hp; };