pub struct GameSession {
pub pause_on_error: bool,
pub last_error: Option<ScriptError>,
pub dirty_assets: HashSet<PathBuf>,
/* private fields */
}Fields§
§pause_on_error: bool§last_error: Option<ScriptError>§dirty_assets: HashSet<PathBuf>Implementations§
Source§impl GameSession
impl GameSession
pub fn open(scene: &Path, no_reload: bool) -> Result<Self>
pub fn host(&self) -> &Arc<ScriptHost> ⓘ
pub fn set_pause_on_error(&mut self, pause: bool)
pub fn take_last_error(&mut self) -> Option<ScriptError>
pub fn resolve_path(&self, res_path: &str) -> PathBuf
pub fn errors(&self) -> Vec<String>
pub fn reload_script_path(&mut self, path: &Path) -> bool
pub fn is_scene_affected(&self, path: &Path) -> bool
pub fn tree_len(&self) -> usize
pub fn script_count(&self) -> usize
pub fn set_viewport(&mut self, w: u32, h: u32)
Sourcepub fn design_size(&self) -> Option<(u32, u32)>
pub fn design_size(&self) -> Option<(u32, u32)>
Project window size: explicit window_width/height when set, else the
engine default. Doubles as the design resolution the game scales from
and as the window’s restore size when maximized.
Sourcepub fn effective_zoom(&self) -> f64
pub fn effective_zoom(&self) -> f64
Camera zoom composed with the contain-fit scale, so content keeps the
design aspect at any window size. button_at shares it, keeping
clicks on what is drawn.
pub fn camera_view(&self) -> ((f64, f64), f64)
pub fn draw_into(&mut self, r: &mut dyn Renderer2D) -> Result<()>
pub fn poll_watch(&mut self) -> bool
pub fn rebuild_physics(&mut self)
pub fn update(&mut self, delta: f64)
Sourcepub fn frame(&mut self, delta: f64)
pub fn frame(&mut self, delta: f64)
One frame: pump watchers, run scripts, then retire edge input.
input_begin_frame() MUST come last. OS/window events arrive
between frames, so clearing edges before update() wipes presses
and releases scripts have not consumed yet (pite.pressed() would
read false forever and buttons would never arm). Edges set since
the previous frame stay visible for exactly one update().
Auto Trait Implementations§
impl !RefUnwindSafe for GameSession
impl !Send for GameSession
impl !Sync for GameSession
impl !UnwindSafe for GameSession
impl Freeze for GameSession
impl Unpin for GameSession
impl UnsafeUnpin for GameSession
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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<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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§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> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.