Skip to main content

App

Struct App 

Source
pub struct App {
Show 34 fields pub cfg: Config, pub res: Resources, pub game: Game, pub level_index: usize, pub levels: Vec<String>, luts: ShadeLuts, luts_water: ShadeLuts, luts_beast: ShadeLuts, renderer: Renderer, window: Option<Rc<Window>>, surface: Option<Surface<Rc<Window>, Rc<Window>>>, keys: HashSet<KeyCode>, mouse_buttons: HashSet<MouseButton>, mouse_dx: f64, mouse_dy: f64, last: Instant, fps_time: Instant, fps_frames: u32, fps: f64, grabbed: bool, pub audio: Option<Audio>, show_stats: bool, audio_map: String, pub menu: Menu, pub menu_open: bool, start_time: Instant, out: Vec<u32>, shot_pending: bool, pace_next: Option<Instant>, movie: Option<Movie>, movie_queue: VecDeque<MovieFile>, prof_log: Vec<String>, last_switch: Instant, message: Option<(String, Instant)>,
}

Fields§

§cfg: Config§res: Resources§game: Game§level_index: usize§levels: Vec<String>§luts: ShadeLuts§luts_water: ShadeLuts§luts_beast: ShadeLuts§renderer: Renderer§window: Option<Rc<Window>>§surface: Option<Surface<Rc<Window>, Rc<Window>>>§keys: HashSet<KeyCode>§mouse_buttons: HashSet<MouseButton>§mouse_dx: f64§mouse_dy: f64§last: Instant§fps_time: Instant§fps_frames: u32§fps: f64§grabbed: bool§audio: Option<Audio>§show_stats: bool§audio_map: String§menu: Menu§menu_open: bool§start_time: Instant§out: Vec<u32>

Window-sized image (letterboxed modes) the HUD is drawn on before presenting.

§shot_pending: bool

F12 pressed: save the next presented frame.

§pace_next: Option<Instant>

When the next capped frame may start.

§movie: Option<Movie>

Cutscene playing, and those queued after it.

§movie_queue: VecDeque<MovieFile>§prof_log: Vec<String>§last_switch: Instant§message: Option<(String, Instant)>

Implementations§

Source§

impl App

Source

pub fn new( cfg: Config, res: Resources, game: Game, levels: Vec<String>, level_index: usize, ) -> Self

Source

fn grab(&mut self, on: bool)

Source

fn down(&self, k: KeyCode) -> bool

Source

fn build_input(&mut self, dt: f64) -> Input

Source

fn change_level(&mut self, delta: isize)

Source

fn load_named(&mut self, name: &str, carry: bool)

Loads a level; carry keeps the player’s weapons, health and armour.

Source

fn level_exit(&mut self, secret: bool)

Source

pub fn queue_movies(&mut self, files: Vec<MovieFile>)

Queues cutscenes to play before the game continues.

Source

fn queue_episode_movie(&mut self, map: &str, entering: bool)

Cutscene A of the episode when map is its cutscene level (entering), or the episode’s ending cutscene B (when leaving its last map).

Source

fn update_movie(&mut self) -> bool

Starts the next queued cutscene if none is playing; advances the current one. Returns true while a cutscene is on screen.

Source

fn skip_movie(&mut self)

Skips the current cutscene (any key or mouse button).

Source

fn options_view(&self) -> OptionsView

Source

fn save_dir(&self) -> PathBuf

Source

fn save_slot(&mut self, slot: usize)

Source

fn load_slot(&mut self, slot: usize)

Source

fn close_menu(&mut self)

Source

fn menu_key(&mut self, el: &ActiveEventLoop, code: KeyCode)

Source

fn flash(&mut self, m: String)

Source

fn frame(&mut self)

Source

fn draw_movie(&mut self)

Shows the current cutscene frame, fitted to 4:3 (as on the original’s screen).

Source

fn pace_frame(&mut self)

Frame-rate cap: waits until this frame’s slot ends. Sleeps most of the way (Rust’s sleep uses a high-resolution timer on Windows) and spins the last moment for even frame spacing. Motion stays smooth through the tick interpolation.

Source

fn toggle_fullscreen(&mut self)

Trait Implementations§

Source§

impl ApplicationHandler for App

Source§

fn resumed(&mut self, el: &ActiveEventLoop)

Emitted when the application has been resumed. Read more
Source§

fn window_event( &mut self, el: &ActiveEventLoop, _id: WindowId, event: WindowEvent, )

Emitted when the OS sends an event to a winit window.
Source§

fn device_event( &mut self, _el: &ActiveEventLoop, _id: DeviceId, event: DeviceEvent, )

Emitted when the OS sends an event to a device.
Source§

fn about_to_wait(&mut self, _el: &ActiveEventLoop)

Emitted when the event loop is about to block and wait for new events. Read more
§

fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause)

Emitted when new events arrive from the OS to be processed. Read more
§

fn user_event(&mut self, event_loop: &ActiveEventLoop, event: T)

Emitted when an event is sent from EventLoopProxy::send_event.
§

fn suspended(&mut self, event_loop: &ActiveEventLoop)

Emitted when the application has been suspended. Read more
§

fn exiting(&mut self, event_loop: &ActiveEventLoop)

Emitted when the event loop is being shut down. Read more
§

fn memory_warning(&mut self, event_loop: &ActiveEventLoop)

Emitted when the application has received a memory warning. Read more
Source§

impl Drop for App

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl !UnwindSafe for App

§

impl Freeze for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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 T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more