gui_pb

Struct App

Source
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§robot_buttons_wts: 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

Source

pub fn set_target_vel(&mut self, target_vel: VelocityControl)

Source

pub fn read_input(&mut self, ctx: &Context)

Source§

impl App

Source

pub(crate) fn new(cc: &CreationContext<'_>) -> Self

Source

pub fn send(&self, message: GuiToServerMessage)

Source

pub fn manage_network(&mut self)

Source

pub fn draw_layout(&mut self, ctx: &Context)

Draw the main outer layout

Source

pub fn save_replay(&self) -> Result<(), Error>

Save the current replay to file

Source

pub fn load_replay(&mut self) -> Result<(), Error>

Load a replay from file

Trait Implementations§

Source§

impl App for App

Source§

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)

Called on shutdown, and perhaps at regular intervals. Allows you to save state. Read more
§

fn on_exit(&mut self, _gl: Option<&Context>)

Called once on shutdown, after [Self::save]. Read more
§

fn auto_save_interval(&self) -> Duration

Time between automatic calls to [Self::save]
§

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

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)

A hook for manipulating or filtering raw input before it is processed by [Self::update]. Read more
Source§

impl TabViewer for App

Source§

type Tab = Tab

The type of tab in which you can store state to be drawn in your tabs.
Source§

fn title(&mut self, tab: &mut Self::Tab) -> WidgetText

The title to be displayed in the tab bar.
Source§

fn ui(&mut self, ui: &mut Ui, tab: &mut Self::Tab)

Actual tab content.
§

fn context_menu( &mut self, _ui: &mut Ui, _tab: &mut Self::Tab, _surface: SurfaceIndex, _node: NodeIndex, )

Content inside the context menu shown when the tab is right-clicked. Read more
§

fn id(&mut self, tab: &mut Self::Tab) -> Id

Unique ID for this tab. Read more
§

fn on_tab_button(&mut self, _tab: &mut Self::Tab, _response: &Response)

Called after each tab button is shown, so you can add a tooltip, check for clicks, etc.
§

fn closeable(&mut self, _tab: &mut Self::Tab) -> bool

Returns true if the user of your app should be able to close a given _tab. Read more
§

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)

This is called when the add button is pressed. Read more
§

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

This is called every frame after ui is called, if the _tab is active. Read more
§

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

Specifies a tab’s ability to be shown in a window. Read more
§

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]

Returns true if the horizontal and vertical scroll bars will be shown for tab. 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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

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

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

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

Checks if self is actually part of its subset T (and can be converted to it).
§

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

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T