class flixel.input.mouse.FlxMouse extends FlxPoint implements IFlxInput

Available on all platforms

This class helps contain and track the mouse pointer in your game. * Automatically accounts for parallax scrolling, etc.

Instance Fields

var cursorContainer: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.

var justPressed:Bool

Check to see if the mouse was just pressed.

var justPressedMiddle:Bool

Check to see if the middle mouse button was just pressed.

var justPressedRight:Bool

Check to see if the right mouse button has just been pressed.

var justReleased:Bool

Check to see if the mouse was just released.

var justReleasedMiddle:Bool

Check to see if the middle mouse button was just released.

var justReleasedRight:Bool

Check to see if the right mouse button has just been released.

var pressed:Bool

If the left mouse button is currently pressed.

var pressedMiddle:Bool

Check to see if the middle mouse button is pressed.

var pressedRight:Bool

Check to see if the right mouse button is pressed.

var screenX:Int

Current X position of the mouse pointer on the screen.

var screenY:Int

Current Y position of the mouse pointer on the screen.

var useSystemCursor:Bool

Tells flixel to use the default system mouse cursor instead of custom Flixel mouse cursors.

var visible:Bool

Used to toggle the visiblity of the mouse cursor - works on both * the flixel and the system cursor, depending on which one is active.

var wheel:Int

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 destroy():Void

Clean up memory. Internal use only.

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 reset():Void

Resets the just pressed/just released flags and sets mouse to not pressed.

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

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.