Repository navigation
Expand file tree
/
Copy pathfdf.c
More file actions
executable file
·46 lines (42 loc) · 1.61 KB
/
Copy pathfdf.c
File metadata and controls
executable file
·46 lines (42 loc) · 1.61 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: houlekhi <houlekhi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/07 09:29:19 by houlekhi #+# #+# */
/* Updated: 2015/05/19 15:56:11 by houlekhi ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
int put_img_to_win(t_env *e)
{
mlx_put_image_to_window(e->mlx, e->window, e->img, 0, 0);
return (0);
}
int main(int argc, char **argv)
{
t_env e;
ft_init(&e);
e.mlx = mlx_init();
if (argc != 2)
error(1);
if (!e.mlx)
error(2);
if (ft_strstr(argv[1], ".fdf") == 0)
error(3);
e.window = mlx_new_window(e.mlx, WIDTH, HEIGHT, "FdF");
e.img = mlx_new_image(e.mlx, WIDTH, HEIGHT);
e.data = mlx_get_data_addr(e.img, &e.bpp, &e.size_line, &e.endian);
e.tab = get_first_level(argv[1], &e);
if (!e.tab)
error(4);
draw(&e);
mlx_hook(e.window, 2, 3, key_hook, &e);
mlx_mouse_hook(e.window, mouse_hook, &e);
put_img_to_win(&e);
mlx_expose_hook(e.window, put_img_to_win, &e);
mlx_loop(e.mlx);
return (0);
}