blob: fe76febc8c924db0e11472bd4f200caa755b7035 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
#include <SDL2/SDL.h>
#define from_fixed(a) (a / 16)
#define to_fixed(a) (a * 16)
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 velocity {
signed x, y;
} velocity;
struct hitbox {
unsigned left, right, top, bottom;
} hitbox;
struct anim {
unsigned frame;
SDL_Rect rect;
unsigned length;
} 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;
};
|