verif norm ok

This commit is contained in:
hugogogo
2021-07-27 14:17:42 +02:00
parent 463ce19ce3
commit 6c5f1ea217
9 changed files with 12 additions and 13 deletions

BIN
builds/draw.o Normal file

Binary file not shown.

BIN
builds/fdf.o Normal file

Binary file not shown.

BIN
builds/keypress.o Normal file

Binary file not shown.

BIN
builds/modifs.o Normal file

Binary file not shown.

BIN
builds/parse.o Normal file

Binary file not shown.

BIN
fdf Executable file

Binary file not shown.

View File

@@ -32,7 +32,7 @@ typedef struct s_fdf
double rad_y; double rad_y;
int mov_x; int mov_x;
int mov_y; int mov_y;
int zoom; double zoom;
int img_bpp; int img_bpp;
int img_sizel; int img_sizel;
int img_endian; int img_endian;

View File

@@ -43,14 +43,15 @@ void init_offset(t_fdf *fdf)
{ {
int diagonal; int diagonal;
int x; int x;
int y;
x = (fdf->map_width) * (fdf->map_width); x = (fdf->map_width) * (fdf->map_width);
x += (fdf->map_height) * (fdf->map_height); y = (fdf->map_height) * (fdf->map_height);
fdf->offset = 1; fdf->offset = 1;
diagonal = 1; diagonal = 1;
while (diagonal < fdf->win_size_x) while (diagonal < fdf->win_size_x)
{ {
diagonal = x * (fdf->offset * fdf->offset); diagonal = (x + y) * (fdf->offset * fdf->offset);
diagonal = ft_sqrt(diagonal); diagonal = ft_sqrt(diagonal);
fdf->offset++; fdf->offset++;
} }

View File

@@ -10,9 +10,11 @@
*/ */
void keypress_more(int keycode, t_fdf *fdf) void keypress_more(int keycode, t_fdf *fdf)
{ {
if (keycode == ESCAPE) if (keycode == A)
shut_down(fdf); fdf->zoom += 1;
if (keycode == U) else if (keycode == W)
fdf->zoom -= 1;
else if (keycode == U)
{ {
fdf->rot_x = 0; fdf->rot_x = 0;
fdf->rot_y = 0; fdf->rot_y = 0;
@@ -28,10 +30,8 @@ void keypress_more(int keycode, t_fdf *fdf)
else if (keycode == O) else if (keycode == O)
fdf->altitude++; fdf->altitude++;
else if (keycode == P) else if (keycode == P)
{
if (fdf->altitude > 1) if (fdf->altitude > 1)
fdf->altitude--; fdf->altitude--;
}
} }
/* /*
@@ -44,7 +44,9 @@ void keypress_more(int keycode, t_fdf *fdf)
*/ */
int keypress(int keycode, t_fdf *fdf) int keypress(int keycode, t_fdf *fdf)
{ {
if (keycode == LEFT) if (keycode == ESCAPE)
shut_down(fdf);
else if (keycode == LEFT)
fdf->rot_x += 1; fdf->rot_x += 1;
else if (keycode == RIGHT) else if (keycode == RIGHT)
fdf->rot_x -= 1; fdf->rot_x -= 1;
@@ -60,10 +62,6 @@ int keypress(int keycode, t_fdf *fdf)
fdf->mov_y -= 6; fdf->mov_y -= 6;
else if (keycode == S) else if (keycode == S)
fdf->mov_y += 6; fdf->mov_y += 6;
else if (keycode == A)
fdf->zoom += 6;
else if (keycode == W)
fdf->zoom -= 6;
else else
keypress_more(keycode, fdf); keypress_more(keycode, fdf);
draw_image(fdf); draw_image(fdf);