diff options
author | rodri <rgl@antares-labs.eu> | 2021-03-12 11:37:09 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2021-03-12 11:37:09 +0000 |
commit | 1546beac329d017b86331d0acd2dd0dd86101506 (patch) | |
tree | ddd8c59a8cd0244db1730ba91ba860078205ab51 /dat.h | |
parent | c35a8302c6275a1ba71dcdff15f58310d064a909 (diff) | |
download | gamephysics-1546beac329d017b86331d0acd2dd0dd86101506.tar.gz gamephysics-1546beac329d017b86331d0acd2dd0dd86101506.tar.bz2 gamephysics-1546beac329d017b86331d0acd2dd0dd86101506.zip |
implemented fixed-time dynamics stepper, animated sprites and cleaned things up.
Diffstat (limited to 'dat.h')
-rw-r--r-- | dat.h | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1,6 +1,7 @@ -typedef struct State State; +typedef struct GameState GameState; typedef struct Derivative Derivative; typedef struct Stats Stats; +typedef struct Sprite Sprite; struct Stats { @@ -12,7 +13,7 @@ struct Stats void (*update)(Stats*, double); }; -struct State +struct GameState { double x, v; Stats stats; @@ -22,3 +23,17 @@ struct Derivative { double dx, dv; }; + +struct Sprite +{ + Image *sheet; + Point sp; + Rectangle r; + int nframes; + int curframe; + ulong period; + ulong elapsed; + + void (*step)(Sprite*, ulong); + void (*draw)(Sprite*, Image*, Point); +}; |