[][src]Struct tcod::console::RootInitializer

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 characters
  • title: the main window's title
  • fullscreen: determines if the main window will start in fullscreen mode
  • font: selects a bitmap font and sets its layout. See FontLayout for the possible layouts. The path argument can be a str, Path, String or anything else that implements AsRef<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]

pub fn new() -> RootInitializer<'a>[src]

pub fn size(&mut self, width: i32, height: i32) -> &mut RootInitializer<'a>[src]

pub fn title<T>(&mut self, title: T) -> &mut RootInitializer<'a> where
    T: AsRef<str> + 'a, 
[src]

pub fn fullscreen(&mut self, is_fullscreen: bool) -> &mut RootInitializer<'a>[src]

pub fn font<P>(
    &mut self,
    path: P,
    font_layout: FontLayout
) -> &mut RootInitializer<'a> where
    P: AsRef<Path> + 'a, 
[src]

pub fn font_type(&mut self, font_type: FontType) -> &mut RootInitializer<'a>[src]

pub fn font_dimensions(
    &mut self,
    horizontal: i32,
    vertical: i32
) -> &mut RootInitializer<'a>
[src]

pub fn renderer(&mut self, renderer: Renderer) -> &mut RootInitializer<'a>[src]

pub fn init(&self) -> Root[src]

Auto Trait Implementations

impl<'a> !Send for RootInitializer<'a>

impl<'a> !Sync for RootInitializer<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]