Kiwi.Input.Mouse Class
Handles the dispatching/management of Mouse Events on a game. When this class is instantiated a MouseCursor object is also created (on this object) which holds the information that is unique to the mouse cursor, although majority of that information is still accessible inside this object.
Constructor
Kiwi.Input.Mouse
-
game
Parameters:
-
game
Kiwi.GameThe game that this mouse manager belongs to.
Returns:
Item Index
Methods
Properties
- _cursor
- _domElement
- _game
- altKey
- button
- ctrlKey
- cursor
- duration
- isDown
- isUp
- LEFT_BUTTON static
- MIDDLE_BUTTON static
- onDown
- onUp
- onWheel
- RIGHT_BUTTON static
- shiftKey
- wheelDeltaX
- wheelDeltaY
- x
- y
Methods
boot
()
public
This method is executed when the DOM has finished loading and thus the MouseManager can start listening for events.
justPressed
-
[duration=200]
Returns a boolean indicating if the mouse was 'justPressed' within a certain timeframe. The default timeframe is 200 milliseconds.
Parameters:
-
[duration=200]
Number optionalThe timeframe that it could have occured in.
Returns:
justReleased
-
[duration=200]
Returns a boolean indicating if the mouse was 'justReleased' within a certain timeframe. The default timeframe is 200 milliseconds.
Parameters:
-
[duration=200]
Number optionalThe timeframe that it could have occured in..
Returns:
objType
()
String
public
The type of object that this is.
Returns:
"Mouse"
onMouseDown
-
event.
Method that gets fired when the mouse is pressed on the stage.
Parameters:
-
event.
MouseEvent
onMouseMove
-
event.
Method that gets fired when the mouse moves anywhere on the stage.
Parameters:
-
event.
MouseEvent
onMouseUp
-
event.
Method that gets fired when the mouse is released on the stage.
Parameters:
-
event.
MouseEvent
onMouseWheel
-
event.
Method that gets fired when the mousewheel is moved.
Parameters:
-
event.
MouseEvent
reset
()
public
Runs the Reset method on the MouseCursor.
start
()
public
Start the mouse event listeners on the game. Automatically called by the boot.
stop
()
public
Stops the mouse event listeners from working. Useful if you no longer want the mouse to 'work'/be listened to.
update
()
public
The update loop for the cursor.
Properties
_cursor
Kiwi.Input.MouseCursor
private
The MouseCursor that is on the stage. This contains the coordinates and information about the cursor.
_domElement
HTMLDivElement
private
The HTMLElement that is being used to apply the mouse events to.
altKey
Boolean
public
Indicates if the alt key is down.
Default: false
ctrlKey
Boolean
public
Indicates if the ctrl key is down.
Default: false
cursor
Kiwi.Input.MouseCursor
private
Returns the MouseCursor that is being used on the stage. This is READ ONLY.
duration
Number
public
Gets the duration in Milliseconds that the mouse cursor has either been up or down for.
isDown
Boolean
public
Indicates whether or not the cursor is currently down. This is READ ONLY.
Default: false
isUp
Boolean
public
Indicates whether or not the cursor is currently up. This is READ ONLY.
Default: true
LEFT_BUTTON
Number
public
final
static
The numeric value for the LEFT button.
Default: 0
MIDDLE_BUTTON
Number
public
final
static
The numeric value for the MIDDLE button.
Default: 1
onDown
Kiwi.Signal
public
A Signal that dispatches events when the mouse is pressed down on the stage.
onUp
Kiwi.Signal
public
A Signal that dispatches events when the mouse is released from being down on the stage.
RIGHT_BUTTON
Number
public
final
static
The numeric value for the RIGHT button.
Default: 2
shiftKey
Boolean
public
Indicates if the shift key is down.
Default: false
wheelDeltaX
Number
public
Gets the wheelDeltaX coordinate of the mouse cursors wheel.
wheelDeltaY
Number
public
Gets the wheelDeltaY coordinate of the mouse cursors wheel.
x
Number
public
Gets the x coordinate of the mouse cursor.
y
Number
public
Gets the y coordinate of the mouse cursor.