[−][src]Struct tetra::ContextBuilder
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]
&mut self,
width: i32,
height: i32
) -> &mut ContextBuilder<'a>
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]
&mut self,
quit_on_escape: bool
) -> &mut ContextBuilder<'a>
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(&self) -> 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]
fn default() -> 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.