No matching definitions.

opengl/input

src/opengl/input.tur
defn

key-pressed?

(key-pressed? [w :int key :int] :bool)

return true on the first frame a key transitions to pressed.

wwindow handle from make-window
keyGLFW key code integer (e.g. 256 for Escape, 32 for Space)

true on the frame the key is first pressed (GLFW_PRESS action).

(key-pressed? w 256)   ; Escape pressed this frame

Since: v0.1.0

defn

mouse-pos

(mouse-pos [w :int] :int)

return the current cursor position as a two-element float pair.

wwindow handle from make-window

Opaque :int handle to a heap-allocated {double x; double y;} struct. Access components with mouse-pos-x and mouse-pos-y.

(let [pos (mouse-pos w)] ...)

Since: v0.1.0

defn

mouse-button-pressed?

(mouse-button-pressed? [w :int button :int] :bool)

return true while a mouse button is held down.

wwindow handle from make-window
buttonbutton index: 0=left, 1=right, 2=middle

true while the button is in the pressed state.

(mouse-button-pressed? w 0)   ; left button held

Since: v0.1.0

Internal definitions
mouse-pos-x-- extract the x component from a mouse-pos result.
mouse-pos-y-- extract the y component from a mouse-pos result.