pub struct EngineBuilder { /* private fields */ }
Expand description
Implementations§
Source§impl EngineBuilder
impl EngineBuilder
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 dimensions(&mut self, width: u32, height: u32) -> &mut Self
pub fn 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 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 show_frame_rate(&mut self) -> &mut Self
pub fn show_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
[Engine::on_update
] is called.
Sourcepub fn texture_cache(&mut self, size: NonZeroUsize) -> &mut Self
pub fn texture_cache(&mut self, size: NonZeroUsize) -> &mut Self
Set a custom texture cache size other than the default of 20
.
Affects font family and image rendering caching operations.
Sourcepub fn text_cache(&mut self, size: NonZeroUsize) -> &mut Self
pub fn text_cache(&mut self, size: NonZeroUsize) -> &mut Self
Set a custom text cache size other than the default of 500
.
Affects text rendering caching operations.
Sourcepub fn build(&self) -> PixResult<Engine>
pub fn build(&self) -> PixResult<Engine>
Convert EngineBuilder to a Engine
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.