diff options
author | rodri <rgl@antares-labs.eu> | 2024-11-15 16:38:47 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-11-15 16:38:47 +0000 |
commit | 423e5319e3d3501637fffb11bb5c0acd48c2f424 (patch) | |
tree | c94e9a4c437a5dd931c1b1c1cc13057f24833163 /dat.h | |
parent | 2d2fda85ac4907d53a26b9afebdfadf9364a6436 (diff) | |
download | battleship-423e5319e3d3501637fffb11bb5c0acd48c2f424.tar.gz battleship-423e5319e3d3501637fffb11bb5c0acd48c2f424.tar.bz2 battleship-423e5319e3d3501637fffb11bb5c0acd48c2f424.zip |
bts: add vfx. use stringn instead of string.
Diffstat (limited to 'dat.h')
-rw-r--r-- | dat.h | 39 |
1 files changed, 36 insertions, 3 deletions
@@ -7,7 +7,7 @@ enum { Tmiss, NTILES, - TBITS = 2, /* ceil(log(NTILES)/log(2)) */ + TBITS = 2, /* ceil(log(NTILES)/log(2)) */ TMASK = (1<<TBITS) - 1, Scarrier = 0, @@ -17,8 +17,12 @@ enum { Sdestroyer, NSHIPS, - OH, /* horizontal */ - OV, /* vertical */ + VFXHit = 0, + VFXMiss, + NVFX, + + OH = 0, /* horizontal */ + OV, /* vertical */ GMPvP = 0, GMPvAI, @@ -180,6 +184,35 @@ struct Button void (*handler)(Button*); }; +typedef struct Sprite Sprite; +typedef struct Vfx Vfx; + +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); + Sprite *(*clone)(Sprite*); +}; + +struct Vfx +{ + Sprite *a; /* animation */ + Point p; + int times; /* to repeat. -1 loops forever */ + Vfx *prev, *next; + + void (*step)(Vfx*, ulong); + void (*draw)(Vfx*, Image*); +}; + typedef struct Mentry Mentry; typedef struct Mlist Mlist; typedef struct Menulist Menulist; |