Trait ascii_hangman_backend::HangmanBackend[][src]

pub trait HangmanBackend {
    fn new(config: &str) -> Result<Self, ConfigParseError>
    where
        Self: Sized
;
fn process_user_input(&mut self, inp: &str);
fn render_image(&self) -> String;
fn get_image_dimension(&self) -> (u8, u8);
fn render_secret(&self) -> String;
fn render_game_lifes(&self) -> String;
fn render_game_last_guess(&self) -> String;
fn render_instructions(&self) -> String;
fn get_state(&self) -> State; }
Expand description

API to interact with all game logic. This is used by the desktop frontend in main.rs or by the web-app frontend in lib.rs.

Required methods

Initialize the application with config data and start the first game.

The user_input is a key stroke. The meaning depends on the game’s state:

Renders the image. Make sure it is up to date with self.image.update().

Forward the private image dimension

Renders the partly hidden secret.

Informs about some game statistics: lifes

Informs about some game statistics: last guess

Tells the user what to do next.

Forwards the game’s state

Implementors