X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=sprite.h;h=0bca1af651fe9913c50b8cf695a4c9d2a4e38551;hp=2e7ad3b1f1ac96e55a8be255022a830ca00c4462;hb=4a469ea97150b43af9990db9baa31849ff186516;hpb=0978da8f14d855eecae9882b559d6e8b0533e78e diff --git a/sprite.h b/sprite.h index 2e7ad3b..0bca1af 100644 --- a/sprite.h +++ b/sprite.h @@ -26,12 +26,11 @@ struct sprite { uint32_t area; }; -#define MOVE_FLAG 1 -#define DRAW_FLAG 2 -#define COLLIDE_FLAG 4 -#define ALL_FLAGS (~0) +#define MOVE 1 +#define DRAW 2 +#define COLLIDE 4 -#define COLLIDES(sprite) ((sprite)->flags & COLLIDE_FLAG) +#define COLLIDES(sprite) ((sprite)->flags & COLLIDE) Sprite *free_sprites[N_TYPES]; // lists of free sprites, by type. @@ -41,13 +40,14 @@ void collisions(void); void init_sprites(void); void reset_sprites(void); void add_sprite(Sprite *s); -void move_sprite(Sprite *s); -void move_sprites(void); +void move_sprite(Sprite *s, float ticks); +void move_sprites(float ticks); Sprite *collides(Sprite *s); -int pixel_collides(float x, float y); +Sprite * pixel_collides(float x, float y); void load_sprite(Sprite *sprite, char *filename); +float sprite_mass(Sprite *s); void bounce(Sprite *a, Sprite *b); @@ -109,7 +109,7 @@ static inline void draw_sprite(Sprite *s) { SDL_Rect dest; - if(s->flags & DRAW_FLAG) { + if(s->flags & DRAW) { dest.x = s->x; dest.y = s->y; SDL_BlitSurface(s->image, NULL, surf_screen, &dest); }