Package | org.flixel.system.input |
Class | public class Mouse |
Inheritance | Mouse FlxPoint Object |
Property | Defined By | ||
---|---|---|---|
screenX : int
Current X position of the mouse pointer on the screen. | Mouse | ||
screenY : int
Current Y position of the mouse pointer on the screen. | Mouse | ||
visible : Boolean [read-only]
Read only, check visibility of mouse cursor. | Mouse | ||
wheel : int
Current "delta" value of mouse wheel. | Mouse | ||
x : Number | FlxPoint | ||
y : Number | FlxPoint |
Property | Defined By | ||
---|---|---|---|
_current : int
Helper variable for tracking whether the mouse was just pressed or just released. | Mouse | ||
_cursor : Bitmap
This is just a reference to the current cursor image, if there is one. | Mouse | ||
_cursorContainer : Sprite
A display container for the mouse cursor. | Mouse | ||
_globalScreenPosition : FlxPoint | Mouse | ||
ImgDefaultCursor : Class | Mouse | ||
_last : int
Helper variable for tracking whether the mouse was just pressed or just released. | Mouse | ||
_lastWheel : int | Mouse | ||
_lastX : int
Helper variables for recording purposes. | Mouse | ||
_lastY : int | Mouse | ||
_point : FlxPoint | Mouse |
Method | Defined By | ||
---|---|---|---|
Mouse(CursorContainer:Sprite)
Constructor. | Mouse | ||
Helper function, just copies the values from the specified point. | FlxPoint | ||
copyFromFlash(FlashPoint:Point):FlxPoint
Helper function, just copies the values from the specified Flash point. | FlxPoint | ||
Helper function, just copies the values from this point to the specified point. | FlxPoint | ||
copyToFlash(FlashPoint:Point):Point
Helper function, just copies the values from this point to the specified Flash point. | FlxPoint | ||
destroy():void
Clean up memory. | Mouse | ||
Fetch the screen position of the mouse on any given camera. | Mouse | ||
Fetch the world position of the mouse on any given camera. | Mouse | ||
handleMouseDown(FlashEvent:MouseEvent):void
Event handler so FlxGame can update the mouse. | Mouse | ||
handleMouseUp(FlashEvent:MouseEvent):void
Event handler so FlxGame can update the mouse. | Mouse | ||
handleMouseWheel(FlashEvent:MouseEvent):void
Event handler so FlxGame can update the mouse. | Mouse | ||
hide():void
Hides the mouse cursor
| Mouse | ||
justPressed():Boolean
Check to see if the mouse was just pressed. | Mouse | ||
justReleased():Boolean
Check to see if the mouse was just released. | Mouse | ||
load(Graphic:Class = null, Scale:Number = 1, XOffset:int = 0, YOffset:int = 0):void
Load a new mouse cursor graphic
| Mouse | ||
Instantiate a new point object. | FlxPoint | ||
playback(Record:MouseRecord):void
Part of the keystroke recording system. | Mouse | ||
pressed():Boolean
Check to see if the mouse is pressed. | Mouse | ||
If the mouse changed state or is pressed, return that info now
| Mouse | ||
reset():void
Resets the just pressed/just released flags and sets mouse to not pressed. | Mouse | ||
show(Graphic:Class = null, Scale:Number = 1, XOffset:int = 0, YOffset:int = 0):void
Either show an existing cursor or load a new one. | Mouse | ||
unload():void
Unload the current cursor graphic. | Mouse | ||
update(X:int, Y:int):void
Called by the internal game loop to update the mouse pointer's position in the game world. | Mouse |
Method | Defined By | ||
---|---|---|---|
updateCursor():void
Internal function for helping to update the mouse cursor and world coordinates. | Mouse |
_current | property |
protected var _current:int
Helper variable for tracking whether the mouse was just pressed or just released.
_cursor | property |
protected var _cursor:Bitmap
This is just a reference to the current cursor image, if there is one.
_cursorContainer | property |
protected var _cursorContainer:Sprite
A display container for the mouse cursor. This container is a child of FlxGame and sits at the right "height".
_globalScreenPosition | property |
protected var _globalScreenPosition:FlxPoint
_last | property |
protected var _last:int
Helper variable for tracking whether the mouse was just pressed or just released.
_lastWheel | property |
protected var _lastWheel:int
_lastX | property |
protected var _lastX:int
Helper variables for recording purposes.
_lastY | property |
protected var _lastY:int
_point | property |
protected var _point:FlxPoint
ImgDefaultCursor | property |
protected var ImgDefaultCursor:Class
screenX | property |
public var screenX:int
Current X position of the mouse pointer on the screen.
screenY | property |
public var screenY:int
Current Y position of the mouse pointer on the screen.
visible | property |
visible:Boolean
[read-only] Read only, check visibility of mouse cursor.
public function get visible():Boolean
wheel | property |
public var wheel:int
Current "delta" value of mouse wheel. If the wheel was just scrolled up, it will have a positive value. If it was just scrolled down, it will have a negative value. If it wasn't just scroll this frame, it will be 0.
Mouse | () | Constructor |
public function Mouse(CursorContainer:Sprite)
Constructor.
ParametersCursorContainer:Sprite |
destroy | () | method |
public function destroy():void
Clean up memory.
getScreenPosition | () | method |
public function getScreenPosition(Camera:FlxCamera = null, Point:FlxPoint = null):FlxPoint
Fetch the screen position of the mouse on any given camera. NOTE: Mouse.screenX and Mouse.screenY also store the screen position of the mouse cursor on the main camera.
Parameters
Camera:FlxCamera (default = null ) — If unspecified, first/main global camera is used instead.
| |
Point:FlxPoint (default = null ) — An existing point object to store the results (if you don't want a new one created).
|
FlxPoint — The mouse's location in screen space.
|
getWorldPosition | () | method |
public function getWorldPosition(Camera:FlxCamera = null, Point:FlxPoint = null):FlxPoint
Fetch the world position of the mouse on any given camera. NOTE: Mouse.x and Mouse.y also store the world position of the mouse cursor on the main camera.
Parameters
Camera:FlxCamera (default = null ) — If unspecified, first/main global camera is used instead.
| |
Point:FlxPoint (default = null ) — An existing point object to store the results (if you don't want a new one created).
|
FlxPoint — The mouse's location in world space.
|
handleMouseDown | () | method |
public function handleMouseDown(FlashEvent:MouseEvent):void
Event handler so FlxGame can update the mouse.
Parameters
FlashEvent:MouseEvent — A MouseEvent object.
|
handleMouseUp | () | method |
public function handleMouseUp(FlashEvent:MouseEvent):void
Event handler so FlxGame can update the mouse.
Parameters
FlashEvent:MouseEvent — A MouseEvent object.
|
handleMouseWheel | () | method |
public function handleMouseWheel(FlashEvent:MouseEvent):void
Event handler so FlxGame can update the mouse.
Parameters
FlashEvent:MouseEvent — A MouseEvent object.
|
hide | () | method |
public function hide():void
Hides the mouse cursor
justPressed | () | method |
public function justPressed():Boolean
Check to see if the mouse was just pressed.
ReturnsBoolean — Whether the mouse was just pressed.
|
justReleased | () | method |
public function justReleased():Boolean
Check to see if the mouse was just released.
ReturnsBoolean — Whether the mouse was just released.
|
load | () | method |
public function load(Graphic:Class = null, Scale:Number = 1, XOffset:int = 0, YOffset:int = 0):void
Load a new mouse cursor graphic
Parameters
Graphic:Class (default = null ) — The image you want to use for the cursor.
| |
Scale:Number (default = 1 ) — Change the size of the cursor.
| |
XOffset:int (default = 0 ) — The number of pixels between the mouse's screen position and the graphic's top left corner.
| |
YOffset:int (default = 0 ) — The number of pixels between the mouse's screen position and the graphic's top left corner.
|
playback | () | method |
public function playback(Record:MouseRecord):void
Part of the keystroke recording system. Takes data about key presses and sets it into array.
Parameters
Record:MouseRecord — Array of data about key states.
|
pressed | () | method |
public function pressed():Boolean
Check to see if the mouse is pressed.
ReturnsBoolean — Whether the mouse is pressed.
|
record | () | method |
public function record():MouseRecord
If the mouse changed state or is pressed, return that info now
ReturnsMouseRecord — An array of key state data. Null if there is no data.
|
reset | () | method |
public function reset():void
Resets the just pressed/just released flags and sets mouse to not pressed.
show | () | method |
public function show(Graphic:Class = null, Scale:Number = 1, XOffset:int = 0, YOffset:int = 0):void
Either show an existing cursor or load a new one.
Parameters
Graphic:Class (default = null ) — The image you want to use for the cursor.
| |
Scale:Number (default = 1 ) — Change the size of the cursor. Default = 1, or native size. 2 = 2x as big, 0.5 = half size, etc.
| |
XOffset:int (default = 0 ) — The number of pixels between the mouse's screen position and the graphic's top left corner.
| |
YOffset:int (default = 0 ) — The number of pixels between the mouse's screen position and the graphic's top left corner.
|
unload | () | method |
public function unload():void
Unload the current cursor graphic. If the current cursor is visible, then the default system cursor is loaded up to replace the old one.
update | () | method |
public function update(X:int, Y:int):void
Called by the internal game loop to update the mouse pointer's position in the game world. Also updates the just pressed/just released flags.
Parameters
X:int — The current X position of the mouse in the window.
| |
Y:int — The current Y position of the mouse in the window.
|
updateCursor | () | method |
protected function updateCursor():void
Internal function for helping to update the mouse cursor and world coordinates.