stdlib/touchView source ↗
touch
29 items · generated by scribe fromstdlib/touch.fd· synced 2026-11-15
Contents
- TOUCH_NONE: (const)
- MAX_TOUCHES: (const)
- Touch (struct)
- TouchState (struct)
- touch_create (function)
- touch_init (function)
- touch_set_screen_size (function)
- touch_begin (function)
- touch_move (function)
- touch_end (function)
- touch_cancel (function)
- touch_update (function)
- touch_count (function)
- touch_get (function)
- touch_is_tap (function)
- touch_tap_position (function)
- touch_pinch_active (function)
- touch_pinch_scale (function)
- touch_pan_active (function)
- touch_pan_delta (function)
- touch_swipe_active (function)
- touch_swipe_direction (function)
- touch_swipe_delta (function)
- touch_to_pixels (function)
- touch_set_tap_threshold (function)
- touch_set_swipe_threshold (function)
- touch_clear (function)
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:
| Name | Type |
|---|---|
id | i64 |
x | f64 |
y | f64 |
prev_x | f64 |
prev_y | f64 |
start_x | f64 |
start_y | f64 |
phase | i64 |
pressure | f64 |
timestamp | f64 |
active | bool |
Defined at line 21
TouchState
pub struct TouchState {Fields:
| Name | Type |
|---|---|
touches | Vec<Touch> |
screen_width | f64 |
screen_height | f64 |
tap_max_distance | f64 |
tap_max_duration | f64 |
swipe_min_distance | f64 |
pinch_active | bool |
pinch_initial_distance | f64 |
pinch_current_distance | f64 |
pan_active | bool |
swipe_active | bool |
swipe_direction | i64 |
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 TouchStatew:f64h: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 TouchStateid:i64x:f64y:f64pressure:f64timestamp: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 TouchStateid:i64x:f64y:f64pressure: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 TouchStateid: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 TouchStateid: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:& TouchStateidx: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:& TouchStatet:& 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 TouchStatemax_dist:f64max_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 TouchStatemin_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