Skip to main content

Mouse

Struct Mouse 

Source
pub struct Mouse {
    pub x: u32,
    pub y: u32,
    pub is_clicked: bool,
    pub click_frame: u8,
    pub is_text_cursor: bool,
}
Expand description

背景退避・描き戻し方式による動的マウスカーソル制御構造体

Fields§

§x: u32§y: u32§is_clicked: bool§click_frame: u8§is_text_cursor: bool

CSS cursor: text 用。矢印の代わりに I-beam(縦棒)を手続き的に描く。 それ以外の非対応 cursor キーワード(pointer/wait/help 等)は既定の矢印にフォールバックする。

Implementations§

Source§

impl Mouse

Source

pub const SIZE: u32 = 32

Source

pub const fn new(x: u32, y: u32) -> Self

Source

pub fn draw(&self, screen: &Screen)

Source

fn draw_text_cursor(&self, screen: &Screen, draw_x: u32, draw_y: u32)

CSS cursor: text 用の I-beam カーソルを手続き的に描画する。 新規 SVG アイコン資産を追加せず、draw_pixel の直描きだけで完結させる (矢印(SVGラスタライズ)と異なり、コード自体の正しさだけで見た目を保証できる形状)。 Self::SIZE 四方のバウンディングボックス内に収め、既存のダーティ領域管理 (flush_with_cursor/flush_dirty_pageflipSelf::SIZE 四方を前提に 保存/復元・ダーティ判定している)と矛盾しないようにする。

Source

pub fn move_to(&mut self, screen: &Screen, new_x: u32, new_y: u32)

マウスカーソルを新しい位置に移動します

Auto Trait Implementations§

§

impl Freeze for Mouse

§

impl RefUnwindSafe for Mouse

§

impl Send for Mouse

§

impl Sync for Mouse

§

impl Unpin for Mouse

§

impl UnsafeUnpin for Mouse

§

impl UnwindSafe for Mouse

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.