[−][src]Struct tcod::console::RootInitializer
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]
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]
T: AsRef<str> + 'a,
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]
&mut self,
path: P,
font_layout: FontLayout
) -> &mut RootInitializer<'a> where
P: AsRef<Path> + 'a,
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]
&mut self,
horizontal: i32,
vertical: i32
) -> &mut RootInitializer<'a>
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]
U: From<T>,
impl<T> From<T> for T
[src]
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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,