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 onlygameX:Int = 0

The position relative to the FlxGame's position in the window, where 0 is the left edge of the game and FlxG.width is the right

Available since

5.9.0

.

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

The position relative to the FlxGame's position in the window, where 0 is the top edge of the game and FlxG.height is the bottom

Available since

5.9.0

.

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

Deprecated: "screenX is deprecated, use viewX, instead"

The world position relative to the main camera's scroll position

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

Deprecated: "screenY is deprecated, use viewY, instead"

The world position relative to the main camera's scroll position

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

The world position relative to the main camera's scroll position, cam.viewMarginX or cam.viewMarginLeft is the left edge of the camera and cam.viewMarginRight is the right

Available since

5.9.0

.

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

The world position relative to the main camera's scroll position, cam.viewMarginY or cam.viewMarginTop is the top edge of the camera and cam.viewMarginBottom is the bottom

Available since

5.9.0

.

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

The position in the world

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

The position in the world

Inherited Methods

Defined by FlxPointer

getGamePosition(?result:FlxPoint):FlxPoint

The position relative to the game's position in the window, where (0, 0) is the top-left edge of the game and (FlxG.width, FlxG.height) is the bottom-right

Note: Fields gameX and gameY also store this result

Parameters:

result

An existing point to store the results, if unspecified, one is created

Available since

5.9.0

.

getPosition(?result:FlxPoint):FlxPoint

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

getPositionInCameraView(?camera:FlxCamera, ?result:FlxPoint):FlxPoint

Deprecated: "getPositionInCameraView is deprecated, use getViewPosition, instead"

Fetch the position of the pointer relative to given camera's scroll position, where (cam.viewMarginLeft, cam.viewMarginTop) is the top-left of the camera and (cam.viewMarginRight, cam.viewMarginBottom) is the bottom right of the camera

Note: Fields viewX and viewY also store this result for FlxG.camera

Parameters:

camera

If unspecified, FlxG.camera is used, instead.

result

An existing point to store the results, if unspecified, one is created

Returns:

The pointer's location relative to camera's viewport.

getScreenPosition(?camera:FlxCamera, ?result:FlxPoint):FlxPoint

Deprecated: "getScreenPosition is deprecated, use getViewPosition, instead"

Fetch the position of the pointer relative to given camera's scroll position, where (cam.viewMarginLeft, cam.viewMarginTop) is the top-left of the camera and (cam.viewMarginRight, cam.viewMarginBottom) is the bottom right of the camera

Note: Fields viewX and viewY also store this result for FlxG.camera

Parameters:

camera

If unspecified, FlxG.camera is used, instead

result

An existing point to store the results, if unspecified, one is created

getViewPosition(?camera:FlxCamera, ?result:FlxPoint):FlxPoint

Fetch the world position relative to the main camera's scroll position, where (cam.viewMarginLeft, cam.viewMarginTop) is the top-left of the camera and (cam.viewMarginRight, cam.viewMarginBottom) is the bottom right

Note: Fields viewX and viewY also store this result

Parameters:

camera

If unspecified, FlxG.camera is used, instead

result

An existing point to store the results, if unspecified, one is created

getWorldPosition(?camera:FlxCamera, ?result:FlxPoint):FlxPoint

Fetch the world position of the pointer on any given camera

Note: Fields x and y also store this result

Parameters:

camera

If unspecified, FlxG.camera is used, instead

result

An existing point to store the results, if unspecified, one is created

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

Checks to see if this pointer overlaps some FlxObject or FlxGroup.

Parameters:

objectOrGroup

The object or group being tested

camera

Helps determine the world position. If unspecified, FlxG.camera is used

inlinesetGlobalScreenPositionUnsafe(newX:Float, newY:Float):Void

Deprecated: "setGlobalScreenPositionUnsafe is deprecated, use setRawPositionUnsafe, instead"

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.

@:haxe.warning("-WDeprecated")setRawPositionUnsafe(x:Float, y:Float):Void

Directly set the underyling position variable. WARNING! You should never use this unless you are trying to manually dispatch low-level mouse / touch events to the stage.

Available since

5.9.0

.