diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-11-16 12:45:44 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-11-16 13:03:02 +0100 |
| commit | 975ec3edd112c1a7908c0d97dc49592a22076b71 (patch) | |
| tree | 4298e49593c225ae8ae5be4d4f07f3c7f8b69f07 /main.c | |
| parent | a4fd7a681376899526cfe38c0449f90feb0f582e (diff) | |
| download | cub3d-975ec3edd112c1a7908c0d97dc49592a22076b71.tar.gz cub3d-975ec3edd112c1a7908c0d97dc49592a22076b71.tar.bz2 cub3d-975ec3edd112c1a7908c0d97dc49592a22076b71.zip | |
Basic render of the map
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 42 |
1 files changed, 27 insertions, 15 deletions
@@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/15 06:39:39 by cacharle #+# #+# */ -/* Updated: 2019/11/15 09:26:16 by cacharle ### ########.fr */ +/* Updated: 2019/11/16 12:58:08 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,32 +20,44 @@ int main(int argc, char **argv) return (1); } t_parsing *p = parse(argv[1]); - printf("R %d %d\n", p->resolution_width, p->resolution_height); - printf("NO %s\n", p->north_texture_path); - printf("SO %s\n", p->south_texture_path); - printf("WE %s\n", p->west_texture_path); - printf("EA %s\n\n", p->east_texture_path); - printf("S %s\n", p->sprite_texture_path); - printf("F %d,%d,%d\n", p->floor_color.r, p->floor_color.g, p->floor_color.b); - printf("C %d,%d,%d\n\n", p->ceilling_color.r, p->ceilling_color.g, p->ceilling_color.b); + /* printf("R %d %d\n", p->resolution_width, p->resolution_height); */ + /* printf("NO %s\n", p->north_texture_path); */ + /* printf("SO %s\n", p->south_texture_path); */ + /* printf("WE %s\n", p->west_texture_path); */ + /* printf("EA %s\n\n", p->east_texture_path); */ + /* printf("S %s\n", p->sprite_texture_path); */ + /* printf("F %d,%d,%d\n", p->floor_color.r, p->floor_color.g, p->floor_color.b); */ + /* printf("C %d,%d,%d\n\n", p->ceilling_color.r, p->ceilling_color.g, p->ceilling_color.b); */ /* printf("%dx%d\n", p->map_height, p->map_width); */ for (int i = 0; i < p->map_height; i++) { for (int j = 0; j < p->map_width; j++) { - printf("%d", p->map[i][j]); + if (p->map[i][j] == CELL_WALL) + printf("#"); + else if (p->map[i][j] == CELL_EMPTY) + printf(" "); + else + printf("%d", p->map[i][j]); if (j != p->map_width - 1) printf(" "); } printf("\n"); } - /* void *mlx_ptr = mlx_init(); */ - /* void *mlx_window = mlx_new_window(mlx_ptr, 640, 480, "bonjour"); */ - /* mlx_key_hook(mlx_window, handle_key, NULL); */ - /* mlx_loop(mlx_ptr); */ - /* mlx_destroy_window(mlx_ptr, mlx_window); */ + void *mlx_ptr = mlx_init(); + void *window_ptr = mlx_new_window(mlx_ptr, p->resolution_width, p->resolution_height, WINDOW_TITLE); + + t_state *state = create_state(mlx_ptr, window_ptr, p); + + /* for (int i = 0; i < 20; i++) */ + /* draw_column(state, i); */ + + mlx_key_hook(window_ptr, handle_key, (void*)state); + mlx_loop_hook(mlx_ptr, graphics_update, (void*)state); + /* */ + mlx_loop(mlx_ptr); return (0); } |
