class FlxMouse
package flixel.input.mouse
extends FlxPointer
implements IFlxInputManager
extended by FlxUIMouse
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. |
inlineregisterNativeCursor(name:String, cursorData:MouseCursorData):Void
Shortcut to register a native cursor in flash
Parameters:
name | The ID name used for the cursor |
---|---|
cursorData | MouseCursorData contains the bitmap, hotspot etc |
registerSimpleNativeCursorData(name:String, cursorBitmap:BitmapData):MouseCursorData
Shortcut to register a simple MouseCursorData
Parameters:
name | The ID name used for the cursor |
---|---|
cursorData | MouseCursorData contains the bitmap, hotspot etc |
4.2.0
.setNativeCursor(name:String):Void
Set a Native cursor that has been registered by name Warning, you need to use registerNativeCursor() before you use it here
Parameters:
name | The name ID used when registered |
---|
setSimpleNativeCursorData(name:String, cursorBitmap:BitmapData):MouseCursorData
Shortcut to create and set a simple MouseCursorData
Parameters:
name | The ID name used for the cursor |
---|---|
cursorData | MouseCursorData contains the bitmap, hotspot etc |