mouse
mouse
¶
Mouse polling. The mousemove, mousepressed, mousereleased and
mousewheel callbacks (see events) cover edges; these read the live state.
toMouseButton ¶
proc toMouseButton(b: uint8): MouseButton
The nim2d MouseButton for an SDL button number.
Parameters
-
b(uint8)
Returns
MouseButton
Source:
src/nim2d/mouse.nim:7
mousePosition ¶
proc mousePosition(): Vec2
mouseX ¶
proc mouseX(): float
mouseY ¶
proc mouseY(): float
isMouseDown ¶
proc isMouseDown(button: int = 1): bool
Whether a mouse button is held. 1 is left, 2 is middle, 3 is right.
Parameters
-
button(int)
Returns
bool
Source:
src/nim2d/mouse.nim:31
isMouseDown ¶
proc isMouseDown(button: MouseButton): bool
Whether a mouse button is held, as a MouseButton (the friendly form).
Parameters
-
button(MouseButton)
Returns
bool
Source:
src/nim2d/mouse.nim:38
setMouseVisible ¶
proc setMouseVisible(visible: bool)
isMouseVisible ¶
proc isMouseVisible(): bool
setRelativeMode ¶
proc setRelativeMode(nim2d: Nim2d; enabled: bool)
Capture the mouse and report relative motion, with the cursor hidden. The
mousemove callback then reports movement deltas (dx, dy) without the
pointer being pinned at a screen edge, which suits mouse-look and games
that steer by mouse movement.
Parameters
-
nim2d(Nim2d) -
enabled(bool)
Source:
src/nim2d/mouse.nim:62
isRelativeMode ¶
proc isRelativeMode(nim2d: Nim2d): bool
Whether relative mouse mode is on.
Parameters
-
nim2d(Nim2d)
Returns
bool
Source:
src/nim2d/mouse.nim:69
setMouseGrabbed ¶
proc setMouseGrabbed(nim2d: Nim2d; grabbed: bool)
Confine the cursor to the window.
Parameters
-
nim2d(Nim2d) -
grabbed(bool)
Source:
src/nim2d/mouse.nim:73
isMouseGrabbed ¶
proc isMouseGrabbed(nim2d: Nim2d): bool
Whether the cursor is confined to the window.
Parameters
-
nim2d(Nim2d)
Returns
bool
Source:
src/nim2d/mouse.nim:77
setMousePosition ¶
proc setMousePosition(nim2d: Nim2d; x, y: float)
Warp the cursor to a position inside the window.
Parameters
-
nim2d(Nim2d) -
x(float) -
y(float)
Source:
src/nim2d/mouse.nim:81
Generated with mkdocstrings-nim