aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_drawmap.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-02-04 23:45:21 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-02-04 23:45:21 +0100
commit20a7a10c762d2d81d3f749d08d4da3f56a045dce (patch)
tree0e04d3d6b0828b4b65e1bb4d49b464678492b03d /src/ft_drawmap.c
parentPretty good (diff)
download42-cub3d-20a7a10c762d2d81d3f749d08d4da3f56a045dce.tar.gz
42-cub3d-20a7a10c762d2d81d3f749d08d4da3f56a045dce.tar.bz2
42-cub3d-20a7a10c762d2d81d3f749d08d4da3f56a045dce.tar.xz
42-cub3d-20a7a10c762d2d81d3f749d08d4da3f56a045dce.tar.zst
42-cub3d-20a7a10c762d2d81d3f749d08d4da3f56a045dce.zip
Scale
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