Struct tcod::console::RootInitializer
[−]
[src]
pub struct RootInitializer<'a> { /* fields omitted */ }
Helper struct for the Root
console initialization
This is the type that should be used to initialize the Root
console (either directly or
indirectly, by calling Root::initializer
). It uses method chaining to provide an easy-to-use
interface. It exposes the following configuration options for the Root
console:
size
: this determines the size of the console window in characterstitle
: the main window's titlefullscreen
: determines if the main window will start in fullscreen modefont
: selects a bitmap font and sets its layout. See FontLayout for the possible layouts. Thepath
argument can be astr
,Path
,String
or anything else that implementsAsRef<Path>
.font_type
: only use this if you want to use a greyscale font. See FontType for the possible values.font_dimensions
: the dimensions for the given bitmap font. This is automatically deduced from the font layout, only use this if you really need it (providing wrong values will ruin the font display).renderer
: sets the console renderer. See the Renderer enum for the valid options.
The initializer provides sane defaults even there are no options explicitly specified, but it is recommended to at least set the size and the window title.
Examples
Initializing the Root
console using Root::initializer
instead of explicitly creating a
RootInitializer
instance:
use tcod::console::{Root, FontLayout, Renderer}; fn main() { let mut root = Root::initializer() .size(80, 20) .title("Example") .fullscreen(true) .font("terminal.png", FontLayout::AsciiInCol) .renderer(Renderer::GLSL) .init(); }
Methods
impl<'a> RootInitializer<'a>
[src]
fn new() -> RootInitializer<'a>
fn size(&mut self, width: i32, height: i32) -> &mut RootInitializer<'a>
fn title<T>(&mut self, title: T) -> &mut RootInitializer<'a> where T: AsRef<str> + 'a
fn fullscreen(&mut self, is_fullscreen: bool) -> &mut RootInitializer<'a>
fn font<P>(&mut self,
path: P,
font_layout: FontLayout)
-> &mut RootInitializer<'a> where P: AsRef<Path> + 'a
path: P,
font_layout: FontLayout)
-> &mut RootInitializer<'a> where P: AsRef<Path> + 'a
fn font_type(&mut self, font_type: FontType) -> &mut RootInitializer<'a>
fn font_dimensions(&mut self,
horizontal: i32,
vertical: i32)
-> &mut RootInitializer<'a>
horizontal: i32,
vertical: i32)
-> &mut RootInitializer<'a>