Skip to main content

MouseTracker

Struct MouseTracker 

Source
pub struct MouseTracker {
    pub x: u32,
    pub y: u32,
    pub screen_width: u32,
    pub screen_height: u32,
    pub learned_max_x: u32,
    pub learned_max_y: u32,
}
Expand description

画面サイズとマウス座標の厳格な管理を行うトラッカー

Fields§

§x: u32§y: u32§screen_width: u32§screen_height: u32§learned_max_x: u32§learned_max_y: u32

Implementations§

Source§

impl MouseTracker

Source

pub fn new( initial_x: u32, initial_y: u32, screen_width: u32, screen_height: u32, ) -> Self

新しいトラッカーを初期化します

Source

pub fn update_screen_size(&mut self, width: u32, height: u32)

画面のリサイズなどで解像度が変更された場合に呼び出します

Source

pub fn move_relative(&mut self, dx: i32, dy: i32)

相対的な移動量 (dx, dy) を適用し、画面内にクランプします

Source

pub fn move_absolute_tablet( &mut self, abs_x: u32, abs_y: u32, _max_abs_x: u32, _max_abs_y: u32, )

タブレット等の絶対座標入力を解像度にマッピングして移動します

Source

fn clamp(&mut self)

現在の座標が画面内に収まるようにクランプします

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.