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: u32Window-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: InstantStart of the current FPS-measurement window.
fps_window_frames: u32Frames rendered since fps_window_start.
last_fps: f32Last computed FPS (refreshed every ~2s alongside the log). Fed into the HUD overlay.
last_cursor_move: InstantTimestamp of the last cursor movement. Drives the auto-hide
behaviour (Settings::window::cursor_auto_hide_secs).
cursor_visible: boolCurrent visibility of the cursor — mirrors what we last told
winit so we don’t spam set_cursor_visible on every frame.
settings: SettingsPersistent 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: ModifiersCurrent 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: KeymapKeybind table. Defaults to MD2-style mapping; overrides come
from ~/.config/onedrop/settings.toml [keymap.bindings].
Implementations§
Source§impl App
impl App
pub(crate) fn new(args: &Args, settings: Settings) -> Self
pub(crate) fn toggle_fullscreen(&self)
pub(crate) fn init_graphics(&mut self, window: Arc<Window>) -> Result<()>
pub(crate) fn render(&mut self) -> Result<()>
Sourcepub(crate) fn swap_audio_input(&mut self, name: Option<&str>)
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.
Sourcepub(crate) fn reconfigure_present_mode(&mut self, vsync: bool)
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.
Sourcepub(crate) fn options_open(&self) -> bool
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.
pub(crate) fn handle_keyboard( &mut self, event_loop: &ActiveEventLoop, key_code: KeyCode, )
Sourcepub(crate) fn dispatch_action(
&mut self,
event_loop: &ActiveEventLoop,
action: Action,
)
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
impl ApplicationHandler for App
Source§fn resumed(&mut self, event_loop: &ActiveEventLoop)
fn resumed(&mut self, event_loop: &ActiveEventLoop)
Source§fn window_event(
&mut self,
event_loop: &ActiveEventLoop,
_window_id: WindowId,
event: WindowEvent,
)
fn window_event( &mut self, event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent, )
§fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause)
fn new_events(&mut self, event_loop: &ActiveEventLoop, cause: StartCause)
§fn user_event(&mut self, event_loop: &ActiveEventLoop, event: T)
fn user_event(&mut self, event_loop: &ActiveEventLoop, event: T)
EventLoopProxy::send_event.§fn device_event(
&mut self,
event_loop: &ActiveEventLoop,
device_id: DeviceId,
event: DeviceEvent,
)
fn device_event( &mut self, event_loop: &ActiveEventLoop, device_id: DeviceId, event: DeviceEvent, )
§fn about_to_wait(&mut self, event_loop: &ActiveEventLoop)
fn about_to_wait(&mut self, event_loop: &ActiveEventLoop)
§fn suspended(&mut self, event_loop: &ActiveEventLoop)
fn suspended(&mut self, event_loop: &ActiveEventLoop)
§fn exiting(&mut self, event_loop: &ActiveEventLoop)
fn exiting(&mut self, event_loop: &ActiveEventLoop)
§fn memory_warning(&mut self, event_loop: &ActiveEventLoop)
fn memory_warning(&mut self, event_loop: &ActiveEventLoop)
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> 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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