aboutsummaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2021-03-12 11:37:09 +0000
committerrodri <rgl@antares-labs.eu>2021-03-12 11:37:09 +0000
commit1546beac329d017b86331d0acd2dd0dd86101506 (patch)
treeddd8c59a8cd0244db1730ba91ba860078205ab51 /dat.h
parentc35a8302c6275a1ba71dcdff15f58310d064a909 (diff)
downloadgamephysics-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.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/dat.h b/dat.h
index 4dd4250..a3065ee 100644
--- a/dat.h
+++ b/dat.h
@@ -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);
+};