Struct tcod::console::Offscreen
[−]
[src]
pub struct Offscreen { /* fields omitted */ }
A type representing secondary consoles
Offscreen
consoles allow you draw on secondary consoles as you would on Root
consoles, and then
blit
their contents onto other consoles (including Root
). There are some limitations
compared to Root
consoles, however:
- Functions manipulating the main window or handling user input are limited to the
Root
console Offscreen
consoles may not beflushed
to the screen directly
Examples
Creating an Offscreen
console
use tcod::console::Offscreen; let width = 80; let height = 20; let offscreen = Offscreen::new(width, height);
Blitting an Offscreen
console to the Root
console:
use tcod::console as console; use tcod::console::{Root, Offscreen}; fn main() { let mut root = Root::initializer().init(); let mut direct = Offscreen::new(20, 20); console::blit(&direct, (0, 0), (20, 20), &mut root, (0, 0), 1.0, 1.0); }
See the documentation for blit for a detailed description of the function parameters and a more in-depth example.
Methods
impl Offscreen
[src]
Trait Implementations
impl Drop for Offscreen
[src]
impl AsNative<TCOD_console_t> for Offscreen
[src]
unsafe fn as_native(&self) -> &TCOD_console_t
impl Console for Offscreen
[src]
fn get_alignment(&self) -> TextAlignment
Returns the default text alignment for the Console
instance. For all the possible text alignment options, see the documentation for TextAlignment. Read more
fn set_alignment(&mut self, alignment: TextAlignment)
Sets the default text alignment for the console. For all the possible text alignment options, see the documentation for TextAlignment. Read more
fn set_key_color(&mut self, color: Color)
Sets a key color that will be ignored when blitting the contents of this console onto an other (essentially a transparent background color). Read more
fn width(&self) -> i32
Returns the width of the console in characters.
fn height(&self) -> i32
Returns the height of the console in characters.
fn get_default_background(&mut self) -> Color
Return the console's default background color. This is used in several other methods, like: clear
, put_char
, etc. Read more
fn set_default_background(&mut self, color: Color)
Sets the console's default background color. This is used in several other methods, like: clear
, put_char
, etc. Read more
fn set_default_foreground(&mut self, color: Color)
Sets the console's default foreground color. This is used in several printing functions.
fn get_char_background(&self, x: i32, y: i32) -> Color
Returns the background color of the cell at the specified coordinates.
fn get_char_foreground(&self, x: i32, y: i32) -> Color
Returns the foreground color of the cell at the specified coordinates.
fn get_background_flag(&self) -> BackgroundFlag
Returns the console's current background flag. For a detailed explanation of the possible values, see BackgroundFlag. Read more
fn set_background_flag(&mut self, background_flag: BackgroundFlag)
Sets the console's current background flag. For a detailed explanation of the possible values, see BackgroundFlag. Read more
fn get_char(&self, x: i32, y: i32) -> char
Returns the ASCII value of the cell located at x, y
fn set_char(&mut self, x: i32, y: i32, c: char)
Modifies the ASCII value of the cell located at x, y
.
fn set_char_background(&mut self,
x: i32,
y: i32,
color: Color,
background_flag: BackgroundFlag)
x: i32,
y: i32,
color: Color,
background_flag: BackgroundFlag)
Changes the background color of the specified cell
fn set_char_foreground(&mut self, x: i32, y: i32, color: Color)
Changes the foreground color of the specified cell
fn put_char(&mut self,
x: i32,
y: i32,
glyph: char,
background_flag: BackgroundFlag)
x: i32,
y: i32,
glyph: char,
background_flag: BackgroundFlag)
This function modifies every property of the given cell: Read more
fn put_char_ex(&mut self,
x: i32,
y: i32,
glyph: char,
foreground: Color,
background: Color)
x: i32,
y: i32,
glyph: char,
foreground: Color,
background: Color)
Updates every propert of the given cell using explicit colors for the background and foreground. Read more
fn clear(&mut self)
Clears the console with its default background color
fn print<T>(&mut self, x: i32, y: i32, text: T) where Self: Sized, T: AsRef<[u8]> + TcodString
Prints the text at the specified location. The position of the x
and y
coordinates depend on the TextAlignment set in the console: Read more
fn print_rect<T>(&mut self, x: i32, y: i32, width: i32, height: i32, text: T) where Self: Sized, T: AsRef<[u8]> + TcodString
Prints the text at the specified location in a rectangular area with the dimensions: (width; height). If the text is longer than the width the newlines will be inserted. Read more
fn print_ex<T>(&mut self,
x: i32,
y: i32,
background_flag: BackgroundFlag,
alignment: TextAlignment,
text: T) where Self: Sized, T: AsRef<[u8]> + TcodString
x: i32,
y: i32,
background_flag: BackgroundFlag,
alignment: TextAlignment,
text: T) where Self: Sized, T: AsRef<[u8]> + TcodString
Prints the text at the specified location with an explicit BackgroundFlag and TextAlignment. Read more
fn print_rect_ex<T>(&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
background_flag: BackgroundFlag,
alignment: TextAlignment,
text: T) where Self: Sized, T: AsRef<[u8]> + TcodString
x: i32,
y: i32,
width: i32,
height: i32,
background_flag: BackgroundFlag,
alignment: TextAlignment,
text: T) where Self: Sized, T: AsRef<[u8]> + TcodString
Combines the functions of print_ex
and print_rect
fn get_height_rect<T>(&self,
x: i32,
y: i32,
width: i32,
height: i32,
text: T)
-> i32 where Self: Sized, T: AsRef<[u8]> + TcodString
x: i32,
y: i32,
width: i32,
height: i32,
text: T)
-> i32 where Self: Sized, T: AsRef<[u8]> + TcodString
Compute the height of a wrapped text printed using print_rect
or print_rect_ex
.
fn rect(&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
clear: bool,
background_flag: BackgroundFlag)
x: i32,
y: i32,
width: i32,
height: i32,
clear: bool,
background_flag: BackgroundFlag)
Fill a rectangle with the default background colour. Read more
fn horizontal_line(&mut self,
x: i32,
y: i32,
length: i32,
background_flag: BackgroundFlag)
x: i32,
y: i32,
length: i32,
background_flag: BackgroundFlag)
Draw a horizontal line. Read more
fn vertical_line(&mut self,
x: i32,
y: i32,
length: i32,
background_flag: BackgroundFlag)
x: i32,
y: i32,
length: i32,
background_flag: BackgroundFlag)
Draw a vertical line. Read more
fn print_frame<T>(&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
clear: bool,
background_flag: BackgroundFlag,
title: Option<T>) where Self: Sized, T: AsRef<str>
x: i32,
y: i32,
width: i32,
height: i32,
clear: bool,
background_flag: BackgroundFlag,
title: Option<T>) where Self: Sized, T: AsRef<str>
Draw a window frame with an optional title. Read more