summaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'map.c')
-rw-r--r--map.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/map.c b/map.c
index cf54b7f..b967bfa 100644
--- a/map.c
+++ b/map.c
@@ -155,7 +155,8 @@ inline int get_tile_height(platform_window* window) {
bool is_in_bounds(platform_window* window, float x, float y) {
int tile_width = get_tile_width(window);
int tile_height = get_tile_height(window);
- int xdiff_between_bottom_and_top = tile_width/3;
+ map_info info = get_map_info(window);
+ int xdiff_between_bottom_and_top = info.px_incline;
return (x >= 0 && x <= MAP_SIZE_X && y >= 0 && y < MAP_SIZE_Y);
}
@@ -163,10 +164,11 @@ void draw_grid(platform_window* window) {
map_info info = get_map_info(window);
for (int y = 0; y < MAP_SIZE_Y; y++) {
+ MAP_RENDER_DEPTH;
for (int x = MAP_SIZE_X-1; x >= 0; x--) {
tile tile = map_loaded[y][x];
- int xdiff_between_bottom_and_top = info.tile_width/3;
+ int xdiff_between_bottom_and_top = info.px_incline;
int render_x = (info.tile_width * x) + (xdiff_between_bottom_and_top * y);
int render_y = info.tile_height * y;
render_y -= tile.height*info.px_raised_per_h;
@@ -231,6 +233,15 @@ void draw_grid(platform_window* window) {
}
inline map_info get_map_info(platform_window* window) {
+ /*
+ static float offset = 0.0f;
+ static bool dir = true;
+ if (dir) offset += 0.00001f;
+ else offset -= 0.00001f;
+ if (offset >= 0.5f) dir = false;
+ if (offset <= -0.5f) dir = true;
+ */
+
map_info info;
info.tile_width = get_tile_width(window);
info.tile_height = get_tile_height(window);