infos affichees ajout zoom et deplacement
This commit is contained in:
@@ -32,17 +32,17 @@ int keypress(int keycode, t_fdf *fdf)
|
||||
/*
|
||||
** int[0] = x, int[1] = y, int[2] = z
|
||||
** quick explanation :
|
||||
** zoom :
|
||||
** zoom :
|
||||
** x = i * (fdf->offset + fdf->zoom);
|
||||
** center before 3d rotation :
|
||||
** center before 3d rotation :
|
||||
** x -= (fdf->map_size_x + fdf->zoom * fdf->map_width) / 2;
|
||||
** z changes according to zoom :
|
||||
** z changes according to zoom :
|
||||
** z += (z * fdf->zoom) / fdf->offset;
|
||||
** deplacement :
|
||||
** deplacement :
|
||||
** point[0] += fdf->margin + fdf->mov_x;
|
||||
** center zoom after :
|
||||
** center zoom :
|
||||
** point[0] -= ((fdf->map_size_x / 2) / fdf->offset) * fdf->zoom;
|
||||
** center after 3d rotation :
|
||||
** center after 3d rotation :
|
||||
** point[0] += (fdf->map_size_x + fdf->zoom * fdf->map_width) / 2;
|
||||
*/
|
||||
int *new_coordinates(t_fdf *fdf, int i, int j)
|
||||
@@ -79,17 +79,25 @@ int print_keycode(int keycode)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void rotation_state(t_fdf *fdf)
|
||||
void position_state(t_fdf *fdf)
|
||||
{
|
||||
char *position;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
x = fdf->img_size_x - 10;
|
||||
y = fdf->img_size_y - 10;
|
||||
position = ft_strjoinfree(ft_itoa(fdf->rot_x), ft_strdup(" | "));
|
||||
position = ft_strjoinfree(ft_strdup("zoom: "), ft_itoa(fdf->zoom));
|
||||
position = ft_strjoinfree(position, ft_strdup(" "));
|
||||
position = ft_strjoinfree(position, ft_strdup("deplacement: "));
|
||||
position = ft_strjoinfree(position, ft_itoa(fdf->mov_x));
|
||||
position = ft_strjoinfree(position, ft_strdup(" "));
|
||||
position = ft_strjoinfree(position, ft_itoa(fdf->mov_y));
|
||||
position = ft_strjoinfree(position, ft_strdup(" "));
|
||||
position = ft_strjoinfree(position, ft_strdup("rotation: "));
|
||||
position = ft_strjoinfree(position, ft_itoa(fdf->rot_x));
|
||||
position = ft_strjoinfree(position, ft_strdup(" "));
|
||||
position = ft_strjoinfree(position, ft_itoa(fdf->rot_y));
|
||||
x -= ft_strlen(position) * 6;
|
||||
x = fdf->img_size_x - 10 - ft_strlen(position) * 6;
|
||||
y = fdf->img_size_y - 10;
|
||||
mlx_string_put(fdf->mlx_ptr, fdf->win_ptr, x, y, 0xffffff, position);
|
||||
free(position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user