[−][src]Trait game::common::SimpleState
Many game states fit a pattern of managing a single panel, handling mouseover events, and other
interactions on the map. Implementing this instead of State
reduces some boilerplate.
Required methods
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
action: &str,
panel: &Panel
) -> Transition<App>
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
action: &str,
panel: &Panel
) -> Transition<App>
Called when something on the panel has been clicked. Since the action is just a string,
the fallback case can just use unreachable!()
.
Provided methods
fn panel_changed(
&mut self,
_: &mut EventCtx<'_>,
_: &mut App,
_: &Panel
) -> Option<Transition<App>>
&mut self,
_: &mut EventCtx<'_>,
_: &mut App,
_: &Panel
) -> Option<Transition<App>>
Called when something on the panel has changed. If a transition is returned, stop handling the event and immediately apply the transition.
fn on_mouseover(&mut self, _: &mut EventCtx<'_>, _: &mut App)
Called when the mouse has moved.
fn other_event(&mut self, _: &mut EventCtx<'_>, _: &mut App) -> Transition<App>
If a panel on_click
event didn't occur and panel_changed
didn't return transition, then
call this to handle all other events.
fn draw(&self, _: &mut GfxCtx<'_>, _: &App)
fn draw_baselayer(&self) -> DrawBaselayer
Implementations
impl dyn SimpleState
[src]
Implementors
impl SimpleState for LaneEditor
[src]
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
fn panel_changed(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
panel: &Panel
) -> Option<Transition<App>>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
panel: &Panel
) -> Option<Transition<App>>
fn on_mouseover(&mut self, ctx: &mut EventCtx<'_>, app: &mut App)
[src]
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
fn draw(&self, g: &mut GfxCtx<'_>, app: &App)
[src]
impl SimpleState for StopSignEditor
[src]
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
fn on_mouseover(&mut self, ctx: &mut EventCtx<'_>, _: &mut App)
[src]
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
fn draw(&self, g: &mut GfxCtx<'_>, app: &App)
[src]
impl SimpleState for ChangeDuration
[src]
fn on_click(
&mut self,
_: &mut EventCtx<'_>,
_: &mut App,
x: &str,
panel: &Panel
) -> Transition<App>
[src]
&mut self,
_: &mut EventCtx<'_>,
_: &mut App,
x: &str,
panel: &Panel
) -> Transition<App>
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
_: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
_: &mut App
) -> Transition<App>
fn draw_baselayer(&self) -> DrawBaselayer
[src]
impl SimpleState for ShowAbsolute
[src]
fn on_click(
&mut self,
_: &mut EventCtx<'_>,
_: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
[src]
&mut self,
_: &mut EventCtx<'_>,
_: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
fn on_mouseover(&mut self, ctx: &mut EventCtx<'_>, app: &mut App)
[src]
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
fn draw(&self, g: &mut GfxCtx<'_>, app: &App)
[src]
impl SimpleState for ShowRelative
[src]
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
fn on_mouseover(&mut self, ctx: &mut EventCtx<'_>, app: &mut App)
[src]
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
fn draw(&self, g: &mut GfxCtx<'_>, app: &App)
[src]
impl SimpleState for TuneRelative
[src]
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
panel: &Panel
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
panel: &Panel
) -> Transition<App>
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
_: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
_: &mut App
) -> Transition<App>
fn draw(&self, g: &mut GfxCtx<'_>, _: &App)
[src]
impl SimpleState for UberTurnPicker
[src]
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
fn on_mouseover(&mut self, ctx: &mut EventCtx<'_>, app: &mut App)
[src]
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App
) -> Transition<App>
fn draw(&self, g: &mut GfxCtx<'_>, app: &App)
[src]
impl SimpleState for UberTurnViewer
[src]
fn on_click(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
x: &str,
_: &Panel
) -> Transition<App>
fn panel_changed(
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
panel: &Panel
) -> Option<Transition<App>>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
app: &mut App,
panel: &Panel
) -> Option<Transition<App>>
fn other_event(
&mut self,
ctx: &mut EventCtx<'_>,
_: &mut App
) -> Transition<App>
[src]
&mut self,
ctx: &mut EventCtx<'_>,
_: &mut App
) -> Transition<App>