summaryrefslogtreecommitdiff
path: root/mlx/mlx_mouse.m
diff options
context:
space:
mode:
authorDominik Kaiser2024-05-10 12:26:25 +0200
committerGitHub2024-05-10 12:26:25 +0200
commit10b5c3a64680c4dc741cb41c5950abccbf310c7e (patch)
tree4a65d2387c6964ee9357d1ad17e7f9f5094ee99e /mlx/mlx_mouse.m
parente206d293aa947dc56fa8408c42dccaff9cb423c3 (diff)
parent461f71e2660e6286ffc757ca6b7077c70c80b6cf (diff)
downloadso_long-10b5c3a64680c4dc741cb41c5950abccbf310c7e.tar.gz
so_long-10b5c3a64680c4dc741cb41c5950abccbf310c7e.zip
Merge migrate-to-mlx42 into master
Migrate from the old mlx to MLX42
Diffstat (limited to 'mlx/mlx_mouse.m')
-rw-r--r--mlx/mlx_mouse.m52
1 files changed, 0 insertions, 52 deletions
diff --git a/mlx/mlx_mouse.m b/mlx/mlx_mouse.m
deleted file mode 100644
index 94ce0a9..0000000
--- a/mlx/mlx_mouse.m
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <stdio.h>
-
-#import <Cocoa/Cocoa.h>
-#import <OpenGL/gl3.h>
-
-#include "mlx_int.h"
-#include "mlx_new_window.h"
-
-int mlx_mouse_hide()
-{
- // CGDisplayHideCursor(kCGDirectMainDisplay);
- [NSCursor hide];
- return (0);
-}
-
-int mlx_mouse_show()
-{
- // CGDisplayShowCursor(kCGDirectMainDisplay);
- [NSCursor unhide];
- return (0);
-}
-
-int mlx_mouse_move(mlx_win_list_t *win, int x, int y)
-{
- CGPoint point;
- NSRect pos;
- id thewin;
-
- thewin = [(id)(win->winid) win];
- pos = [thewin frame];
- // printf("got win pos %f %f\n", pos.origin.x, pos.origin.y);
- point.x = pos.origin.x + x;
- point.y = NSHeight([[thewin screen] frame]) - NSHeight([(id)(win->winid) frame]) - pos.origin.y + 1 + y;
- CGWarpMouseCursorPosition(point);
- CGAssociateMouseAndMouseCursorPosition(true);
- return (0);
-}
-
-
-int mlx_mouse_get_pos(mlx_win_list_t *win, int *x, int *y)
-{
- CGPoint point;
- id thewin;
- NSRect pos;
-
- thewin = [(id)(win->winid) win];
- pos = [(id)(win->winid) frame];
- point = [thewin mouseLocationOutsideOfEventStream];
- *x = point.x;
- *y = NSHeight(pos) - 1 - point.y;
- return (0);
-}