Struct tetra::ContextBuilder
source · pub struct ContextBuilder<'a> { /* private fields */ }
Expand description
Creates a new Context
based on the provided options.
Implementations§
source§impl<'a> ContextBuilder<'a>
impl<'a> ContextBuilder<'a>
sourcepub fn new(title: &'a str, width: i32, height: i32) -> ContextBuilder<'a>
pub fn new(title: &'a str, width: i32, height: i32) -> ContextBuilder<'a>
Creates a new ContextBuilder.
sourcepub fn title(&mut self, title: &'a str) -> &mut ContextBuilder<'a>
pub fn title(&mut self, title: &'a str) -> &mut ContextBuilder<'a>
Sets the title of the window.
Defaults to "Tetra"
.
sourcepub fn size(&mut self, width: i32, height: i32) -> &mut ContextBuilder<'a>
pub fn size(&mut self, width: i32, height: i32) -> &mut ContextBuilder<'a>
Sets the internal resolution of the screen.
Defaults to 1280 x 720
.
sourcepub fn scaling(&mut self, scaling: ScreenScaling) -> &mut ContextBuilder<'a>
pub fn scaling(&mut self, scaling: ScreenScaling) -> &mut ContextBuilder<'a>
Sets the scaling mode for the game.
Defaults to ScreenScaling::ShowAllPixelPerfect
, which will maintain the screen’s aspect ratio
by letterboxing.
sourcepub fn window_size(&mut self, width: i32, height: i32) -> &mut ContextBuilder<'a>
pub fn window_size(&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
.
sourcepub fn window_scale(&mut self, scale: i32) -> &mut ContextBuilder<'a>
pub fn window_scale(&mut self, scale: i32) -> &mut ContextBuilder<'a>
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.
sourcepub fn vsync(&mut self, vsync: bool) -> &mut ContextBuilder<'a>
pub fn vsync(&mut self, vsync: bool) -> &mut ContextBuilder<'a>
Enables or disables vsync.
Defaults to true
.
sourcepub fn tick_rate(&mut self, tick_rate: f64) -> &mut ContextBuilder<'a>
pub fn tick_rate(&mut self, tick_rate: f64) -> &mut ContextBuilder<'a>
Sets the game’s update tick rate, in ticks per second.
Defaults to 60.0
.
sourcepub fn fullscreen(&mut self, fullscreen: bool) -> &mut ContextBuilder<'a>
pub fn fullscreen(&mut self, fullscreen: bool) -> &mut ContextBuilder<'a>
Sets whether or not the window should start in fullscreen.
Defaults to false
.
sourcepub fn maximized(&mut self, maximized: bool) -> &mut ContextBuilder<'a>
pub fn maximized(&mut self, maximized: bool) -> &mut ContextBuilder<'a>
Sets whether or not the window should start maximized.
Defaults to false
.
sourcepub fn minimized(&mut self, minimized: bool) -> &mut ContextBuilder<'a>
pub fn minimized(&mut self, minimized: bool) -> &mut ContextBuilder<'a>
Sets whether or not the window should start minimized.
Defaults to false
.
sourcepub fn resizable(&mut self, resizable: bool) -> &mut ContextBuilder<'a>
pub fn resizable(&mut self, resizable: bool) -> &mut ContextBuilder<'a>
Sets whether or not the window should be resizable.
Defaults to false
.
sourcepub fn borderless(&mut self, borderless: bool) -> &mut ContextBuilder<'a>
pub fn borderless(&mut self, borderless: bool) -> &mut ContextBuilder<'a>
Sets whether or not the window should be borderless.
Defaults to false
.
sourcepub fn show_mouse(&mut self, show_mouse: bool) -> &mut ContextBuilder<'a>
pub fn show_mouse(&mut self, show_mouse: bool) -> &mut ContextBuilder<'a>
Sets whether or not the mouse cursor should be visible.
Defaults to false
.
sourcepub fn quit_on_escape(&mut self, quit_on_escape: bool) -> &mut ContextBuilder<'a>
pub fn quit_on_escape(&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
.
Trait Implementations§
source§impl<'a> Clone for ContextBuilder<'a>
impl<'a> Clone for ContextBuilder<'a>
source§fn clone(&self) -> ContextBuilder<'a>
fn clone(&self) -> ContextBuilder<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for ContextBuilder<'a>
impl<'a> Debug for ContextBuilder<'a>
source§impl<'a> Default for ContextBuilder<'a>
impl<'a> Default for ContextBuilder<'a>
source§fn default() -> ContextBuilder<'a>
fn default() -> ContextBuilder<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for ContextBuilder<'a>
impl<'a> Send for ContextBuilder<'a>
impl<'a> Sync for ContextBuilder<'a>
impl<'a> Unpin for ContextBuilder<'a>
impl<'a> UnwindSafe for ContextBuilder<'a>
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SetParameter for T
impl<T> SetParameter for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.