Available on all platforms
Sub classes | ||||
![]() | FlxUIMouse |
|
This class helps contain and track the mouse pointer in your game. * Automatically accounts for parallax scrolling, etc.
Instance Fields
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.
var useSystemCursor:Bool
Tells flixel to use the default system mouse cursor instead of custom Flixel mouse cursors.
Used to toggle the visiblity of the mouse cursor - works on both * the flixel and the system cursor, depending on which one is active.
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.
function getScreenPosition(?Camera:FlxCamera = null, ?point:FlxPoint = null):FlxPoint
Fetch the screen position of the mouse on any given camera. NOTE: FlxG.mouse.screenX * and Mouse.screenY also store the screen position of the mouse cursor on the main camera. * *
Camera | If unspecified, FlxG.camera is used instead. * |
point | An existing point object to store the results (if you don't want a new one created). * |
returns | The mouse's location in screen space. |
function getWorldPosition(?Camera:FlxCamera = null, ?point:FlxPoint = null):FlxPoint
Fetch the world position of the mouse on any given camera. NOTE: FlxG.mouse.x and * FlxG.mouse.y store the world position of the mouse cursor on the main camera. * *
Camera | If unspecified, FlxG.camera is used instead. * |
point | An existing point object to store the results (if you don't want a new one created). * |
returns | The mouse's location in world space. |
function load(?Graphic:Dynamic = null, ?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. * *
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. * |
YOffset | The number of pixels between the mouse's screen position and the graphic's top left corner. |
function registerNativeCursor(Name:String, CursorData:MouseCursorData):Void
Shortcut to register a native cursor for in flash * *
Name | The ID name used for the cursor * |
CursorData | MouseCursorData contains the bitmap, hotspot etc * |
Show | Whether to call setNativeCursor afterwards |
function setGlobalScreenPositionUnsafe(X:Float, Y:Float):Void
Directly set the underyling screen position variable. WARNING! You should never use * this unless you are trying to manually dispatch low-level mouse events to the stage.
function 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 * *
Name | The name ID used when registered |
function setSimpleNativeCursorData(Name:String, CursorBitmap:BitmapData):MouseCursorData
Shortcut to create and set a simple MouseCursorData * *
Name | The ID name used for the cursor * |
CursorData | MouseCursorData contains the bitmap, hotspot etc |