aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_drawmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_drawmap.c')
-rw-r--r--src/ft_drawmap.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ft_drawmap.c b/src/ft_drawmap.c
index 698d852..02151a2 100644
--- a/src/ft_drawmap.c
+++ b/src/ft_drawmap.c
@@ -14,12 +14,14 @@
#include <libft.h>
#include <cub3d.h>
#include <mlx.h>
+#include <stdint.h>
static void
ft_draw_core_map(char **map, t_cub *clist)
{
- size_t x;
- size_t y;
+ const uint16_t scale = clist->scale;
+ size_t x;
+ size_t y;
x = 0;
y = 0;
@@ -28,13 +30,13 @@ static void
while (map[y][x])
{
if (map[y][x] == '1')
- ft_drawsquare(40 + (x * 41), 40 + (y * 41),
+ ft_drawsquare(scale + (x * (scale + 1)), scale + (y * (scale + 1)),
0x00aa99aa, clist);
else if (map[y][x] == '2')
- ft_drawsquare(40 + (x * 41), 40 + (y * 41),
+ ft_drawsquare(scale + (x * (scale + 1)), scale + (y * (scale + 1)),
0x0033ccff, clist);
else
- ft_drawsquare(40 + (x * 41), 40 + (y * 41),
+ ft_drawsquare(scale + (x * (scale + 1)), scale + (y * (scale + 1)),
ft_rgb_to_hex(clist->f_rgb), clist);
x++;
}
@@ -46,10 +48,13 @@ static void
static void
ft_draw_player(t_player *plist, t_cub *clist)
{
- const float x = plist->pos_x;
- const float y = plist->pos_y;
+ const float x = plist->pos_x;
+ const float y = plist->pos_y;
+ const uint16_t scale = clist->scale;
- ft_drawsquare(40 + (x * 41), 40 + (y * 41), 0x009843fa, clist);
+ ft_drawsquare(scale + (x * (scale + 1)),
+ scale + (y * (scale + 1)),
+ 0x009843fa, clist);
}
void