pub struct TerminalMetrics {
pub cell_width: f32,
pub cell_height: f32,
pub columns: u16,
pub rows: u16,
}Expand description
Terminal display metrics shared between rendering and input systems
This provides the coordinate conversion information needed by:
- Mouse input handlers (screen to grid coordinate conversion)
- Text rendering systems (grid to screen coordinate conversion)
- Selection and UI overlays (coordinate mapping)
This type can be used as a Bevy Resource when the bevy feature is enabled.
Fields§
§cell_width: f32Width of a single character cell in pixels
cell_height: f32Height of a single character cell in pixels
columns: u16Number of columns in the terminal grid
rows: u16Number of rows in the terminal grid
Implementations§
Source§impl TerminalMetrics
impl TerminalMetrics
Sourcepub fn new(
font_size: f32,
line_height_multiplier: f32,
columns: u16,
rows: u16,
) -> Self
pub fn new( font_size: f32, line_height_multiplier: f32, columns: u16, rows: u16, ) -> Self
Create metrics from font size and terminal dimensions
Sourcepub fn grid_to_screen(&self, col: u16, row: u16) -> (f32, f32)
pub fn grid_to_screen(&self, col: u16, row: u16) -> (f32, f32)
Convert grid coordinates to screen coordinates (top-left of cell)
§Returns
Screen position in pixels (x, y)
Sourcepub fn screen_size(&self) -> (f32, f32)
pub fn screen_size(&self) -> (f32, f32)
Get total terminal size in pixels
Trait Implementations§
Source§impl Clone for TerminalMetrics
impl Clone for TerminalMetrics
Source§fn clone(&self) -> TerminalMetrics
fn clone(&self) -> TerminalMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TerminalMetrics
impl Debug for TerminalMetrics
Source§impl Default for TerminalMetrics
impl Default for TerminalMetrics
impl Copy for TerminalMetrics
Auto Trait Implementations§
impl Freeze for TerminalMetrics
impl RefUnwindSafe for TerminalMetrics
impl Send for TerminalMetrics
impl Sync for TerminalMetrics
impl Unpin for TerminalMetrics
impl UnsafeUnpin for TerminalMetrics
impl UnwindSafe for TerminalMetrics
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.