Skip to main content

InputEvent

Struct InputEvent 

Source
pub struct InputEvent {
Show 27 fields pub kind: InputEventKind, pub mouse_x: f32, pub mouse_y: f32, pub mouse_dx: f32, pub mouse_dy: f32, pub button: i32, pub click_count: i32, pub scroll_x: f32, pub scroll_y: f32, pub integer_scroll_x: i32, pub integer_scroll_y: i32, pub timestamp_ns: u64, pub scroll_gesture: ScrollGesture, pub gesture_scale: f32, pub pinch_phase: PinchPhase, pub key: Key, pub modifiers: InputModifiers, pub key_repeat: bool, pub text: String, pub text_selection_start: i32, pub text_selection_length: i32, pub window_w: i32, pub window_h: i32, pub gamepad_id: u32, pub gamepad_button: i32, pub gamepad_axis: i32, pub gamepad_value: i32,
}
Expand description

Platform-neutral input event. Donor: oa/ui/event.h UiEvent.

Fields§

§kind: InputEventKind§mouse_x: f32

Physical pixel pointer position.

§mouse_y: f32§mouse_dx: f32

Pointer delta from previous position.

§mouse_dy: f32§button: i32

1 = left, 2 = middle, 3 = right.

§click_count: i32§scroll_x: f32

Smooth scroll deltas (SDL3 wheel.x/y).

§scroll_y: f32§integer_scroll_x: i32

Accumulated discrete wheel ticks (SDL3 integer_x/y).

§integer_scroll_y: i32§timestamp_ns: u64

SDL3 timestamp in nanoseconds (for burst detection).

§scroll_gesture: ScrollGesture§gesture_scale: f32

Multi-touch pinch — scale relative to Begin (1.0 = no change).

§pinch_phase: PinchPhase§key: Key§modifiers: InputModifiers§key_repeat: bool§text: String

Committed UTF-8 text from platform IME.

§text_selection_start: i32§text_selection_length: i32§window_w: i32

Resized window pixel dimensions.

§window_h: i32§gamepad_id: u32

Gamepad instance id — meaningful only on Gamepad* event kinds.

§gamepad_button: i32

Standard gamepad button code (GAMEPAD_BUTTON_*) — meaningful only on GamepadButton* event kinds.

§gamepad_axis: i32

Standard gamepad axis code (GAMEPAD_AXIS_*) — meaningful only on GamepadAxisMotion.

§gamepad_value: i32

Axis reading in SDL’s -32768..=32767 range on GamepadAxisMotion.

Implementations§

Source§

impl InputEvent

Source

pub fn ctrl(&self) -> bool

Source

pub fn shift(&self) -> bool

Source

pub fn alt(&self) -> bool

Source

pub fn mouse_move(x: f32, y: f32, modifiers: InputModifiers) -> Self

Construct a pointer-move event.

Source

pub fn mouse_down( x: f32, y: f32, button: i32, click_count: i32, modifiers: InputModifiers, ) -> Self

Construct a pointer-down event.

Source

pub fn mouse_up(x: f32, y: f32, button: i32, modifiers: InputModifiers) -> Self

Construct a pointer-up event.

Source

pub fn key_down(key: Key, modifiers: InputModifiers, repeat: bool) -> Self

Construct a key-down event.

Source

pub fn key_up(key: Key, modifiers: InputModifiers) -> Self

Construct a key-up event.

Trait Implementations§

Source§

impl Clone for InputEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InputEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InputEvent

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for InputEvent

§

impl Freeze for InputEvent
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for InputEvent

§

impl RefUnwindSafe for InputEvent

§

impl Send for InputEvent
where RawVecInner: Send,

§

impl Sync for InputEvent
where RawVecInner: Sync,

§

impl Unpin for InputEvent
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for InputEvent

§

impl UnwindSafe for InputEvent
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.