Struct bracket_terminal::prelude::VirtualConsole
source · [−]pub struct VirtualConsole {
pub width: u32,
pub height: u32,
pub tiles: Vec<Tile>,
pub extra_clipping: Option<Rect>,
pub translation: CharacterTranslationMode,
}
Fields
width: u32
height: u32
tiles: Vec<Tile>
extra_clipping: Option<Rect>
translation: CharacterTranslationMode
Implementations
sourceimpl VirtualConsole
impl VirtualConsole
sourcepub fn from_text(text: &str, width: usize) -> Self
pub fn from_text(text: &str, width: usize) -> Self
Creates a new virtual console from a blob of text. Useful if you want to scroll through manuals!
sourcepub fn print_sub_rect(&self, source: Rect, dest: Rect, target: &mut BTerm)
pub fn print_sub_rect(&self, source: Rect, dest: Rect, target: &mut BTerm)
Send a portion of the Virtual Console to a physical console, specifying both source and destination rectangles and the target console.
sourcepub fn batch_sub_rect(&self, source: Rect, dest: Rect, target: &mut DrawBatch)
pub fn batch_sub_rect(&self, source: Rect, dest: Rect, target: &mut DrawBatch)
Send a portion of the Virtual Console to a render batch, specifying both source and destination rectangles and the target batch.
Trait Implementations
sourceimpl Console for VirtualConsole
impl Console for VirtualConsole
sourcefn print_color(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, output: &str)
fn print_color(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, output: &str)
Prints a string at x/y, with foreground and background colors.
sourcefn set(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, glyph: FontCharType)
fn set(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, glyph: FontCharType)
Sets a single cell in the console
sourcefn draw_box(&mut self, sx: i32, sy: i32, width: i32, height: i32, fg: RGBA, bg: RGBA)
fn draw_box(&mut self, sx: i32, sy: i32, width: i32, height: i32, fg: RGBA, bg: RGBA)
Draws a box, starting at x/y with the extents width/height using CP437 line characters
sourcefn draw_hollow_box(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
fn draw_hollow_box(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
Draws a box, starting at x/y with the extents width/height using CP437 line characters
sourcefn draw_box_double(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
fn draw_box_double(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
Draws a box, starting at x/y with the extents width/height using CP437 double line characters
sourcefn draw_hollow_box_double(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
fn draw_hollow_box_double(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
Draws a box, starting at x/y with the extents width/height using CP437 double line characters
sourcefn fill_region(&mut self, target: Rect, glyph: FontCharType, fg: RGBA, bg: RGBA)
fn fill_region(&mut self, target: Rect, glyph: FontCharType, fg: RGBA, bg: RGBA)
Fills a rectangle with the specified rendering information
sourcefn draw_bar_horizontal(
&mut self,
sx: i32,
sy: i32,
width: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
fn draw_bar_horizontal(
&mut self,
sx: i32,
sy: i32,
width: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
Draws a horizontal progress bar
sourcefn draw_bar_vertical(
&mut self,
sx: i32,
sy: i32,
height: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
fn draw_bar_vertical(
&mut self,
sx: i32,
sy: i32,
height: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
Draws a vertical progress bar
sourcefn print_centered(&mut self, y: i32, text: &str)
fn print_centered(&mut self, y: i32, text: &str)
Prints text, centered to the whole console width, at vertical location y.
sourcefn print_color_centered(&mut self, y: i32, fg: RGBA, bg: RGBA, text: &str)
fn print_color_centered(&mut self, y: i32, fg: RGBA, bg: RGBA, text: &str)
Prints text in color, centered to the whole console width, at vertical location y.
sourcefn print_centered_at(&mut self, x: i32, y: i32, text: &str)
fn print_centered_at(&mut self, x: i32, y: i32, text: &str)
Prints text, centered to the whole console width, at vertical location y.
sourcefn print_color_centered_at(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, text: &str)
fn print_color_centered_at(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, text: &str)
Prints text in color, centered to the whole console width, at vertical location y.
sourcefn print_right(&mut self, x: i32, y: i32, text: &str)
fn print_right(&mut self, x: i32, y: i32, text: &str)
Prints text right-aligned
sourcefn print_color_right(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, text: &str)
fn print_color_right(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, text: &str)
Prints colored text right-aligned
sourcefn printer(
&mut self,
x: i32,
y: i32,
output: &str,
align: TextAlign,
background: Option<RGBA>
)
fn printer(
&mut self,
x: i32,
y: i32,
output: &str,
align: TextAlign,
background: Option<RGBA>
)
Print a colorized string with the color encoding defined inline. For example: printer(1, 1, “#[blue]This blue text contains a #[pink]pink#[] word”) You can get the same effect with a TextBlock, but this can be easier. Thanks to doryen_rs for the idea.
sourcefn to_xp_layer(&self) -> XpLayer
fn to_xp_layer(&self) -> XpLayer
Saves the layer to an XpFile structure
sourcefn set_offset(&mut self, _x: f32, _y: f32)
fn set_offset(&mut self, _x: f32, _y: f32)
Sets an offset to total console rendering, useful for layers that draw between tiles. Offsets are specified as a percentage of total character size; so -0.5 will offset half a character to the left/top.
sourcefn set_clipping(&mut self, clipping: Option<Rect>)
fn set_clipping(&mut self, clipping: Option<Rect>)
Permits the creation of an arbitrary clipping rectangle. It’s a really good idea to make sure that this rectangle is entirely valid.
sourcefn get_clipping(&self) -> Option<Rect>
fn get_clipping(&self) -> Option<Rect>
Returns the current arbitrary clipping rectangle, None if there isn’t one.
sourcefn set_all_fg_alpha(&mut self, alpha: f32)
fn set_all_fg_alpha(&mut self, alpha: f32)
Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).
sourcefn set_all_bg_alpha(&mut self, alpha: f32)
fn set_all_bg_alpha(&mut self, alpha: f32)
Sets ALL tiles background alpha (only tiles that exist, in sparse consoles).
sourcefn set_all_alpha(&mut self, fg: f32, bg: f32)
fn set_all_alpha(&mut self, fg: f32, bg: f32)
Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).
sourcefn set_translation_mode(&mut self, mode: CharacterTranslationMode)
fn set_translation_mode(&mut self, mode: CharacterTranslationMode)
Sets the character translation mode
sourcefn set_char_size(&mut self, _width: u32, _height: u32)
fn set_char_size(&mut self, _width: u32, _height: u32)
Sets the character size of the terminal