[][src]Struct tetra::ContextBuilder

pub struct ContextBuilder<'a> { /* fields omitted */ }

Creates a new Context based on the provided options.

Methods

impl<'a> ContextBuilder<'a>[src]

pub fn new(title: &'a str, width: i32, height: i32) -> ContextBuilder<'a>[src]

Creates a new ContextBuilder.

pub fn title(&mut self, title: &'a str) -> &mut ContextBuilder<'a>[src]

Sets the title of the window.

Defaults to "Tetra".

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

Sets the internal resolution of the screen.

Defaults to 1280 x 720.

pub fn scaling(&mut self, scaling: ScreenScaling) -> &mut ContextBuilder<'a>[src]

Sets the scaling mode for the game.

Defaults to ScreenScaling::ShowAllPixelPerfect, which will maintain the screen's aspect ratio by letterboxing.

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

Sets the size of the window.

This only needs to be set if you want the internal resolution of the game to be different from the window size.

This will take precedence over window_scale.

pub fn window_scale(&mut self, scale: i32) -> &mut ContextBuilder<'a>[src]

Sets the size of the window, as a multiplier of the internal screen size.

This only needs to be set if you want the internal resolution of the game to be different from the window size.

window_size will take precedence over this.

pub fn vsync(&mut self, vsync: bool) -> &mut ContextBuilder<'a>[src]

Enables or disables vsync.

Defaults to true.

pub fn tick_rate(&mut self, tick_rate: f64) -> &mut ContextBuilder<'a>[src]

Sets the game's update tick rate, in ticks per second.

Defaults to 60.0.

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

Sets whether or not the window should start in fullscreen.

Defaults to false.

pub fn maximized(&mut self, maximized: bool) -> &mut ContextBuilder<'a>[src]

Sets whether or not the window should start maximized.

Defaults to false.

pub fn minimized(&mut self, minimized: bool) -> &mut ContextBuilder<'a>[src]

Sets whether or not the window should start minimized.

Defaults to false.

pub fn resizable(&mut self, resizable: bool) -> &mut ContextBuilder<'a>[src]

Sets whether or not the window should be resizable.

Defaults to false.

pub fn borderless(&mut self, borderless: bool) -> &mut ContextBuilder<'a>[src]

Sets whether or not the window should be borderless.

Defaults to false.

pub fn show_mouse(&mut self, show_mouse: bool) -> &mut ContextBuilder<'a>[src]

Sets whether or not the mouse cursor should be visible.

Defaults to false.

pub fn quit_on_escape(
    &mut self,
    quit_on_escape: bool
) -> &mut ContextBuilder<'a>
[src]

Sets whether or not the game should close when the Escape key is pressed.

Defaults to false.

pub fn build(&self) -> Result<Context>[src]

Builds the context.

Errors

If an error is encountered during initialization of the context, this method will return the error. This will usually be either TetraError::Sdl or TetraError::OpenGl.

Trait Implementations

impl<'a> Clone for ContextBuilder<'a>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Default for ContextBuilder<'a>[src]

impl<'a> Debug for ContextBuilder<'a>[src]

Auto Trait Implementations

impl<'a> Send for ContextBuilder<'a>

impl<'a> Sync for ContextBuilder<'a>

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.