summaryrefslogtreecommitdiff
path: root/gfx-iso/include/isogfx/isogfx.h
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2023-07-19 08:35:00 -0700
committer3gg <3gg@shellblade.net>2023-07-19 08:35:00 -0700
commit48cef82988d6209987ae27fe29b72d7d5e402b3c (patch)
treefe5df57729a61839322ae8c1226d134e317b049f /gfx-iso/include/isogfx/isogfx.h
parent2c668763a1d6e645dcfaa713b924de26260542d0 (diff)
Add sprites.
Diffstat (limited to 'gfx-iso/include/isogfx/isogfx.h')
-rw-r--r--gfx-iso/include/isogfx/isogfx.h35
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
9typedef struct IsoGfx IsoGfx; 9typedef struct IsoGfx IsoGfx;
10 10
11/// Sprite sheet handle.
12typedef uint16_t SpriteSheet;
13
14/// Sprite handle.
15typedef uint16_t Sprite;
16
11/// Tile handle. 17/// Tile handle.
12typedef uint16_t Tile; 18typedef uint16_t Tile;
13 19
@@ -48,8 +54,10 @@ typedef struct WorldDesc {
48} WorldDesc; 54} WorldDesc;
49 55
50typedef struct IsoGfxDesc { 56typedef 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).
80void isogfx_set_tiles(IsoGfx*, int x0, int y0, int x1, int y1, Tile); 88void isogfx_set_tiles(IsoGfx*, int x0, int y0, int x1, int y1, Tile);
81 89
90/// Load a sprite sheet (.SS) file.
91bool isogfx_load_sprite_sheet(IsoGfx*, const char* filepath, SpriteSheet*);
92
93/// Create an animated sprite.
94Sprite isogfx_make_sprite(IsoGfx*, SpriteSheet);
95
96/// Destroy the sprite.
97void isogfx_del_sprite(IsoGfx*, Sprite);
98
99/// Destroy all the sprites.
100void isogfx_del_sprites(IsoGfx*);
101
102/// Set the sprite's position.
103void isogfx_set_sprite_position(IsoGfx*, Sprite, int x, int y);
104
105/// Set the sprite's current animation.
106void isogfx_set_sprite_animation(IsoGfx*, Sprite, int animation);
107
108/// Update the renderer.
109///
110/// Currently this updates the sprite animations.
111void isogfx_update(IsoGfx*, double t);
112
82/// Render the world. 113/// Render the world.
83void isogfx_render(IsoGfx*); 114void isogfx_render(IsoGfx*);
84 115