From 0c44af8f6c45e5bb957f38cc3e9784ca69524261 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Wed, 7 Dec 2022 23:43:20 +0100 Subject: work --- include/map.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 include/map.h (limited to 'include/map.h') diff --git a/include/map.h b/include/map.h new file mode 100644 index 0000000..0bf1028 --- /dev/null +++ b/include/map.h @@ -0,0 +1,63 @@ +#ifndef INCLUDE_MAP +#define INCLUDE_MAP + +#include + +#include "players.h" +#include "objects.h" + +typedef struct t_tile { + int height; + + // filled in on load. + int topleft; + int topright; + int bottomleft; + int bottomright; + + // filled after each frame. + vec2f tl; + vec2f tr; + vec2f bl; + vec2f br; +} tile; + +tile map_loaded[10][10]; + +// data data that is stored on disk +vec2 spawner_tiles[2] = { + {9, 0}, + {1, 8}, +}; + +typedef struct t_map_info { + int tile_width; + int tile_height; + int px_raised_per_h; + int px_incline; +} map_info; + +// data data that is stored on disk +int map[10][10] = { + {0,0,0,0,0,0,0,0,0,1}, + {0,0,0,0,0,0,0,0,0,0}, + {0,0,0,1,1,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0}, + {0,0,0,1,1,2,1,0,0,0}, + {0,0,0,0,0,0,1,0,0,0}, + {0,0,0,0,0,0,0,0,0,0}, +}; + +void load_map_from_data(); +tile get_tile_under_coords(platform_window* window, float x, float y); +float get_height_of_tile_under_coords(platform_window* window, float tocheckx, float tochecky); +int get_tile_height(platform_window* window); +int get_tile_width(platform_window* window); +bool is_in_bounds(platform_window* window, float x, float y); +void draw_grid(platform_window* window); +map_info get_map_info(platform_window* window); + +#endif \ No newline at end of file -- cgit v1.2.3-70-g09d2