[−]Struct rltk::VirtualConsole
Fields
width: u32
height: u32
tiles: Vec<Tile>
extra_clipping: Option<Rect>
translation: CharacterTranslationMode
Methods
impl VirtualConsole
pub fn new(dimensions: Point) -> VirtualConsole
Creates a new virtual console of arbitrary dimensions.
pub fn from_text(text: &str, width: usize) -> VirtualConsole
Creates a new virtual console from a blob of text. Useful if you want to scroll through manuals!
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.
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
impl Console for VirtualConsole
fn get_char_size(&self) -> (u32, u32)
fn resize_pixels(&mut self, _width: u32, _height: u32)
fn at(&self, x: i32, y: i32) -> usize
Translate an x/y into an array index.
fn cls(&mut self)
Clears the screen.
fn cls_bg(&mut self, background: RGBA)
Clears the screen with a background color.
fn print(&mut self, x: i32, y: i32, output: &str)
Prints a string at x/y.
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.
fn set(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, glyph: u16)
Sets a single cell in the console
fn set_bg(&mut self, x: i32, y: i32, bg: RGBA)
Sets a single cell in the console's background
fn draw_box(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
&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
fn draw_hollow_box(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
&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
fn draw_box_double(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
&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
fn draw_hollow_box_double(
&mut self,
sx: i32,
sy: i32,
width: i32,
height: i32,
fg: RGBA,
bg: RGBA
)
&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
fn fill_region(&mut self, target: Rect, glyph: u16, fg: RGBA, bg: RGBA)
Fills a rectangle with the specified rendering information
fn draw_bar_horizontal(
&mut self,
sx: i32,
sy: i32,
width: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
&mut self,
sx: i32,
sy: i32,
width: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
Draws a horizontal progress bar
fn draw_bar_vertical(
&mut self,
sx: i32,
sy: i32,
height: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
&mut self,
sx: i32,
sy: i32,
height: i32,
n: i32,
max: i32,
fg: RGBA,
bg: RGBA
)
Draws a vertical progress bar
fn print_centered(&mut self, y: i32, text: &str)
Prints text, centered to the whole console width, at vertical location y.
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.
fn print_centered_at(&mut self, x: i32, y: i32, text: &str)
Prints text, centered to the whole console width, at vertical location y.
fn print_color_centered_at(
&mut self,
x: i32,
y: i32,
fg: RGBA,
bg: RGBA,
text: &str
)
&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.
fn print_right(&mut self, x: i32, y: i32, text: &str)
Prints text right-aligned
fn print_color_right(&mut self, x: i32, y: i32, fg: RGBA, bg: RGBA, text: &str)
Prints colored text right-aligned
fn printer(
&mut self,
x: i32,
y: i32,
output: &str,
align: TextAlign,
background: Option<RGBA>
)
&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.
fn to_xp_layer(&self) -> XpLayer
Saves the layer to an XpFile structure
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.
fn set_scale(&mut self, _scale: f32, _center_x: i32, _center_y: i32)
fn get_scale(&self) -> (f32, i32, i32)
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.
fn get_clipping(&self) -> Option<Rect>
Returns the current arbitrary clipping rectangle, None if there isn't one.
fn set_all_fg_alpha(&mut self, alpha: f32)
Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).
fn set_all_bg_alpha(&mut self, alpha: f32)
Sets ALL tiles background alpha (only tiles that exist, in sparse consoles).
fn set_all_alpha(&mut self, fg: f32, bg: f32)
Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).
fn set_translation_mode(&mut self, mode: CharacterTranslationMode)
Sets the character translation mode
fn set_char_size(&mut self, _width: u32, _height: u32)
Sets the character size of the terminal
fn in_bounds(&self, x: i32, y: i32) -> bool
fn try_at(&self, x: i32, y: i32) -> Option<usize>
Auto Trait Implementations
impl RefUnwindSafe for VirtualConsole
impl Send for VirtualConsole
impl Sync for VirtualConsole
impl Unpin for VirtualConsole
impl UnwindSafe for VirtualConsole
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, 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,