pub struct ContextBuilder { /* private fields */ }
Expand description
A builder object for creating a Context
.
Implementations§
Source§impl ContextBuilder
impl ContextBuilder
Sourcepub fn new(game_id: &str, author: &str) -> Self
pub fn new(game_id: &str, author: &str) -> Self
Create a new ContextBuilder
with default settings.
Sourcepub fn window_setup(self, setup: WindowSetup) -> Self
pub fn window_setup(self, setup: WindowSetup) -> Self
Sets the window setup settings.
Sourcepub fn window_mode(self, mode: WindowMode) -> Self
pub fn window_mode(self, mode: WindowMode) -> Self
Sets the window mode settings.
Sourcepub fn default_conf(self, conf: Conf) -> Self
pub fn default_conf(self, conf: Conf) -> Self
Sets all the config options, overriding any previous
ones from window_setup()
,
window_mode()
, and
backend()
. These are used as
defaults and are overridden by any external config
file found.
Sourcepub fn resources_dir_name(self, new_name: impl Into<PathBuf>) -> Self
pub fn resources_dir_name(self, new_name: impl Into<PathBuf>) -> Self
Sets resources dir name.
Default resources dir name is resources
.
Sourcepub fn resources_zip_name(self, new_name: impl Into<PathBuf>) -> Self
pub fn resources_zip_name(self, new_name: impl Into<PathBuf>) -> Self
Sets resources zip name.
Default resources dir name is resources.zip
.
Sourcepub fn add_resource_path<T>(self, path: T) -> Self
pub fn add_resource_path<T>(self, path: T) -> Self
Add a new read-only filesystem path to the places to search for resources.
Sourcepub fn add_zipfile_bytes<B>(self, bytes: B) -> Self
pub fn add_zipfile_bytes<B>(self, bytes: B) -> Self
Add a new zip file from bytes whose contents will be searched
for resources. The zip file will be stored in-memory.
You can pass it a static slice, a Vec
of bytes, etc.
use ggez::context::ContextBuilder;
let _ = ContextBuilder::new()
.add_zipfile_bytes(include_bytes!("../resources.zip").to_vec())
.build();
Sourcepub fn with_conf_file(self, load_conf_file: bool) -> Self
pub fn with_conf_file(self, load_conf_file: bool) -> Self
Specifies whether or not to load the conf.toml
file if it
exists and use its settings to override the provided values.
Defaults to true
which is usually what you want, but being
able to fiddle with it is sometimes useful for debugging.
Trait Implementations§
Source§impl Clone for ContextBuilder
impl Clone for ContextBuilder
Source§fn clone(&self) -> ContextBuilder
fn clone(&self) -> ContextBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ContextBuilder
impl Debug for ContextBuilder
Source§impl PartialEq for ContextBuilder
impl PartialEq for ContextBuilder
impl StructuralPartialEq for ContextBuilder
Auto Trait Implementations§
impl Freeze for ContextBuilder
impl RefUnwindSafe for ContextBuilder
impl Send for ContextBuilder
impl Sync for ContextBuilder
impl Unpin for ContextBuilder
impl UnwindSafe for ContextBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
Source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more