X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=shape.h;h=c2d0a8e1757859c3ff1ab53a38766686f448fe18;hb=c633a2e26924f5210aa8094593f5f003cee70a48;hp=26b3b6315a1bf4b3bc931ca6bf5d4361b12f62ae;hpb=36430b3c87da1304d1de5bf9d294545f46d6f3a0;p=vor.git diff --git a/shape.h b/shape.h index 26b3b63..c2d0a8e 100644 --- a/shape.h +++ b/shape.h @@ -2,7 +2,10 @@ #define VOR_SHAPE_H #include -#include +#include + + +// Shape stuff struct shape { int w, h; @@ -13,5 +16,59 @@ struct shape { void get_shape(SDL_Surface *img, struct shape *s); int collide(int xdiff, int ydiff, struct shape *r, struct shape *s); +int pixel_collide(unsigned int xoff, unsigned int yoff, struct shape *r); + + + +// Sprite stuff + +typedef union sprite Sprite; + +#define SPRITE(x) ((Sprite *) (x)) + +struct base_sprite { + uint8_t type; + Sprite *next; + float x, y; + float dx, dy; + SDL_Surface *image; + struct shape *shape; +}; + +struct rock { + // core sprite fields + uint8_t sprite_type; + Sprite *next; + float x, y; + float dx, dy; + SDL_Surface *image; + struct shape *shape; + // ROCK extras + int type; +}; + +struct ship { + // core sprite fields + uint8_t sprite_type; + Sprite *next; + float x, y; + float dx, dy; + SDL_Surface *image; + struct shape *shape; + // SHIP extras + int lives; + int jets; +}; + +union sprite { + uint8_t type; + struct base_sprite sprite; + struct rock rock; + struct ship ship; +}; + +#define BASE_SPRITE 0 +#define SHIP_SPRITE 1 +#define ROCK_SPRITE 2 #endif // VOR_SHAPE_H