FlixelTouch
View sourceclass
org.flixelgdx.input.touch.FlixelTouch
State snapshot for a single touch pointer (one finger).
Instances are pre-allocated by FlixelTouchManager and reused across frames; do not create them yourself. Access the array via FlixelTouchManager.list:
FlixelTouch first = Flixel.touches.list[0];
if (first.isJustPressed()) {
spawnEffect(first.worldX, first.worldY);
}
Screen coordinates use libGDX's top-left origin (Y increases downward). World coordinates are unprojected via the touch manager's active camera and use the standard bottom-left origin (Y increases upward), matching the rest of the scene.
State fields (FlixelTouch.screenX, FlixelTouch.screenY, FlixelTouch.worldX, FlixelTouch.worldY, FlixelTouch.pointer) are public for zero-overhead reads. The boolean state is exposed through getters to prevent accidental modification by game code; the manager is the only writer.
See Also: FlixelTouchManager
Fields
worldX
World X coordinate of this pointer, unprojected from screen space via the active camera.
worldY
World Y coordinate of this pointer, unprojected from screen space via the active camera.
screenX
Screen X coordinate in pixels, top-left origin, matching libGDX conventions.
screenY
Screen Y coordinate in pixels, top-left origin, matching libGDX conventions.
pointer
Zero-based pointer index identifying this finger (0 = first touch, 1 = second, etc.).
Methods
pressed()
Returns true while this pointer is currently in contact with the screen.
justPressed()
Returns true on the single frame this pointer first touched the screen. Clears to false after FlixelTouchManager.endFrame() is called.
justReleased()
Returns true on the single frame this pointer lifted off the screen. Clears to false after FlixelTouchManager.endFrame() is called.
dragging()
Returns true once this pointer has moved after being pressed, and stays true until the pointer is released. Use this to distinguish a tap from a drag gesture.
justCancelled()
Returns true on the single frame this pointer was cancelled by the system (for example, an incoming phone call interrupting the touch session). Clears to false after FlixelTouchManager.endFrame() is called.