aboutsummaryrefslogtreecommitdiffstats
path: root/minilibx-linux/mlx_mouse.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-24 19:34:31 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-24 19:34:31 +0200
commit172fc25127f57b6b405de41c02987ad8c3a40c95 (patch)
tree7a7153804f7f0e87f3bea96159563a8fab3af15a /minilibx-linux/mlx_mouse.c
parentFine (diff)
download42-cub3d-172fc25127f57b6b405de41c02987ad8c3a40c95.tar.gz
42-cub3d-172fc25127f57b6b405de41c02987ad8c3a40c95.tar.bz2
42-cub3d-172fc25127f57b6b405de41c02987ad8c3a40c95.tar.xz
42-cub3d-172fc25127f57b6b405de41c02987ad8c3a40c95.tar.zst
42-cub3d-172fc25127f57b6b405de41c02987ad8c3a40c95.zip
Libx update, click close should work
Diffstat (limited to 'minilibx-linux/mlx_mouse.c')
-rw-r--r--minilibx-linux/mlx_mouse.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/minilibx-linux/mlx_mouse.c b/minilibx-linux/mlx_mouse.c
new file mode 100644
index 0000000..0ada4e4
--- /dev/null
+++ b/minilibx-linux/mlx_mouse.c
@@ -0,0 +1,26 @@
+#include "mlx_int.h"
+
+int mlx_mouse_move(t_xvar *xvar, t_win_list *win, int x, int y)
+{
+ XWarpPointer(xvar->display, None, win->window, 0, 0, 0, 0, x, y);
+ return (0);
+}
+
+int mlx_mouse_hide(t_xvar *xvar, t_win_list *win)
+{
+ static char data[1] = {0};
+ Cursor cursor;
+ Pixmap blank;
+ XColor dummy;
+
+ blank = XCreateBitmapFromData(xvar->display, win->window, data, 1, 1);
+ cursor = XCreatePixmapCursor(xvar->display, blank, blank, &dummy, &dummy, 0, 0);
+ XDefineCursor(xvar->display, win->window, cursor);
+ XFreePixmap(xvar->display, blank);
+ XFreeCursor(xvar->display, cursor);
+}
+
+int mlx_mouse_show(t_xvar *xvar, t_win_list *win)
+{
+ XUndefineCursor(xvar->display, win->window);
+}