diff options
| author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-03-05 16:09:00 +0100 | 
|---|---|---|
| committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-03-05 16:09:00 +0100 | 
| commit | 3c330fb4947973c103a7da7df59e2ee334206446 (patch) | |
| tree | 04b839ff7188cedebe8788d916042db74cf99cd8 | |
| parent | Get normed (diff) | |
| download | 42-cub3d-3c330fb4947973c103a7da7df59e2ee334206446.tar.gz 42-cub3d-3c330fb4947973c103a7da7df59e2ee334206446.tar.bz2 42-cub3d-3c330fb4947973c103a7da7df59e2ee334206446.tar.xz 42-cub3d-3c330fb4947973c103a7da7df59e2ee334206446.tar.zst 42-cub3d-3c330fb4947973c103a7da7df59e2ee334206446.zip | |
Tryna be dark
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | inc/cub3d.h | 1 | ||||
| -rw-r--r-- | src/ft_darken_rgb.c | 23 | ||||
| -rw-r--r-- | src/ft_draw_verline.c | 35 | 
4 files changed, 27 insertions, 33 deletions
| @@ -56,6 +56,7 @@ SRCS_NAME	+= ft_extra_keys.c  SRCS_NAME	+= ft_draw_verline.c  SRCS_NAME	+= ft_rgb_to_hex.c  SRCS_NAME	+= ft_hex_to_rgb.c +SRCS_NAME	+= ft_darken_rgb.c  SRCS_NAME	+= ft_raycasting.c  SRCS_NAME	+= ft_init_s_ray.c  SRCS_NAME	+= ft_init_map.c diff --git a/inc/cub3d.h b/inc/cub3d.h index c2e117e..87444aa 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -128,6 +128,7 @@ uint8_t			ft_free_words(char **words);  int8_t			ft_warp_level(t_cub *cl);  int				ft_exit(uint8_t exit_code, t_cub *clist);  uint32_t		ft_rgb_to_hex(t_rgb rgb); +uint32_t		ft_darken_rgb(t_rgb rgb);  t_bmp_rgb		ft_hex_to_rgb(uint32_t color);  #	endif diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c new file mode 100644 index 0000000..3e61f49 --- /dev/null +++ b/src/ft_darken_rgb.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/*                                                                            */ +/*                                                        :::      ::::::::   */ +/*   ft_darken_rgb.c                                    :+:      :+:    :+:   */ +/*                                                    +:+ +:+         +:+     */ +/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */ +/*                                                +#+#+#+#+#+   +#+           */ +/*   Created: 2020/03/05 16:04:28 by rbousset          #+#    #+#             */ +/*   Updated: 2020/03/05 16:04:29 by rbousset         ###   ########lyon.fr   */ +/*                                                                            */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <stdint.h> + +uint32_t +	ft_darken_rgb(t_rgb rgb) +{ +	t_rgb	darker; + +	darker = rgb; +	return (ft_rgb_to_hex(darker)); +} diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index d9a35cc..89eedea 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -11,6 +11,7 @@  /* ************************************************************************** */  #include <cub3d.h> +#include <stdint.h>  static void  	ft_draw_floor(t_cub *cl, int32_t y, int32_t x) @@ -18,7 +19,7 @@ static void  	while ((uint32_t)y < cl->wlist.y_size)  	{  		*(int*)(cl->img.ptr + -				(x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(cl->f_rgb); +				(x * 4 + (y * cl->img.sizeline))) = ft_darken_rgb(cl->f_rgb);  		y++;  	}  } @@ -37,38 +38,6 @@ static void  	}  } -/* -** #include <libft.h> -** static void -** 	ft_draw_ceil_tex(t_cub *cl, int x, int y) -** { -** 	int16_t	i; -** 	int32_t	d; -** 	int32_t	tex_y; -** -** 	i = 0; -** 	while (i < y) -** 	{ -** 		d = i * 256 - cl->wlist.y_size * 128 + cl->rlist.line_h * 128; -** 		d = (d <= 0) ? (-d) : (d); -** 		ft_printf("%d\n", d); -** 		tex_y = ((d * cl->tlist[1].img_h) / cl->rlist.line_h) / 256; -** 		(tex_y <= 0) ? (tex_y = 1) : 0; -** 		cl->img.ptr[x * 4 + (cl->img.sizeline * i)] = -** 			(int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * -** 						cl->tlist[1].img_h * tex_y]; -** 		cl->img.ptr[x * 4 + (cl->img.sizeline * i) + 1] = -** 			(int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * -** 						cl->tlist[1].img_h * tex_y + 1]; -** 		cl->img.ptr[x * 4 + (cl->img.sizeline * i) + 2] = -** 			(int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * -** 						cl->tlist[1].img_h * tex_y + 2]; -** 		cl->img.ptr[x * 4 + cl->wlist.x_size * i + 3] = (char)0; -** 		i++; -** 	} -** } -*/ -  int8_t  	ft_draw_verline(t_cub *cl, int32_t x, int32_t y, int32_t y2)  { | 
