class FlxMouse
package flixel.input.mouse
extends FlxPointer
implements IFlxInputManager
Available on all platforms
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 onlydeltaViewX:Int
Distance in pixels the mouse has moved in view space since the last frame in the X direction.
5.9.0
.read onlydeltaViewY:Int
Distance in pixels the mouse has moved in view space since the last frame in the Y direction.
5.9.0
.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
.read onlyswipeThreshold:FlxPoint = FlxPoint.get(100, 100)
The threshold to surpass for a movement check to be returned as true.
useSystemCursor:Bool = false
Tells flixel to use the default system mouse cursor instead of custom Flixel mouse cursors.
visible:Bool = true
Used to toggle the visiblity of the mouse cursor - works on both the flixel and the system cursor, depending on which one is active.
read onlywheel:Int = 0
Current "delta" value of mouse wheel. If the wheel was just scrolled up, it will have a positive value and vice versa. Otherwise the value will be 0.
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. |
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.