pub struct OptionsUi {
ctx: Context,
state: State,
renderer: Renderer,
pub visible: bool,
tab: Tab,
boot: Settings,
audio_devices: Vec<String>,
audio_devices_fetched: bool,
}Expand description
Stateful egui overlay. Owns the renderer + the winit event translator; the visualiser keeps one of these for the life of the window.
Fields§
§ctx: Context§state: State§renderer: Renderer§visible: boolWhether the panel is currently drawn. Toggle from main via Tab.
tab: Tab§boot: SettingsSnapshot of the settings the process booted with. Restart-only fields (MSAA, texture format) compare against this to decide whether the “Apply & restart” button should be enabled.
audio_devices: Vec<String>Cached cpal input-device names, populated on demand by the “Refresh” button on the Audio tab. We don’t enumerate every frame — cpal device enumeration on ALSA is multi-millisecond.
audio_devices_fetched: boolWhether the audio-device cache has been populated at least once. Drives a lazy first-fill on the user’s first visit to the Audio tab.
Implementations§
Source§impl OptionsUi
impl OptionsUi
pub fn new( window: &Window, device: &Device, surface_format: TextureFormat, boot_settings: Settings, ) -> Self
Sourcepub fn on_event(&mut self, window: &Window, event: &WindowEvent) -> bool
pub fn on_event(&mut self, window: &Window, event: &WindowEvent) -> bool
Feed a winit event into egui. Returns true when egui consumed it (e.g. a click on a slider) — the caller should suppress its own handling so typing in egui doesn’t also flip presets.
pub fn toggle(&mut self)
Sourcepub fn render(
&mut self,
device: &Device,
queue: &Queue,
window: &Window,
encoder: &mut CommandEncoder,
surface_view: &TextureView,
surface_size: (u32, u32),
settings: &mut Settings,
hud_data: &HudData,
) -> OptionsActions
pub fn render( &mut self, device: &Device, queue: &Queue, window: &Window, encoder: &mut CommandEncoder, surface_view: &TextureView, surface_size: (u32, u32), settings: &mut Settings, hud_data: &HudData, ) -> OptionsActions
Run one frame of the UI on top of surface_view. Returns the
changes the user just made; the caller applies them to the live
engine. The frame is a no-op when neither the options panel nor
the HUD wants to draw anything.
Auto Trait Implementations§
impl Freeze for OptionsUi
impl !RefUnwindSafe for OptionsUi
impl Send for OptionsUi
impl !Sync for OptionsUi
impl Unpin for OptionsUi
impl !UnwindSafe for OptionsUi
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