Expand description
A widgetry application splits its state into two pieces: global shared state that lasts for the entire lifetime of the application, and a stack of smaller states, only one of which is active at a time. For example, imagine an application to view a map. The shared state would include the map and pre-rendered geometry for it. The individual states might start with a splash screen or menu to choose a map, then a map viewer, then maybe a state to drill down into pieces of the map.
Structs
Enums
Before State::draw
is called, draw something else.
When a state responds to an event, it can specify some way to manipulate the stack of states.
Traits
Any data that should last the entire lifetime of the application should be stored in the struct implementing this trait.
Many 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.
A temporary state of an application. There’s a stack of these, with the most recent being the active one.