diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-15 16:19:44 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-15 16:19:44 +0200 |
commit | 46687fa2cef63e99a0ded077d88c3b19b20cc1ca (patch) | |
tree | 020590d4319b4bd0217cdf97750f3a8338d3069e /minilibx-bsd/mlx_loop.c | |
parent | Added line to gitignore (diff) | |
download | 42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.gz 42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.bz2 42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.xz 42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.zst 42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.zip |
Now BSD compliant
Diffstat (limited to '')
-rw-r--r-- | minilibx-bsd/mlx_loop.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/minilibx-bsd/mlx_loop.c b/minilibx-bsd/mlx_loop.c new file mode 100644 index 0000000..74af0a5 --- /dev/null +++ b/minilibx-bsd/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); + } +} |