pub struct App {Show 19 fields
pub(crate) dock_state: Option<DockState<Tab>>,
pub(crate) grid: ComputedGrid,
pub(crate) pointer_pos: Option<Pos2>,
pub(crate) background_color: Color32,
pub(crate) world_to_screen: Transform,
pub(crate) robot_buttons_wts: Transform,
pub(crate) server_status: ServerStatus,
pub(crate) saved_game_state: Option<GameState>,
pub(crate) network: (ThreadedSocket<GuiToServerMessage, ServerToGuiMessage>, Option<Address>),
pub(crate) old_settings: PacbotSettings,
pub(crate) settings: PacbotSettings,
pub(crate) ui_settings: UiSettings,
pub(crate) target_vel: VelocityControl,
pub(crate) motor_status_frames: MotorStatusGraphFrames<3>,
pub(crate) gui_stopwatch: Stopwatch<5, 30, WebTimeInstant>,
pub(crate) rotated_grid: bool,
pub(crate) settings_fields: Option<HashMap<String, (String, String)>>,
pub(crate) pacbot_server_connection_status: NetworkStatus,
pub(crate) gilrs: Gilrs,
}
Expand description
Stores all the data needed for the application
Fields§
§dock_state: Option<DockState<Tab>>
§grid: ComputedGrid
§pointer_pos: Option<Pos2>
§background_color: Color32
§world_to_screen: Transform
§server_status: ServerStatus
§saved_game_state: Option<GameState>
§network: (ThreadedSocket<GuiToServerMessage, ServerToGuiMessage>, Option<Address>)
§old_settings: PacbotSettings
§settings: PacbotSettings
§ui_settings: UiSettings
§target_vel: VelocityControl
§motor_status_frames: MotorStatusGraphFrames<3>
§gui_stopwatch: Stopwatch<5, 30, WebTimeInstant>
§rotated_grid: bool
§settings_fields: Option<HashMap<String, (String, String)>>
§pacbot_server_connection_status: NetworkStatus
§gilrs: Gilrs
Implementations§
Source§impl App
impl App
pub fn set_target_vel(&mut self, target_vel: VelocityControl)
pub fn read_input(&mut self, ctx: &Context)
Source§impl App
impl App
pub(crate) fn new(cc: &CreationContext<'_>) -> Self
pub fn send(&self, message: GuiToServerMessage)
pub fn manage_network(&mut self)
Sourcepub fn draw_layout(&mut self, ctx: &Context)
pub fn draw_layout(&mut self, ctx: &Context)
Draw the main outer layout
Sourcepub fn save_replay(&self) -> Result<(), Error>
pub fn save_replay(&self) -> Result<(), Error>
Save the current replay to file
Sourcepub fn load_replay(&mut self) -> Result<(), Error>
pub fn load_replay(&mut self) -> Result<(), Error>
Load a replay from file
Trait Implementations§
Source§impl App for App
impl App for App
Source§fn update(&mut self, ctx: &Context, _frame: &mut Frame)
fn update(&mut self, ctx: &Context, _frame: &mut Frame)
Called each time the UI needs repainting, which may be many times per second. Read more
§fn save(&mut self, _storage: &mut dyn Storage)
fn save(&mut self, _storage: &mut dyn Storage)
Called on shutdown, and perhaps at regular intervals. Allows you to save state. Read more
§fn auto_save_interval(&self) -> Duration
fn auto_save_interval(&self) -> Duration
Time between automatic calls to [
Self::save
]§fn clear_color(&self, _visuals: &Visuals) -> [f32; 4]
fn clear_color(&self, _visuals: &Visuals) -> [f32; 4]
Background color values for the app, e.g. what is sent to
gl.clearColor
. Read more§fn persist_egui_memory(&self) -> bool
fn persist_egui_memory(&self) -> bool
Controls whether or not the egui memory (window positions etc) will be
persisted (only if the “persistence” feature is enabled).
§fn raw_input_hook(&mut self, _ctx: &Context, _raw_input: &mut RawInput)
fn raw_input_hook(&mut self, _ctx: &Context, _raw_input: &mut RawInput)
A hook for manipulating or filtering raw input before it is processed by [
Self::update
]. Read moreSource§impl TabViewer for App
impl TabViewer for App
Source§fn title(&mut self, tab: &mut Self::Tab) -> WidgetText
fn title(&mut self, tab: &mut Self::Tab) -> WidgetText
The title to be displayed in the tab bar.
Content inside the context menu shown when the tab is right-clicked. Read more
Called after each tab button is shown, so you can add a tooltip, check for clicks, etc.
§fn on_close(&mut self, _tab: &mut Self::Tab) -> bool
fn on_close(&mut self, _tab: &mut Self::Tab) -> bool
This is called when the
_tab
gets closed by the user. Read more§fn on_add(&mut self, _surface: SurfaceIndex, _node: NodeIndex)
fn on_add(&mut self, _surface: SurfaceIndex, _node: NodeIndex)
This is called when the add button is pressed. Read more
§fn add_popup(&mut self, _ui: &mut Ui, _surface: SurfaceIndex, _node: NodeIndex)
fn add_popup(&mut self, _ui: &mut Ui, _surface: SurfaceIndex, _node: NodeIndex)
Content of the popup under the add button. Useful for selecting what type of tab to add. Read more
§fn force_close(&mut self, _tab: &mut Self::Tab) -> bool
fn force_close(&mut self, _tab: &mut Self::Tab) -> bool
§fn tab_style_override(
&self,
_tab: &Self::Tab,
_global_style: &TabStyle,
) -> Option<TabStyle>
fn tab_style_override( &self, _tab: &Self::Tab, _global_style: &TabStyle, ) -> Option<TabStyle>
Sets custom style for given tab.
§fn allowed_in_windows(&self, _tab: &mut Self::Tab) -> bool
fn allowed_in_windows(&self, _tab: &mut Self::Tab) -> bool
Specifies a tab’s ability to be shown in a window. Read more
§fn clear_background(&self, _tab: &Self::Tab) -> bool
fn clear_background(&self, _tab: &Self::Tab) -> bool
Whether the tab body will be cleared with the color specified in
TabBarStyle::bg_fill
.§fn scroll_bars(&self, _tab: &Self::Tab) -> [bool; 2]
fn scroll_bars(&self, _tab: &Self::Tab) -> [bool; 2]
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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
§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>
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>
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)
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)
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<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> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.