App

Struct App 

Source
pub(crate) struct App {
Show 25 fields pub(crate) window: Option<Arc<Window>>, pub(crate) surface: Option<Surface<'static>>, pub(crate) surface_config: Option<SurfaceConfiguration>, pub(crate) device: Option<Arc<Device>>, pub(crate) queue: Option<Arc<Queue>>, pub(crate) engine: Option<MilkEngine>, pub(crate) audio_input: Option<AudioInput>, pub(crate) blit: Option<Blit>, pub(crate) preset_manager: PresetManager, pub(crate) last_frame: Instant, pub(crate) frame_count: u32, pub(crate) initial_width: u32, pub(crate) initial_height: u32, pub(crate) fullscreen: bool, pub(crate) no_vsync: bool, pub(crate) last_left_click: Option<Instant>, pub(crate) fps_window_start: Instant, pub(crate) fps_window_frames: u32, pub(crate) last_fps: f32, pub(crate) last_cursor_move: Instant, pub(crate) cursor_visible: bool, pub(crate) settings: Settings, pub(crate) options_ui: Option<OptionsUi>, pub(crate) modifiers: Modifiers, pub(crate) keymap: Keymap,
}

Fields§

§window: Option<Arc<Window>>§surface: Option<Surface<'static>>§surface_config: Option<SurfaceConfiguration>§device: Option<Arc<Device>>§queue: Option<Arc<Queue>>§engine: Option<MilkEngine>§audio_input: Option<AudioInput>§blit: Option<Blit>§preset_manager: PresetManager§last_frame: Instant§frame_count: u32§initial_width: u32

Window-creation preferences read once from CLI args.

§initial_height: u32§fullscreen: bool§no_vsync: bool§last_left_click: Option<Instant>

Timestamp of the last left-click; used to detect double-click.

§fps_window_start: Instant

Start of the current FPS-measurement window.

§fps_window_frames: u32

Frames rendered since fps_window_start.

§last_fps: f32

Last computed FPS (refreshed every ~2s alongside the log). Fed into the HUD overlay.

§last_cursor_move: Instant

Timestamp of the last cursor movement. Drives the auto-hide behaviour (Settings::window::cursor_auto_hide_secs).

§cursor_visible: bool

Current visibility of the cursor — mirrors what we last told winit so we don’t spam set_cursor_visible on every frame.

§settings: Settings

Persistent settings loaded at startup; the Options overlay edits this in place and re-saves on every change.

§options_ui: Option<OptionsUi>

egui-based Options overlay. None until init_graphics runs.

§modifiers: Modifiers

Current modifier state, kept in sync with WindowEvent::ModifiersChanged. The sprite + message keybindings (§5, §6) read Shift (random sprite) and Ctrl (clear all) from here.

§keymap: Keymap

Keybind table. Defaults to MD2-style mapping; overrides come from ~/.config/onedrop/settings.toml [keymap.bindings].

Implementations§

Source§

impl App

Source

pub(crate) fn new(args: &Args, settings: Settings) -> Self

Source

pub(crate) fn toggle_fullscreen(&self)

Source

pub(crate) fn init_graphics(&mut self, window: Arc<Window>) -> Result<()>

Source

pub(crate) fn render(&mut self) -> Result<()>

Source

pub(crate) fn swap_audio_input(&mut self, name: Option<&str>)

Drop the active audio capture stream and rebuild it against a different cpal device. name = None means “the OS default”; a name that doesn’t match any current device falls back to the default with a warning logged by the engine helper.

Source

pub(crate) fn reconfigure_present_mode(&mut self, vsync: bool)

Reconfigure the swapchain for a new VSync preference. Mirrors the boot logic in init_graphics for picking a present mode: Fifo for VSync ON, Immediate (with Mailbox fallback) for OFF. Called by the Options panel.

Source

pub(crate) fn options_open(&self) -> bool

Return true when the Options overlay is currently drawn on screen. Used by handle_keyboard to scope the Esc key to “close overlay” rather than “quit” while the panel is open.

Source

pub(crate) fn handle_keyboard( &mut self, event_loop: &ActiveEventLoop, key_code: KeyCode, )

Source

pub(crate) fn dispatch_action( &mut self, event_loop: &ActiveEventLoop, action: Action, )

Run the side-effects for a resolved Action. Split out from handle_keyboard so the lookup → dispatch step is testable in isolation and so action handlers can be added without touching the winit event-decoding glue.

Trait Implementations§

Source§

impl ApplicationHandler for App

Source§

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

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

fn window_event( &mut self, event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent, )

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

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 device_event( &mut self, event_loop: &ActiveEventLoop, device_id: DeviceId, event: DeviceEvent, )

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

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

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

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

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl !UnwindSafe 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<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

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.
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, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(value: T, _simd: S) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

§

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> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

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
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> WasmNotSend for T
where T: Send,