Class engine.Mouse
Basic mousepress handler The engine calls receiveMouse when a mouse is clicked
Methods
engine.Mouse:receiveMouse (button, x, y, isup, force_name, extra)
Called when a mouse is pressed
engine.Mouse:delegate (button, mx, my, xrel, yrel, bx, by, event, name, extra)
Delegate an event from an other mouse handler if self.delegateoffsetx and self.delegateoffsety are set hey will be used to change the actual coordinates
engine.Mouse:setCurrent ()
Setups as the current game keyhandler
engine.Mouse:getZone (name)
Returns a zone definition by its name
engine.Mouse:updateZone (name, x, y, w, h, fct, scale)
Update a named zone with new coords
engine.Mouse:registerZone (x, y, w, h, fct, mode, name, allow_out_events, scale)
Registers a click zone that when clicked will call the object's "onClick" method
engine.Mouse:receiveTouch (fingerId, x, y, dx, dy, pressure, isup)
Called when a touch event is received
engine.Mouse:receiveTouchMotion (fingerId, x, y, dx, dy, pressure)
Called when a touch motion event is received
engine.Mouse:receiveTouchGesture (nb_fingers, x, y, d_rot, d_pinch)
Called when a touch gesture event is received
engine.Mouse:receiveJoyAxis (axis, value)
Called when a gamepad axis event is received
engine.Mouse:receiveJoyBall (ball, xrel, yrel)
Called when a gamepad ball event is received
engine.Mouse:receiveJoyHat (hat, dir)
Called when a gamepad hat event is received
Methods
- engine.Mouse:receiveMouse (button, x, y, isup, force_name, extra)
-
Called when a mouse is pressed
Parameters:
- button
- x coordinate of the click
- y coordinate of the click
- isup true if the key was released, false if pressed
- force_name if not nil only the zone with this name may trigger
- extra
- engine.Mouse:delegate (button, mx, my, xrel, yrel, bx, by, event, name, extra)
-
Delegate an event from an other mouse handler
if self.delegateoffsetx and self.delegateoffsety are set hey will be used to change the actual coordinates
Parameters:
- button
- mx
- my
- xrel
- yrel
- bx
- by
- event
- name
- extra
- engine.Mouse:setCurrent ()
- Setups as the current game keyhandler
- engine.Mouse:getZone (name)
-
Returns a zone definition by its name
Parameters:
- name
- engine.Mouse:updateZone (name, x, y, w, h, fct, scale)
-
Update a named zone with new coords
Parameters:
- name
- x
- y
- w
- h
- fct
- scale
Returns:
-
true if the zone was found and updated
- engine.Mouse:registerZone (x, y, w, h, fct, mode, name, allow_out_events, scale)
-
Registers a click zone that when clicked will call the object's "onClick" method
Parameters:
- x
- y
- w
- h
- fct
- mode
- name
- allow_out_events
- scale
- engine.Mouse:receiveTouch (fingerId, x, y, dx, dy, pressure, isup)
-
Called when a touch event is received
Parameters:
- fingerId id of the finger info
- x coordinate of the click (normalized to 0->1)
- y coordinate of the click (normalized to 0->1)
- dx delta coordinate of the click (normalized to 0->1)
- dy delta coordinate of the click (normalized to 0->1)
- pressure
- isup true if the key was released, false if pressed
- engine.Mouse:receiveTouchMotion (fingerId, x, y, dx, dy, pressure)
-
Called when a touch motion event is received
Parameters:
- fingerId id of the finger info
- x coordinate of the click (normalized to 0->1)
- y coordinate of the click (normalized to 0->1)
- dx delta coordinate of the click (normalized to 0->1)
- dy delta coordinate of the click (normalized to 0->1)
- pressure
- engine.Mouse:receiveTouchGesture (nb_fingers, x, y, d_rot, d_pinch)
-
Called when a touch gesture event is received
Parameters:
- nb_fingers number of fingers
- x coordinate of the click (normalized to 0->1)
- y coordinate of the click (normalized to 0->1)
- d_rot delta rotation
- d_pinch delta pinch
- engine.Mouse:receiveJoyAxis (axis, value)
-
Called when a gamepad axis event is received
Parameters:
- axis id of axis changed
- value current value of the axis, from -1 to 1
- engine.Mouse:receiveJoyBall (ball, xrel, yrel)
-
Called when a gamepad ball event is received
Parameters:
- ball id of ball changed
- xrel the relative movement of the ball
- yrel the relative movement of the ball
- engine.Mouse:receiveJoyHat (hat, dir)
-
Called when a gamepad hat event is received
Parameters:
- hat id of the hat changed
- dir current direction of the hat, one of 1,2,3,4,6,7,8,9 (representing direction)