-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.c
59 lines (52 loc) · 1.69 KB
/
menu.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* menu.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yaskour <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/05 14:49:26 by yaskour #+# #+# */
/* Updated: 2022/01/15 18:34:18 by yaskour ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
int ato_h(char *hex)
{
int length;
int base;
int decimal;
length = ft_strlen(hex) - 1;
base = 1;
decimal = 0;
while (length >= 0)
{
if (hex[length] >= '0' && hex[length] <= '9')
decimal += (hex[length] - 48) * base;
if (hex[length] >= 'A' && hex[length] <= 'F')
decimal += (hex[length] - 55) * base;
if (hex[length] >= 'a' && hex[length] <= 'f')
decimal += (hex[length] - 87) * base;
base *= 16;
length--;
}
return (decimal);
}
void invalid_file(void)
{
ft_putstr_fd("invalid file\n", 1);
exit(1);
}
float max(float a, float b)
{
if (a > b)
return (a);
return (b);
}
void menu(t_data *data)
{
int width;
int height;
data->xpm_img = mlx_xpm_file_to_image(data->mlx,
"image/pic.xpm", &width, &height);
mlx_put_image_to_window(data->mlx, data->win, data->xpm_img, 0, 0);
}