Struct n18ui::UserInterface [−][src]
pub struct UserInterface {
pub assets: Assets,
pub state: State,
pub controller: Controller,
pub keymap: Keymap,
pub canvas: Canvas,
// some fields omitted
}
Expand description
Defines the user interface.
Fields
assets: Assets
state: State
controller: Controller
keymap: Keymap
canvas: Canvas
Implementations
pub fn new<T, C>(games: T, controller: C, keymap: Keymap) -> Self where
T: IntoIterator<Item = Box<dyn Game>>,
C: Into<Controller>,
pub fn new<T, C>(games: T, controller: C, keymap: Keymap) -> Self where
T: IntoIterator<Item = Box<dyn Game>>,
C: Into<Controller>,
Creates the initial user interface state.
Returns the minimum allowed hex diameter, which limits zooming out.
Returns the maximum allowed hex diameter, which limits zooming in.
Requests the drawing area to update its size, and redraws the current game state.
This should be called when the user has zoomed in or zoomed out.
Resets the drawing surface, requests the drawing area to update its size, and redraws the current game state.
This should only be called when the active game has changed (e.g., when creating a new game or loading a saved game).
Sets the window title to the game name, replacing any state-specific title.
Responds to an event triggered by something other than a UI event (e.g., a message from a task running in a separate thread).
Creates a new game, identified by index into the game library.
Loads a saved game state from path
.
Saves the current game state to path
.
Saves an image to path
.