Helper class, contains and tracks touch points in your game. Automatically accounts for parallax scrolling, etc.

Variables

read onlyjustPressed:Bool

@:value(FlxPoint.get())read onlyjustPressedPosition:FlxPoint = FlxPoint.get()

@:value(-1)read onlyjustPressedTimeInTicks:Int = -1

read onlypressed:Bool

read onlypressure:Float

A value between 0.0 and 1.0 indicating force of the contact with the device. If the device does not support detecting the pressure, the value is 1.0.

read onlyreleased:Bool

read onlytouchPointID:Int

The unique ID of this touch. You should not make not any further assumptions about this value - IDs are not guaranteed to start from 0 or ascend in order. The behavior may vary from device to device.

Methods

recycle(x:Int, y:Int, pointID:Int, pressure:Float):Void

Resets the justPressed/justReleased flags, sets touch to not pressed and sets touch pressure to 0.

Inherited Variables

Defined by FlxPointer

@:value(0)read onlyscreenX:Int = 0

@:value(0)read onlyscreenY:Int = 0

@:value(0)read onlyx:Int = 0

@:value(0)read onlyy:Int = 0

Inherited Methods

Defined by FlxPointer

getPosition(?point:FlxPoint):FlxPoint

Returns a FlxPoint with this input's x and y.

@:access(flixel.FlxCamera)getPositionInCameraView(?Camera:FlxCamera, ?point:FlxPoint):FlxPoint

Fetch the screen position of the pointer relative to given camera's viewport.

Parameters:

Camera

If unspecified, first/main global camera is used instead.

point

An existing point object to store the results (if you don't want a new one created).

Returns:

The touch point's location relative to camera's viewport.

getScreenPosition(?Camera:FlxCamera, ?point:FlxPoint):FlxPoint

Fetch the screen position of the pointer on any given camera. NOTE: screenX and screenY also store the screen position of the pointer on the main camera.

Parameters:

Camera

If unspecified, first/main global camera is used instead.

point

An existing point object to store the results (if you don't want a new one created).

Returns:

The touch point's location in screen space.

getWorldPosition(?Camera:FlxCamera, ?point:FlxPoint):FlxPoint

Fetch the world position of the pointer on any given camera. NOTE: x and y also store the world position of the pointer on the main camera.

Parameters:

Camera

If unspecified, first/main global camera is used instead.

point

An existing point object to store the results (if you don't want a new one created).

Returns:

The touch point's location in world space.

@:access(flixel.group.FlxTypedGroup.resolveGroup)overlaps(ObjectOrGroup:FlxBasic, ?Camera:FlxCamera):Bool

Checks to see if some FlxObject overlaps this FlxObject or FlxGroup. If the group has a LOT of things in it, it might be faster to use FlxG.overlaps(). WARNING: Currently tilemaps do NOT support screen space overlap checks!

Parameters:

ObjectOrGroup

The object or group being tested.

Camera

Specify which game camera you want. If null getScreenPosition() will just grab the first global camera.

Returns:

Whether or not the two objects overlap.

inlinesetGlobalScreenPositionUnsafe(newX:Float, newY: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 / touch events to the stage.