diff options
author | 3gg <3gg@shellblade.net> | 2023-07-19 08:35:00 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2023-07-19 08:35:00 -0700 |
commit | 48cef82988d6209987ae27fe29b72d7d5e402b3c (patch) | |
tree | fe5df57729a61839322ae8c1226d134e317b049f /gfx-iso/include | |
parent | 2c668763a1d6e645dcfaa713b924de26260542d0 (diff) |
Add sprites.
Diffstat (limited to 'gfx-iso/include')
-rw-r--r-- | gfx-iso/include/isogfx/isogfx.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/gfx-iso/include/isogfx/isogfx.h b/gfx-iso/include/isogfx/isogfx.h index 6b7ce8e..e96606c 100644 --- a/gfx-iso/include/isogfx/isogfx.h +++ b/gfx-iso/include/isogfx/isogfx.h | |||
@@ -8,6 +8,12 @@ | |||
8 | 8 | ||
9 | typedef struct IsoGfx IsoGfx; | 9 | typedef struct IsoGfx IsoGfx; |
10 | 10 | ||
11 | /// Sprite sheet handle. | ||
12 | typedef uint16_t SpriteSheet; | ||
13 | |||
14 | /// Sprite handle. | ||
15 | typedef uint16_t Sprite; | ||
16 | |||
11 | /// Tile handle. | 17 | /// Tile handle. |
12 | typedef uint16_t Tile; | 18 | typedef uint16_t Tile; |
13 | 19 | ||
@@ -48,8 +54,10 @@ typedef struct WorldDesc { | |||
48 | } WorldDesc; | 54 | } WorldDesc; |
49 | 55 | ||
50 | typedef struct IsoGfxDesc { | 56 | typedef struct IsoGfxDesc { |
51 | int screen_width; /// Screen width in pixels. | 57 | int screen_width; /// Screen width in pixels. |
52 | int screen_height; /// Screen height in pixels. | 58 | int screen_height; /// Screen height in pixels. |
59 | int max_num_sprites; /// 0 for an implementation-defined default. | ||
60 | int sprite_sheet_pool_size_bytes; /// 0 for an implementation-defined default. | ||
53 | } IsoGfxDesc; | 61 | } IsoGfxDesc; |
54 | 62 | ||
55 | /// Create a new isometric graphics engine. | 63 | /// Create a new isometric graphics engine. |
@@ -79,6 +87,29 @@ void isogfx_set_tile(IsoGfx*, int x, int y, Tile); | |||
79 | /// Set the tiles in positions in the range (x0,y0) - (x1,y1). | 87 | /// Set the tiles in positions in the range (x0,y0) - (x1,y1). |
80 | void isogfx_set_tiles(IsoGfx*, int x0, int y0, int x1, int y1, Tile); | 88 | void isogfx_set_tiles(IsoGfx*, int x0, int y0, int x1, int y1, Tile); |
81 | 89 | ||
90 | /// Load a sprite sheet (.SS) file. | ||
91 | bool isogfx_load_sprite_sheet(IsoGfx*, const char* filepath, SpriteSheet*); | ||
92 | |||
93 | /// Create an animated sprite. | ||
94 | Sprite isogfx_make_sprite(IsoGfx*, SpriteSheet); | ||
95 | |||
96 | /// Destroy the sprite. | ||
97 | void isogfx_del_sprite(IsoGfx*, Sprite); | ||
98 | |||
99 | /// Destroy all the sprites. | ||
100 | void isogfx_del_sprites(IsoGfx*); | ||
101 | |||
102 | /// Set the sprite's position. | ||
103 | void isogfx_set_sprite_position(IsoGfx*, Sprite, int x, int y); | ||
104 | |||
105 | /// Set the sprite's current animation. | ||
106 | void isogfx_set_sprite_animation(IsoGfx*, Sprite, int animation); | ||
107 | |||
108 | /// Update the renderer. | ||
109 | /// | ||
110 | /// Currently this updates the sprite animations. | ||
111 | void isogfx_update(IsoGfx*, double t); | ||
112 | |||
82 | /// Render the world. | 113 | /// Render the world. |
83 | void isogfx_render(IsoGfx*); | 114 | void isogfx_render(IsoGfx*); |
84 | 115 | ||