1.1 --- a/include/image.h Sat Nov 10 18:53:06 2018 +0100
1.2 +++ b/include/image.h Sat Nov 10 19:06:08 2018 +0100
1.3 @@ -86,13 +86,17 @@
1.4
1.5 int yscale;
1.6
1.7 + /* The display associated with the sprite. */
1.8 +
1.9 + display_config_t *cfg;
1.10 +
1.11 } sprite_t;
1.12
1.13
1.14
1.15 /* Initialise stored regions, allocating memory and a structure to access it.
1.16
1.17 - Stored_Regions(<name>, int, int)
1.18 + Stored_Regions(<name>, int frames, int size)
1.19 */
1.20
1.21 #define Stored_Regions(NAME, FRAMES, SIZE) \
1.22 @@ -115,15 +119,22 @@
1.23 /* Initialise a sprite object using an existing image, creating stored regions
1.24 for the animation of the sprite.
1.25
1.26 - Sprite(<name>, image_t *, int, int)
1.27 + Sprite(<name>, image_t *image, display_config_t *cfg, int yscale)
1.28 */
1.29
1.30 -#define Sprite(NAME, IMAGE, FRAMES, YSCALE) \
1.31 - Stored_Regions(__##NAME##_regions, FRAMES, \
1.32 +#define Sprite(NAME, IMAGE, CFG, YSCALE) \
1.33 + Stored_Regions(__##NAME##_regions, (CFG)->frames, \
1.34 (IMAGE)->width * (IMAGE)->height * (YSCALE)); \
1.35 sprite_t NAME = { \
1.36 .image=IMAGE, \
1.37 .regions=&(__##NAME##_regions), \
1.38 - .yscale=YSCALE};
1.39 + .yscale=YSCALE, \
1.40 + .cfg=CFG};
1.41 +
1.42 +/* Plotting operations. */
1.43 +
1.44 +void image_plot_sprite(sprite_t *s, int x, int y, int key);
1.45 +
1.46 +void image_unplot_sprite(sprite_t *s);
1.47
1.48 #endif /* __IMAGE_H__ */