diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-13 23:12:32 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-13 23:12:32 +0100 |
commit | 97c08dd3043ee55724bba86c46804fd78a319df6 (patch) | |
tree | 3e033363a59ba28cdcc3e449e2e2f455ba1a9605 | |
parent | In progress (diff) | |
download | 42-cub3d-97c08dd3043ee55724bba86c46804fd78a319df6.tar.gz 42-cub3d-97c08dd3043ee55724bba86c46804fd78a319df6.tar.bz2 42-cub3d-97c08dd3043ee55724bba86c46804fd78a319df6.tar.xz 42-cub3d-97c08dd3043ee55724bba86c46804fd78a319df6.tar.zst 42-cub3d-97c08dd3043ee55724bba86c46804fd78a319df6.zip |
Colors
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | src/ft_draw_scene.c | 6 | ||||
-rw-r--r-- | src/ft_draw_verline.c | 10 | ||||
-rw-r--r-- | src/ft_hooks_and_loops.c | 2 | ||||
-rw-r--r-- | src/ft_key_events.c | 2 |
5 files changed, 13 insertions, 12 deletions
@@ -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; |