diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-08 15:41:08 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-08 15:41:08 +0100 |
| commit | f84639d4b1eda622bf7667a7223a4a335c093437 (patch) | |
| tree | fa78998a68bfaac01b1be34ab1b354b86516d6fd /map.c | |
| parent | f8b97f2450bb789ae54a1d8d3845110342ff6134 (diff) | |
work
Diffstat (limited to 'map.c')
| -rw-r--r-- | map.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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); |
