diff --git a/builds/keypress.o b/builds/keypress.o index a219cb5..295162a 100644 Binary files a/builds/keypress.o and b/builds/keypress.o differ diff --git a/builds/parse.o b/builds/parse.o index 4b84f23..9b428ae 100644 Binary files a/builds/parse.o and b/builds/parse.o differ diff --git a/fdf b/fdf index 76a2664..f644383 100755 Binary files a/fdf and b/fdf differ diff --git a/includes/fdf.h b/includes/fdf.h index 82bf42b..e37abee 100644 --- a/includes/fdf.h +++ b/includes/fdf.h @@ -51,6 +51,7 @@ void draw_color_pixel(t_fdf *fdf, int new_x, int new_y, int z); int keypress(int keycode, t_fdf *fdf); void keypress_more(int keycode, t_fdf *fdf); void position_state(t_fdf *fdf); +int is_color(char *color); int **parse_map(t_fdf *fdf, int fd); int *new_coordinates(t_fdf *fdf, int i, int j); void draw_lines(t_fdf *fdf, int *start, int *end); diff --git a/srcs/keypress.c b/srcs/keypress.c index e439b38..6f1af88 100644 --- a/srcs/keypress.c +++ b/srcs/keypress.c @@ -2,7 +2,9 @@ /* ** U -> up wiew -** I -> isometric view +** I -> isometric original view +** O -> increase altitude +** P -> decrease altitude ** F -> fit to window ** C -> center */ @@ -17,8 +19,18 @@ void keypress_more(int keycode, t_fdf *fdf) } else if (keycode == I) { - fdf->rot_x = -30; - fdf->rot_y = -60; + fdf->rot_x = -45; + fdf->rot_y = -35; + fdf->mov_x = (fdf->win_size_x - fdf->map_size_x) / 2; + fdf->mov_y = (fdf->win_size_y - fdf->map_size_y) / 2; + fdf->zoom = 0; + } + else if (keycode == O) + fdf->altitude++; + else if (keycode == P) + { + if (fdf->altitude > 1) + fdf->altitude--; } } diff --git a/srcs/parse.c b/srcs/parse.c index e613499..08f1586 100644 --- a/srcs/parse.c +++ b/srcs/parse.c @@ -21,8 +21,6 @@ int **split_to_map(t_fdf *fdf, char *raw) while (++i < fdf->map_height) { map[i] = ft_calloc(fdf->map_width, sizeof(*map)); - if (!map[i]) - shut_down(fdf); j = -1; while (++j < fdf->map_width) { @@ -31,6 +29,7 @@ int **split_to_map(t_fdf *fdf, char *raw) map[i][j] = ft_atoi(raw); while (ft_isdigit(*raw) || *raw == '-') raw++; + raw += is_color(raw); z_amplitude(fdf, map[i][j]); } }