This class helps contain and track the mouse pointer in your game.
Automatically accounts for parallax scrolling, etc.
Normally accessed via FlxG.mouse.
Variables
read onlycursor:Null<Bitmap>
The current cursor bitmap, if there is one. To set, use the load function.
read onlycursorContainer:Sprite
A display container for the mouse cursor. It is a child of FlxGame and sits at the right "height". Not used on flash with the native cursor API.
read onlydeltaScreenX:Int
Distance in pixels the mouse has moved in screen space since the last frame in the X direction.
read onlydeltaScreenY:Int
Distance in pixels the mouse has moved in screen space since the last frame in the Y direction.
read onlyjustPressedTimeInTicks:Int
Time in ticks of last left mouse button press.
4.3.0
.read onlyjustPressedTimeInTicksMiddle:Int
Time in ticks of last middle mouse button press.
4.3.0
.read onlyjustPressedTimeInTicksRight:Int
Time in ticks of last right mouse button press.
4.3.0
.read onlyreleased:Bool
Check to see if the left mouse button is currently not pressed.
5.0.0
.read onlyreleasedMiddle:Bool
Check to see if the middle mouse button is currently not pressed.
5.0.0
.read onlyreleasedRight:Bool
Check to see if the right mouse button is currently not pressed.
5.0.0
.useSystemCursor:Bool = false
Tells flixel to use the default system mouse cursor instead of custom Flixel mouse cursors.
Methods
load(?Graphic:Dynamic, Scale:Float = 1, XOffset:Int = 0, YOffset:Int = 0):Void
Load a new mouse cursor graphic - if you're using native cursors on flash, check registerNativeCursor() for more control.
Parameters:
Graphic | The image you want to use for the cursor. |
|---|---|
Scale | Change the size of the cursor. |
XOffset | The number of pixels between the mouse's screen position and the graphic's top left corner. Has to be positive when using native cursors. |
YOffset | The number of pixels between the mouse's screen position and the graphic's top left corner. Has to be positive when using native cursors. |