aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--src/ft_draw_scene.c6
-rw-r--r--src/ft_draw_verline.c10
-rw-r--r--src/ft_hooks_and_loops.c2
-rw-r--r--src/ft_key_events.c2
5 files changed, 13 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 1325b75..4870dfd 100644
--- a/Makefile
+++ b/Makefile
@@ -79,11 +79,12 @@ ifdef ASAN
CFLAGS += ${FSANITIZE}
endif
CDEFS = -DFT_SCR_SIZE=\"${SCR_SZE}\"
-ifeq (${OS}, Linux)
+ifneq (${OS}, Darwin)
CDEFS += -DFT_W_KEY=119
CDEFS += -DFT_A_KEY=97
CDEFS += -DFT_S_KEY=115
CDEFS += -DFT_D_KEY=100
+ CDEFS += -DFT_F1_KEY=65470
CDEFS += -DFT_ESC_KEY=65307
endif
#------------------------------------------------------------------------------#
@@ -103,7 +104,7 @@ ${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}
ifeq (${OS}, Darwin)
${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} -o $@ $<
else
- ${CC} -c ${CFLAGS} -I${LFT_DIR}${INCS_DIR} -I${INCS_DIR} \
+ ${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${INCS_DIR} \
\
-o $@ $<
endif
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c
index 4a5b56e..6043a55 100644
--- a/src/ft_draw_scene.c
+++ b/src/ft_draw_scene.c
@@ -21,13 +21,13 @@ void
{
mlx_clear_window(clist->wlist->wlx, clist->wlist->winptr);
clist->img.img = mlx_new_image(clist->wlist->wlx,
- clist->wlist->x_size, clist->wlist->y_size);
+ clist->wlist->x_size, clist->wlist->y_size);
clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp,
- &clist->img.sizeline, &clist->img.endian);
+ &clist->img.sizeline, &clist->img.endian);
ft_castray(clist);
if (clist->minimap)
ft_draw_map(clist->mlist->map, clist);
mlx_put_image_to_window(clist->wlist->wlx,
- clist->wlist->winptr, clist->img.img, 0, 0);
+ clist->wlist->winptr, clist->img.img, 0, 0);
mlx_destroy_image(clist->wlist->wlx, clist->img.img);
}
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c
index 17d754a..f7e5a1c 100644
--- a/src/ft_draw_verline.c
+++ b/src/ft_draw_verline.c
@@ -1,13 +1,13 @@
#include <cub3d.h>
static void
-ft_draw_floor(t_cub *cl, int32_t y, int32_t x, int16_t i)
+ft_draw_floor(t_cub *cl, int32_t y, int32_t x)
{
- while (i <= y)
+ while (y <= cl->wlist->y_size)
{
*(int*)(cl->img.ptr +
- (x * 4 + (i * cl->img.sizeline))) = ft_rgb_to_hex(cl->f_rgb);
- i++;
+ (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(cl->f_rgb);
+ y++;
}
}
@@ -50,6 +50,6 @@ ft_draw_verline(t_cub *cl, int32_t x, int32_t y1, int32_t y2, int32_t color)
*(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = color;
y++;
}
- ft_draw_floor(cl, x, cl->wlist->y_size, y);
+ ft_draw_floor(cl, y, x);
return (0);
}
diff --git a/src/ft_hooks_and_loops.c b/src/ft_hooks_and_loops.c
index 068b3a7..fdddc10 100644
--- a/src/ft_hooks_and_loops.c
+++ b/src/ft_hooks_and_loops.c
@@ -18,7 +18,7 @@
void
ft_hooks_and_loops(t_win *wl, t_cub *cl)
{
- mlx_hook(wl->winptr, 2, 1L << 1, ft_key_event, cl);
+ mlx_hook(wl->winptr, 2, 1L << 0, ft_key_event, cl);
mlx_hook(wl->winptr, 17, 0L, ft_click_close, cl);
mlx_loop(wl->wlx);
}
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index a08a534..07c192b 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -62,7 +62,7 @@ int
t_player *pl;
t_map *ml;
int8_t (*fun_ptr[4])(t_cub*);
- const int16_t tmp_code = keycode;
+ const uint16_t tmp_code = keycode;
fun_ptr[0] = ft_w_key;
fun_ptr[1] = ft_a_key;