Struct ggez::context::ContextBuilder
source · [−]pub struct ContextBuilder { /* private fields */ }
Expand description
A builder object for creating a Context
.
Implementations
sourceimpl 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 ToString) -> Self
pub fn resources_dir_name(self, new_name: impl ToString) -> Self
Sets resources dir name.
Default resources dir name is resources
.
sourcepub fn resources_zip_name(self, new_name: impl ToString) -> Self
pub fn resources_zip_name(self, new_name: impl ToString) -> Self
Sets resources zip name.
Default resources dir name is resources.zip
.
sourcepub fn add_resource_path<T>(self, path: T) -> Selfwhere
T: Into<PathBuf>,
pub fn add_resource_path<T>(self, path: T) -> Selfwhere
T: Into<PathBuf>,
Add a new read-only filesystem path to the places to search for resources.
sourcepub fn add_zipfile_bytes<B>(self, bytes: B) -> Selfwhere
B: Into<Cow<'static, [u8]>>,
pub fn add_zipfile_bytes<B>(self, bytes: B) -> Selfwhere
B: Into<Cow<'static, [u8]>>,
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
sourceimpl Clone for ContextBuilder
impl Clone for ContextBuilder
sourcefn clone(&self) -> ContextBuilder
fn clone(&self) -> ContextBuilder
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more