/ minilibx-linux / test / new_win.c
new_win.c
 1  
 2  
 3  
 4  #include "mlx.h"
 5  
 6  
 7  void *mlx;
 8  void *win1;
 9  void *win2;
10  
11  
12  
13  int gere_mouse(int x,int y,int button,void*toto)
14  {
15    printf("Mouse event - new win\n");
16    mlx_destroy_window(mlx,win1);
17    win1 = mlx_new_window(mlx,random()%500,random()%500,"new win");
18    mlx_mouse_hook(win1,gere_mouse,0);
19  }
20  
21  
22  int main()
23  {
24    srandom(time(0));
25    mlx = mlx_init();
26    win1 = mlx_new_window(mlx,300,300,"win1");
27    win2 = mlx_new_window(mlx,600,600,"win2");
28    mlx_mouse_hook(win1,gere_mouse,0);
29    mlx_mouse_hook(win2,gere_mouse,0);
30    mlx_loop(mlx);
31  }