mouse_hide¶
MiniLibX: mlx_mouse_hide
Hides the mouse pointer while it's over the window.
Parameters¶
| Name | Type | Description |
|---|---|---|
mlx |
Mlx |
The connection from init |
win |
Window |
The window to hide the pointer in |
Returns¶
None.
Raises¶
| Exception | When |
|---|---|
RuntimeError |
The window was closed: window is closed |
Notes¶
- The pointer still moves and still produces events.
mouse_get_posand the mouse hooks keep working. - Hiding twice is the same as hiding once. One
mouse_showalways brings it back. - Useful for games that draw their own cursor, or that use mouse-look with
mouse_move.
Example¶
malibx.mouse_hide(mlx, win)
def frame(st):
mx, my = malibx.mouse_get_pos(mlx, win)
malibx.put_image_to_window(mlx, win, background, 0, 0)
malibx.put_image_to_window(mlx, win, cursor_img, mx, my) # custom cursor