aboutsummaryrefslogtreecommitdiffstats
path: root/minilibx-linux/mlx_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-14 18:14:57 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-14 18:14:57 +0200
commit7f22d45d5f5aae7efbe9c58317fc8e0713aee7b5 (patch)
tree2ee39c37e77d6a82658f92aaa90f662b122d95af /minilibx-linux/mlx_loop.c
parenttest (diff)
download42-cub3d-7f22d45d5f5aae7efbe9c58317fc8e0713aee7b5.tar.gz
42-cub3d-7f22d45d5f5aae7efbe9c58317fc8e0713aee7b5.tar.bz2
42-cub3d-7f22d45d5f5aae7efbe9c58317fc8e0713aee7b5.tar.xz
42-cub3d-7f22d45d5f5aae7efbe9c58317fc8e0713aee7b5.tar.zst
42-cub3d-7f22d45d5f5aae7efbe9c58317fc8e0713aee7b5.zip
New lib
Diffstat (limited to 'minilibx-linux/mlx_loop.c')
-rw-r--r--minilibx-linux/mlx_loop.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/minilibx-linux/mlx_loop.c b/minilibx-linux/mlx_loop.c
new file mode 100644
index 0000000..74af0a5
--- /dev/null
+++ b/minilibx-linux/mlx_loop.c
@@ -0,0 +1,38 @@
+/*
+** mlx_loop.c for MiniLibX in
+**
+** Made by Charlie Root
+** Login <ol@epitech.net>
+**
+** Started on Wed Aug 2 18:58:11 2000 Charlie Root
+** Last update Fri Sep 30 14:47:41 2005 Olivier Crouzet
+*/
+
+
+#include "mlx_int.h"
+
+extern int (*(mlx_int_param_event[]))();
+
+
+int mlx_loop(t_xvar *xvar)
+{
+ XEvent ev;
+ t_win_list *win;
+
+ mlx_int_set_win_event_mask(xvar);
+ xvar->do_flush = 0;
+ while (42)
+ {
+ while (!xvar->loop_hook || XPending(xvar->display))
+ {
+ XNextEvent(xvar->display,&ev);
+ win = xvar->win_list;
+ while (win && (win->window!=ev.xany.window))
+ win = win->next;
+ if (win && ev.type < MLX_MAX_EVENT)
+ if (win->hooks[ev.type].hook)
+ mlx_int_param_event[ev.type](xvar, &ev, win);
+ }
+ xvar->loop_hook(xvar->loop_param);
+ }
+}