123456789101112131415161718192021222324252627282930313233 |
- #ifndef _DD_SPRITE_H_
- #define _DD_SPRITE_H_
- #include "SDL2/SDL.h"
- #include "sdl_helper.h"
- struct dd_sprite {
- // interface
- int x, y;
- int w, h;
- SDL_Texture *texture;
- SDL_Rect rect;
- void (*load)(struct dd_sprite*, const char*);
- void (*draw)(struct dd_sprite*);
- int (*collide)(struct dd_sprite*, struct dd_sprite*);
- };
- struct dd_sprite *dd_sprite_create();
- void dd_sprite_init(struct dd_sprite *);
- void dd_sprite_load(struct dd_sprite *, const char *);
- void dd_sprite_draw(struct dd_sprite *);
- int dd_sprite_collide(struct dd_sprite *, struct dd_sprite *);
- #endif
|