Skip to main content

CursorManager

Struct CursorManager 

Source
pub(crate) struct CursorManager {
    pub mc_x: i32,
    pub mc_y: i32,
    pub mc_visible: bool,
    pub mc_save: [u32; 192],
    pub tc_col: usize,
    pub tc_row: usize,
    pub tc_w: usize,
    pub tc_h: usize,
    pub tc_visible: bool,
    pub tc_color: u32,
    pub tc_save: [u32; 1024],
}
Expand description

Holds all cursor-related state for the framebuffer terminal.

Mouse cursor – a small arrow sprite that can be saved/restored/drawn. Text cursor – a blinking underline / block that follows the text input position.

Fields§

§mc_x: i32§mc_y: i32§mc_visible: bool§mc_save: [u32; 192]§tc_col: usize§tc_row: usize§tc_w: usize§tc_h: usize§tc_visible: bool§tc_color: u32§tc_save: [u32; 1024]

Implementations§

Source§

impl CursorManager

Source

pub const fn new() -> Self

Create a new cursor manager with all cursors hidden.

Source

pub fn mc_save_hw(&mut self, canvas: &CanvasBuffer)

Save the pixels under the mouse cursor into mc_save.

Source

pub fn mc_draw_hw(&mut self, canvas: &mut CanvasBuffer, fmt: &PixelFormat)

Draw the mouse cursor sprite onto the hardware framebuffer.

Source

pub fn mc_erase_hw(&mut self, canvas: &mut CanvasBuffer)

Erase the mouse cursor by restoring the saved pixels.

Source

pub fn update_mouse_cursor( &mut self, x: i32, y: i32, canvas: &mut CanvasBuffer, fmt: &PixelFormat, ) -> bool

Update mouse cursor position (save old area, redraw at new position).

Source

pub fn hide_mouse_cursor(&mut self, canvas: &mut CanvasBuffer)

Hide the mouse cursor.

Source

pub fn text_cursor_rect( &self, col: usize, row: usize, glyph_w: usize, glyph_h: usize, ) -> (usize, usize, usize, usize)

Calculate the pixel rectangle for the text cursor at (col, row).

Source

pub fn text_cursor_save_hw( &mut self, col: usize, row: usize, glyph_w: usize, glyph_h: usize, canvas: &CanvasBuffer, )

Save the pixels under the text cursor.

Source

pub fn text_cursor_draw_hw( &mut self, col: usize, row: usize, glyph_w: usize, glyph_h: usize, color: u32, canvas: &mut CanvasBuffer, )

Draw the text cursor (inverted-colour block) on the hardware framebuffer.

Source

pub fn text_cursor_erase_hw( &mut self, col: usize, row: usize, glyph_w: usize, glyph_h: usize, canvas: &mut CanvasBuffer, )

Erase the text cursor by restoring the saved pixels.

Source

pub fn draw_text_cursor_overlay( &mut self, col: usize, row: usize, glyph_w: usize, glyph_h: usize, color: u32, canvas: &mut CanvasBuffer, )

Draw the text cursor as a solid-colour overlay at the given position.

Source

pub fn hide_text_cursor( &mut self, col: usize, row: usize, glyph_w: usize, glyph_h: usize, canvas: &mut CanvasBuffer, )

Hide the text cursor.

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
§

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

§

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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

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.