Skip to content

stdlib/touchView source ↗

touch

29 items · generated by scribe fromstdlib/touch.fd· synced 2026-11-15

stdlib/touch29 items

Contents

TOUCH_NONE:

pub const TOUCH_NONE: i64 = 0; pub const TOUCH_BEGAN: i64 = 1; pub const TOUCH_MOVED: i64 = 2; pub const TOUCH_ENDED: i64 = 3; pub const TOUCH_CANCELLED: i64 = 4;

Defined at line 17


MAX_TOUCHES:

pub const MAX_TOUCHES: i64 = 10;

Defined at line 18


Touch

pub struct Touch {

Fields:

NameType
idi64
xf64
yf64
prev_xf64
prev_yf64
start_xf64
start_yf64
phasei64
pressuref64
timestampf64
activebool

Defined at line 21


TouchState

pub struct TouchState {

Fields:

NameType
touchesVec<Touch>
screen_widthf64
screen_heightf64
tap_max_distancef64
tap_max_durationf64
swipe_min_distancef64
pinch_activebool
pinch_initial_distancef64
pinch_current_distancef64
pan_activebool
swipe_activebool
swipe_directioni64

Defined at line 35


touch_create

Create a new touch state.

pub fn touch_create() -> TouchState {

Returns: TouchState

Defined at line 51


touch_init

Initialize/reset the touch state.

pub fn touch_init(ts: & mut TouchState) -> void {

Parameters:

  • ts: & mut TouchState

Returns: void

Defined at line 66


touch_set_screen_size

Set the screen dimensions.

pub fn touch_set_screen_size(ts: & mut TouchState, w: f64, h: f64) -> void {

Parameters:

  • ts: & mut TouchState
  • w: f64
  • h: f64

Returns: void

Defined at line 81


touch_begin

Handle a touch begin event.

pub fn touch_begin(ts: & mut TouchState, id: i64, x: f64, y: f64, pressure: f64, timestamp: f64) -> void {

Parameters:

  • ts: & mut TouchState
  • id: i64
  • x: f64
  • y: f64
  • pressure: f64
  • timestamp: f64

Returns: void

Defined at line 111


touch_move

Handle a touch move event.

pub fn touch_move(ts: & mut TouchState, id: i64, x: f64, y: f64, pressure: f64) -> void {

Parameters:

  • ts: & mut TouchState
  • id: i64
  • x: f64
  • y: f64
  • pressure: f64

Returns: void

Defined at line 132


touch_end

Handle a touch end event.

pub fn touch_end(ts: & mut TouchState, id: i64) -> void {

Parameters:

  • ts: & mut TouchState
  • id: i64

Returns: void

Defined at line 148


touch_cancel

Handle a touch cancel event.

pub fn touch_cancel(ts: & mut TouchState, id: i64) -> void {

Parameters:

  • ts: & mut TouchState
  • id: i64

Returns: void

Defined at line 159


touch_update

Update gesture detection. Call after processing all touch events.

pub fn touch_update(ts: & mut TouchState) -> void {

Parameters:

  • ts: & mut TouchState

Returns: void

Defined at line 170


touch_count

Get the number of active touches.

pub fn touch_count(ts: & TouchState) -> i64 {

Parameters:

  • ts: & TouchState

Returns: i64

Defined at line 253


touch_get

Get a touch by index (0..count-1).

pub fn touch_get(ts: & TouchState, idx: i64) -> Touch {

Parameters:

  • ts: & TouchState
  • idx: i64

Returns: Touch

Defined at line 266


touch_is_tap

Check if a tap occurred.

pub fn touch_is_tap(ts: & TouchState) -> bool {

Parameters:

  • ts: & TouchState

Returns: bool

Defined at line 284


touch_tap_position

Get the tap position.

pub fn touch_tap_position(ts: & TouchState) -> vec2 {

Parameters:

  • ts: & TouchState

Returns: vec2

Defined at line 302


touch_pinch_active

Check if a pinch gesture is active.

pub fn touch_pinch_active(ts: & TouchState) -> bool {

Parameters:

  • ts: & TouchState

Returns: bool

Defined at line 320


touch_pinch_scale

Get the pinch scale factor.

pub fn touch_pinch_scale(ts: & TouchState) -> f64 {

Parameters:

  • ts: & TouchState

Returns: f64

Defined at line 325


touch_pan_active

Check if a pan gesture is active.

pub fn touch_pan_active(ts: & TouchState) -> bool {

Parameters:

  • ts: & TouchState

Returns: bool

Defined at line 336


touch_pan_delta

Get the pan delta.

pub fn touch_pan_delta(ts: & TouchState) -> vec2 {

Parameters:

  • ts: & TouchState

Returns: vec2

Defined at line 341


touch_swipe_active

Check if a swipe just occurred.

pub fn touch_swipe_active(ts: & TouchState) -> bool {

Parameters:

  • ts: & TouchState

Returns: bool

Defined at line 354


touch_swipe_direction

Get the swipe direction (0=right, 1=left, 2=down, 3=up).

pub fn touch_swipe_direction(ts: & TouchState) -> i64 {

Parameters:

  • ts: & TouchState

Returns: i64

Defined at line 359


touch_swipe_delta

Get the swipe delta.

pub fn touch_swipe_delta(ts: & TouchState) -> vec2 {

Parameters:

  • ts: & TouchState

Returns: vec2

Defined at line 364


touch_to_pixels

Convert normalized touch coordinates to screen pixels.

pub fn touch_to_pixels(ts: & TouchState, t: & Touch) -> vec2 {

Parameters:

  • ts: & TouchState
  • t: & Touch

Returns: vec2

Defined at line 377


touch_set_tap_threshold

Set the tap detection threshold.

pub fn touch_set_tap_threshold(ts: & mut TouchState, max_dist: f64, max_duration: f64) -> void {

Parameters:

  • ts: & mut TouchState
  • max_dist: f64
  • max_duration: f64

Returns: void

Defined at line 382


touch_set_swipe_threshold

Set the swipe detection threshold.

pub fn touch_set_swipe_threshold(ts: & mut TouchState, min_dist: f64) -> void {

Parameters:

  • ts: & mut TouchState
  • min_dist: f64

Returns: void

Defined at line 388


touch_clear

Clear all touch state.

pub fn touch_clear(ts: & mut TouchState) -> void {

Parameters:

  • ts: & mut TouchState

Returns: void

Defined at line 393


Generated by scribe, the Fides documentation generator