Ylva And Malin
ym_resource.h
Go to the documentation of this file.
1 #pragma once
2 #include <ym_core.h>
3 #include <ym_gfx_sprite.h>
4 
5 typedef struct
6 {
7  char filename[256];
8  int tilewidth;
9  int tileheight;
10  int firstgid;
11  int tilecount;
12  int rowcount;
13  int colcount;
15 } ym_tileset;
16 
17 typedef struct
18 {
19  ym_vec2 coordinates[10][10];
20  ym_sheet_id sheet_ids[10][10];
21  ym_sprite_id sprite_ids[10][10];
22 } ym_layer;
23 
24 // Returns several arrays,
25 // * one containing information about all the tilesets
26 // * Tilewidth & Tileheight, use this with width and height of image to determine columns and rows
27 // * one containing a collection of coordinates and id's that needs to be tied to tiles
28 
29 
30 ym_errc
31 ym_resource_load_map(const char* filepath,
32  ym_tileset** out_tileset,
33  int* out_tileset_count,
34  ym_layer** out_layer,
35  int* out_layer_count);
36 
37 ym_errc
38 ym_resource_parse_map(const ym_tileset* tileset,
39  int tileset_count,
40  ym_layer* layer,
41  int layer_count);
int firstgid
Definition: ym_resource.h:10
int tilecount
Definition: ym_resource.h:11
Definition: ym_math.h:8
ym_sheet_id sheet_id
Definition: ym_resource.h:14
ym_errc ym_resource_parse_map(const ym_tileset *tileset, int tileset_count, ym_layer *layer, int layer_count)
Definition: ym_resource.c:123
int colcount
Definition: ym_resource.h:13
int tileheight
Definition: ym_resource.h:9
ym_errc
Used to indicate erroneous behavior within a a function.
Definition: ym_error.h:36
GLuint ym_sheet_id
Definition: ym_gfx_sprite.h:13
ym_errc ym_resource_load_map(const char *filepath, ym_tileset **out_tileset, int *out_tileset_count, ym_layer **out_layer, int *out_layer_count)
Definition: ym_resource.c:7
int tilewidth
Definition: ym_resource.h:8
GLuint ym_sprite_id
Definition: ym_gfx_sprite.h:14
Definition: ym_resource.h:5
int rowcount
Definition: ym_resource.h:12
Definition: ym_resource.h:17