-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
57 lines (51 loc) · 1.7 KB
/
main.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: myoung <myoung@student.42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/02 10:11:53 by myoung #+# #+# */
/* Updated: 2017/03/29 15:41:44 by myoung ### ########.fr */
/* */
/* ************************************************************************** */
#include <wolf.h>
int expose_hook(t_view *v)
{
(void)v;
return (0);
}
int exit_hook(t_view *v)
{
int i;
if (v->z_buff)
free(v->z_buff);
if (v->texture)
{
i = -1;
while (++i < TEX_COUNT)
free(v->texture[i]);
free(v->texture);
}
if (v->map.cell)
free_map(&(v->map));
exit(0);
}
void set_hooks(t_view *v)
{
mlx_do_key_autorepeatoff(v->mlx);
mlx_hook(v->window, 2, 0, key_press_hook, v);
mlx_hook(v->window, 3, 0, key_release_hook, v);
mlx_hook(v->window, 4, 0, mouse_press_hook, v);
mlx_hook(v->window, 5, 0, mouse_release_hook, v);
mlx_hook(v->window, 6, 0, motion_hook, v);
mlx_hook(v->window, 12, 0, expose_hook, v);
mlx_hook(v->window, 17, 0, exit_hook, v);
}
int main(int argc, char **argv)
{
if (argc != 1 && argv)
exit(1);
init_view(WINDOW_WIDTH, WINDOW_HEIGHT, "Raycasting Demo - Wolf3d");
return (0);
}