diff options
| -rw-r--r-- | cub3d.h | 10 | ||||
| -rw-r--r-- | event.c | 5 | ||||
| -rw-r--r-- | main.c | 2 | ||||
| -rw-r--r-- | minimalist.cub | 4 | ||||
| -rw-r--r-- | parse/parse_color.c | 8 | ||||
| -rw-r--r-- | render.c | 7 |
6 files changed, 16 insertions, 20 deletions
@@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/15 06:40:37 by cacharle #+# #+# */ -/* Updated: 2020/01/30 12:04:26 by cacharle ### ########.fr */ +/* Updated: 2020/01/30 14:17:19 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdio.h> @@ -53,10 +53,10 @@ typedef union unsigned int hexcode; struct { - t_byte empty; - t_byte r; - t_byte g; t_byte b; + t_byte g; + t_byte r; + t_byte empty; } rgb; } t_color; @@ -100,8 +100,6 @@ typedef struct s_state t_bool running; void *mlx_ptr; void *window_ptr; - int window_width; - int window_height; t_vector pos; t_vector dir; t_vector plane; @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/15 06:39:37 by cacharle #+# #+# */ -/* Updated: 2020/01/17 13:59:48 by cacharle ### ########.fr */ +/* Updated: 2020/01/30 14:18:13 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -38,7 +38,8 @@ int event_keydown(int key, t_state *state) return (0); } -int event_quit(t_state *state) +int event_quit(t_state *state) { state->running = FALSE; + return (0); } @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/15 06:39:39 by cacharle #+# #+# */ -/* Updated: 2020/01/30 12:47:56 by cacharle ### ########.fr */ +/* Updated: 2020/01/30 14:02:58 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/minimalist.cub b/minimalist.cub index c0c9a7e..f2d39e7 100644 --- a/minimalist.cub +++ b/minimalist.cub @@ -5,8 +5,8 @@ WE ./textures/brick.xpm EA ./textures/brick.xpm S ./textures/brick.xpm -F 220,0,0 -C 0,225,0 +F 0,225,0 +C 200,200,0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 diff --git a/parse/parse_color.c b/parse/parse_color.c index f602706..fd482e5 100644 --- a/parse/parse_color.c +++ b/parse/parse_color.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/11 09:52:34 by cacharle #+# #+# */ -/* Updated: 2020/01/11 10:14:29 by cacharle ### ########.fr */ +/* Updated: 2020/01/30 14:17:37 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,8 +16,8 @@ t_bool parse_ceilling_color(t_state *state, char *line) { int tmp; - line++; - if ((tmp = ft_atoi(line)) > 255 || tmp < 0) + state->ceilling_color.hexcode = 0x0; + if ((tmp = ft_atoi(line)) > 255 || tmp < 0) // cant do atoi due to overflow stuff, use ft_strtol return (FALSE); state->ceilling_color.rgb.r = (t_byte)tmp; if ((line = ft_strchr(line, ',') + 1) == NULL) @@ -37,7 +37,7 @@ t_bool parse_floor_color(t_state *state, char *line) { int tmp; - line++; + state->floor_color.hexcode = 0x0; if ((tmp = ft_atoi(line)) > 255 || tmp < 0) return (FALSE); state->floor_color.rgb.r = (t_byte)tmp; @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/11 13:37:17 by cacharle #+# #+# */ -/* Updated: 2020/01/30 13:38:35 by cacharle ### ########.fr */ +/* Updated: 2020/01/30 14:16:36 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,6 @@ int render_update(void *param) exit(EXIT_SUCCESS); return (0); } - ft_bzero(state->window.data, state->window.width * state->window.height * 4); render_update_window(state); mlx_put_image_to_window(state->mlx_ptr, state->window_ptr, state->window.id, 0, 0); return (0); @@ -69,16 +68,14 @@ void render_window_column(t_state *state, t_render_state *rstate) { int i; t_color white; - t_color black; white.hexcode = 0x00ffffff; - black.hexcode = 0x00000000; i = 0; while (i < rstate->draw_start) ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] = state->ceilling_color; while (i < rstate->draw_end) ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] = white; - while (i < state->window_height) + while (i < state->window.height) ((t_color*)state->window.data)[i++ * state->window.width + rstate->x] = state->floor_color; /* while (++i < rstate->draw_start) */ |
