pub struct GameInstance {
pub fixed_delta_time: f32,
pub unfocused_fixed_delta_time_scale: f32,
pub color_shader: &'static str,
pub image_shader: &'static str,
pub text_shader: &'static str,
pub input_maintain_on_fixed_step: bool,
/* private fields */
}Fields§
§fixed_delta_time: f32§unfocused_fixed_delta_time_scale: f32§color_shader: &'static str§image_shader: &'static str§text_shader: &'static str§input_maintain_on_fixed_step: boolImplementations§
Source§impl GameInstance
impl GameInstance
Sourcepub fn new(state: impl GameState + 'static) -> Self
pub fn new(state: impl GameState + 'static) -> Self
Sourcepub fn with_editor(self, editor: Editor) -> Self
pub fn with_editor(self, editor: Editor) -> Self
Examples found in repository?
examples/editable.rs (lines 39-43)
29fn main() -> Result<(), Box<dyn Error>> {
30 GameLauncher::new(
31 GameInstance::new(Preloader)
32 .setup_assets(|assets| {
33 *assets = make_directory_database("./resources/").unwrap();
34 })
35 .setup(|instance| {
36 #[cfg(feature = "editor")]
37 {
38 use quaso::editor::ui::editor_game_edit;
39 instance.with_editor(
40 Editor::default()
41 .with_gui_drawer(editor_game_edit)
42 .show_editor_while_running(false),
43 )
44 }
45 #[cfg(not(feature = "editor"))]
46 instance
47 }),
48 )
49 .title("Editable")
50 .config(Config::load_from_file("./resources/GameConfig.toml")?)
51 .run();
52 Ok(())
53}pub fn with_fixed_time_step(self, value: f32) -> Self
pub fn with_fps(self, frames_per_second: usize) -> Self
Sourcepub fn with_unfocused_fixed_time_step_scale(self, value: f32) -> Self
pub fn with_unfocused_fixed_time_step_scale(self, value: f32) -> Self
Examples found in repository?
examples/pcg_island.rs (line 50)
47fn main() -> Result<(), Box<dyn Error>> {
48 GameLauncher::new(
49 GameInstance::new(State::default())
50 .with_unfocused_fixed_time_step_scale(15.0)
51 .setup_assets(|assets| {
52 *assets = make_directory_database("./resources/").unwrap();
53 }),
54 )
55 .title("Procedural Content Generator - Island")
56 .config(Config::load_from_file("./resources/GameConfig.toml")?)
57 .run();
58 Ok(())
59}pub fn with_color_shader(self, name: &'static str) -> Self
pub fn with_image_shader(self, name: &'static str) -> Self
pub fn with_text_shader(self, name: &'static str) -> Self
pub fn with_input_maintain_on_fixed_step(self, value: bool) -> Self
pub fn with_subsystem(self, subsystem: impl GameSubsystem + 'static) -> Self
pub fn with_globals<T: 'static>(self, value: T) -> Self
pub fn with_jobs(self, jobs: Jobs) -> Self
pub fn with_jobs_unnamed_worker(self, iteration_timeout: Duration) -> Self
pub fn with_jobs_named_worker( self, iteration_timeout: Duration, name: impl ToString, ) -> Self
pub fn with_network(self, network: GameNetwork) -> Self
pub fn with_gamepads(self) -> Self
pub fn with_gamepads_custom(self, gamepads: Gilrs) -> Self
Sourcepub fn setup_assets(self, f: impl FnOnce(&mut AssetDatabase)) -> Self
pub fn setup_assets(self, f: impl FnOnce(&mut AssetDatabase)) -> Self
Sourcepub fn setup(self, f: impl FnOnce(Self) -> Self) -> Self
pub fn setup(self, f: impl FnOnce(Self) -> Self) -> Self
Examples found in repository?
examples/editable.rs (lines 35-47)
29fn main() -> Result<(), Box<dyn Error>> {
30 GameLauncher::new(
31 GameInstance::new(Preloader)
32 .setup_assets(|assets| {
33 *assets = make_directory_database("./resources/").unwrap();
34 })
35 .setup(|instance| {
36 #[cfg(feature = "editor")]
37 {
38 use quaso::editor::ui::editor_game_edit;
39 instance.with_editor(
40 Editor::default()
41 .with_gui_drawer(editor_game_edit)
42 .show_editor_while_running(false),
43 )
44 }
45 #[cfg(not(feature = "editor"))]
46 instance
47 }),
48 )
49 .title("Editable")
50 .config(Config::load_from_file("./resources/GameConfig.toml")?)
51 .run();
52 Ok(())
53}pub fn fps(&self) -> usize
pub fn set_fps(&mut self, frames_per_second: usize)
pub fn process_frame(&mut self, graphics: &mut Graphics<Vertex>)
pub fn process_event(&mut self, event: &Event<'_, ()>) -> bool
Trait Implementations§
Source§impl AppState<Vertex> for GameInstance
impl AppState<Vertex> for GameInstance
Auto Trait Implementations§
impl !Freeze for GameInstance
impl !RefUnwindSafe for GameInstance
impl !Send for GameInstance
impl !Sync for GameInstance
impl !UnwindSafe for GameInstance
impl Unpin for GameInstance
impl UnsafeUnpin for GameInstance
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere
T: Default,
Source§fn initialize() -> T
fn initialize() -> T
Returns the initial value of this type.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.