[−][src]Struct sunrise_vi::terminal::Terminal
A struct for logging text to the window. Renders characters from a .ttf font using the font-rs crate
Fields
framebuffer: Arc<Buffer>
Rendering target for this terminal.
cursor_pos: Pos
Cursor pos, in pixels. Does not account for bpp. Reprensents the pen position on the baseline.
font: Font<'static>
The font in use for this terminal.
cached_glyphs: HashMap<char, GlyphBitmap>
We cache ascii glyphs to avoid rendering them every time.
advance_width: usize
Expected to be the same for every glyph since it should be a monospaced font.
linespace: usize
The distance between two baselines.
ascent: usize
The maximum ascent in the font.
descent: usize
The maximum descent in the font.
Implementations
impl Terminal
[src]
pub fn new(
sharedmem: SharedMemory,
top: i32,
left: i32,
width: u32,
height: u32
) -> Result<Self, Error>
[src]
sharedmem: SharedMemory,
top: i32,
left: i32,
width: u32,
height: u32
) -> Result<Self, Error>
Creates a new Window of the requested size for terminal usage.
pub fn draw(&mut self)
[src]
Ask the compositor to redraw the window.
fn carriage_return(&mut self)
[src]
Move the cursor to the beginning of the current line.
fn line_feed(&mut self)
[src]
Move the cursor to the beginning of the next line, scrolling the screen if necessary.
fn advance_pos(&mut self)
[src]
Move the cursor to the next position for drawing a character, possibly the next line if we need to wrap.
fn move_pos_back(&mut self)
[src]
Move the cursor back to the previous position. If we are already on the first character position on this line, do not move.
fn scroll_screen(&mut self)
[src]
scrolls the whole screen by one line. self.pos must be on last baseline.
pub fn clear(&mut self)
[src]
Clears the whole screen and reset cursor
pub fn print_attr(&mut self, string: &str, fg: Color, bg: Color)
[src]
Prints a string to the screen with attributes
fn display_glyph_in_box(
glyph: &GlyphBitmap,
framebuffer: &Buffer,
box_width: usize,
box_ascent: usize,
box_descent: usize,
fg: Color,
bg: Color,
pos: Pos
)
[src]
glyph: &GlyphBitmap,
framebuffer: &Buffer,
box_width: usize,
box_ascent: usize,
box_descent: usize,
fg: Color,
bg: Color,
pos: Pos
)
Copies a rendered character to the screen, displaying it in a bg colored box
Panics
Panics if pos makes writing the glyph overflow the screen
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Terminal
impl Send for Terminal
impl Sync for Terminal
impl Unpin for Terminal
impl UnwindSafe for Terminal
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SizedIPCBuffer for T
[src]
fn size(&self) -> usize
[src]
fn is_cool(addr: usize, size: usize) -> bool
[src]
unsafe fn from_raw_parts<'a>(addr: usize, _size: usize) -> &'a T
[src]
unsafe fn from_raw_parts_mut<'a>(addr: usize, _size: usize) -> &'a mut T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,