Mercurial > molko
comparison librpg/rpg/tileset-file.h @ 228:2734223d3daf
core: add a alloc_pool module
A miniamlist expandable array that gros each time new data is required, ideal
where data must be allocated dynamically without knowing in advance the number
of items.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 19 Nov 2020 14:11:11 +0100 |
parents | dd7c8d4321a3 |
children | e71039d820a7 |
comparison
equal
deleted
inserted
replaced
227:befa2e855d3b | 228:2734223d3daf |
---|---|
20 #define MOLKO_RPG_TILESET_FILE_H | 20 #define MOLKO_RPG_TILESET_FILE_H |
21 | 21 |
22 #include <stdbool.h> | 22 #include <stdbool.h> |
23 #include <stddef.h> | 23 #include <stddef.h> |
24 | 24 |
25 #include <core/alloc.h> | |
25 #include <core/sprite.h> | 26 #include <core/sprite.h> |
26 #include <core/texture.h> | 27 #include <core/texture.h> |
27 | 28 |
28 struct tileset; | 29 struct tileset; |
29 struct tileset_tiledef; | 30 struct tileset_tiledef; |
30 | 31 |
31 struct tileset_file { | 32 struct tileset_file { |
32 struct tileset_tiledef *tiledefs; /*!< (*) Owned tile definitions. */ | 33 struct alloc_pool tiledefs; |
34 struct alloc_pool anims[2]; | |
33 struct texture image; /*!< (*) Owned image file. */ | 35 struct texture image; /*!< (*) Owned image file. */ |
34 struct sprite sprite; /*!< (*) Owned sprite. */ | 36 struct sprite sprite; /*!< (*) Owned sprite. */ |
35 struct tileset_file_animation *tfas; /*!< (*) Owned per tile animations. */ | |
36 size_t tfasz; /*!< (*) Onwed number of tiles. */ | |
37 struct tileset_animation *anims; /*!< (*) Owned animations array. */ | |
38 }; | 37 }; |
39 | 38 |
40 bool | 39 bool |
41 tileset_file_open(struct tileset_file *tf, struct tileset *tileset, const char *path); | 40 tileset_file_open(struct tileset_file *tf, struct tileset *tileset, const char *path); |
42 | 41 |