Struct pix_engine::engine::Builder
source · [−]pub struct Builder { /* private fields */ }
Expand description
Implementations
sourceimpl Builder
impl Builder
sourcepub fn with_title<S>(&mut self, title: S) -> &mut Self where
S: Into<String>,
pub fn with_title<S>(&mut self, title: S) -> &mut Self where
S: Into<String>,
Set a window title.
sourcepub fn with_font_size(&mut self, size: u32) -> &mut Self
pub fn with_font_size(&mut self, size: u32) -> &mut Self
Set font size for text rendering.
sourcepub fn with_theme(&mut self, theme: Theme) -> &mut Self
pub fn with_theme(&mut self, theme: Theme) -> &mut Self
Set theme for UI rendering.
sourcepub fn position(&mut self, x: i32, y: i32) -> &mut Self
pub fn position(&mut self, x: i32, y: i32) -> &mut Self
Position the window at the given (x, y)
coordinates of the display.
sourcepub fn position_centered(&mut self) -> &mut Self
pub fn position_centered(&mut self) -> &mut Self
Position the window in the center of the display. This is the default.
sourcepub fn with_dimensions(&mut self, width: u32, height: u32) -> &mut Self
pub fn with_dimensions(&mut self, width: u32, height: u32) -> &mut Self
Set window dimensions.
sourcepub fn scale(&mut self, x: f32, y: f32) -> &mut Self
pub fn scale(&mut self, x: f32, y: f32) -> &mut Self
Set the rendering scale of the current canvas. Drawing coordinates are scaled by x/y factors before being drawn to the canvas.
sourcepub fn audio_sample_rate(&mut self, sample_rate: i32) -> &mut Self
pub fn audio_sample_rate(&mut self, sample_rate: i32) -> &mut Self
Set audio sample rate in Hz (samples per second). Defaults to device fallback sample rate.
sourcepub fn audio_channels(&mut self, channels: u8) -> &mut Self
pub fn audio_channels(&mut self, channels: u8) -> &mut Self
Set number of audio channels (1 for Mono, 2 for Stereo, etc). Defaults to device fallback number of channels.
sourcepub fn audio_buffer_size(&mut self, buffer_size: u16) -> &mut Self
pub fn audio_buffer_size(&mut self, buffer_size: u16) -> &mut Self
Set audio buffer size in samples. Defaults to device fallback sample size.
sourcepub fn fullscreen(&mut self) -> &mut Self
pub fn fullscreen(&mut self) -> &mut Self
Start window in fullscreen mode.
sourcepub fn vsync_enabled(&mut self) -> &mut Self
pub fn vsync_enabled(&mut self) -> &mut Self
Set the window to synchronize frame rate to the screens refresh rate (VSync
).
sourcepub fn borderless(&mut self) -> &mut Self
pub fn borderless(&mut self) -> &mut Self
Removes the window decoration.
sourcepub fn with_deadzone(&mut self, value: i32) -> &mut Self
pub fn with_deadzone(&mut self, value: i32) -> &mut Self
Alter the joystick axis deadzone.
sourcepub fn allow_highdpi(&mut self) -> &mut Self
pub fn allow_highdpi(&mut self) -> &mut Self
Enables high-DPI on displays that support it.
Starts engine with window hidden.
sourcepub fn with_frame_rate(&mut self) -> &mut Self
pub fn with_frame_rate(&mut self) -> &mut Self
Enable average frame rate (FPS) in title.
sourcepub fn target_frame_rate(&mut self, rate: usize) -> &mut Self
pub fn target_frame_rate(&mut self, rate: usize) -> &mut Self
Set a target frame rate to render at, controls how often
AppState::on_update
is called.
sourcepub fn with_texture_cache(&mut self, size: usize) -> &mut Self
pub fn with_texture_cache(&mut self, size: usize) -> &mut Self
Set a custom texture cache size other than the default of 20
.
Affects font family and image rendering caching operations.
sourcepub fn with_text_cache(&mut self, size: usize) -> &mut Self
pub fn with_text_cache(&mut self, size: usize) -> &mut Self
Set a custom text cache size other than the default of 500
.
Affects text rendering caching operations.
sourcepub fn build(&self) -> PixResult<PixEngine>
pub fn build(&self) -> PixResult<PixEngine>
Convert Builder to a PixEngine
instance.
Errors
If the engine fails to create a new renderer, then an error is returned.
Possible errors include the title containing a nul
character, the position or dimensions
being invalid values or overlowing and an internal renderer error such as running out of
memory or a software driver issue.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more