-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.c
56 lines (49 loc) · 1.77 KB
/
window.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* window.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cyildiri <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/30 18:08:25 by cyildiri #+# #+# */
/* Updated: 2017/03/30 18:08:28 by cyildiri ### ########.fr */
/* */
/* ************************************************************************** */
#include "wolf3d.h"
void add_rcwindow(t_rc_renderer *rend, int height, int width, char *title)
{
t_lmap *to_add;
void *new_window;
new_window = mlx_new_window(rend->mlx, width, height, title);
to_add = ft_lmapnew(title, sizeof(title), &new_window, sizeof(new_window));
ft_lmapadd(&rend->windows, to_add);
if (!(rend->win_x))
{
rend->win_x = width;
rend->win_y = height;
}
}
void *get_rcwindow(t_rc_renderer *rend, char *window_name)
{
t_lmap *element;
void *window;
element = ft_lmapget(rend->windows, window_name);
window = *((void **)element->content);
return (window);
}
void windows_delete(t_rc_renderer *rend, t_lmap **windows)
{
t_lmap *cur;
t_lmap *last;
cur = *windows;
while (cur)
{
ft_strdel((char **)&cur->key);
mlx_destroy_window(rend->mlx, *((void **)cur->content));
ft_memdel(&cur->content);
last = cur;
cur = cur->next;
ft_memdel((void **)&last);
}
*windows = NULL;
}