Struct tcod::console::Root
[−]
[src]
pub struct Root { /* fields omitted */ }
Methods
impl Root
[src]
fn initializer<'a>() -> RootInitializer<'a>
Returns an instance of a RootInitializer object, which can be used to
customize the initialization of the Root console. Note that only
RootInitializer::init
will return the actual Root
console instance.
For a full list of initialization options, see the
RootInitializer documentation.
Examples
use tcod::console::Root; let mut root = Root::initializer() .size(80, 20) .title("Example") .fullscreen(true) .init();
fn is_fullscreen(&self) -> bool
Returns with true when the Root
console is in fullscreen mode.
fn set_fullscreen(&mut self, fullscreen: bool)
Toggles between windowed and fullscreen mode.
fn set_keyboard_repeat(&mut self, initial_delay: i32, interval: i32)
This function changes the keyboard repeat times. The initial delay determines the number of milliseconds between the keypress and the time the keyboard repeat begins. The interval sets the time between the keyboard repeat events. With an initial delay of 0, the keyboard repeat feature is completely disabled.
fn disable_keyboard_repeat(&mut self)
Disables the keyboard repeat feature. Equivalent to set_keyboard_repeat
with an
initial delay of 0.
fn is_active(&self) -> bool
Returns true if the Root
console is currently active.
fn has_focus(&self) -> bool
Returns true if the Root
console has focus.
fn get_fade(&self) -> u8
Returns the current fade amount (previously set by set_fade
).
fn get_fading_color(&self) -> Color
Returns the current fade color (previously set by set_fade
).
fn set_fade(&mut self, fade: u8, fading_color: Color)
This function defines the fading parameters, allowing to easily fade the game screen to/from a color. Once they are defined, the fading parameters are valid for ever. You don't have to call setFade for each rendered frame (unless you change the fading parameters).
fn wait_for_keypress(&mut self, flush: bool) -> Key
This function will wait for a keypress event from the user, returning the KeyState
that represents the event. If flush
is true, all pending keypresses are flushed from the
keyboard buffer. If false, it returns the first element from it.
fn check_for_keypress(&self, status: KeyPressFlags) -> Option<Key>
This function checks if the user pressed a key. It returns the
KeyState representing the
event if they have, or None
if they have not.
fn window_closed(&self) -> bool
Returns with true if the Root
console has been closed.
fn flush(&mut self)
Flushes the contents of the Root
console onto the screen.
fn set_window_title<T>(&mut self, title: T) where T: AsRef<str>
Sets the main window's title to the string specified in the argument.
fn render_credits(&self, x: i32, y: i32, alpha: bool) -> bool
Embeds libtcod credits in a console. Returns true when the credits screen is finished.
Trait Implementations
impl AsNative<TCOD_console_t> for Root
[src]
unsafe fn as_native(&self) -> &TCOD_console_t
impl Console for Root
[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