[][src]Trait gameboard::game::InputListener

pub trait InputListener<R: Read, W: Write> where
    Self: Sized
{ fn handle_key(&mut self, key: Key, game: &mut Game<R, W, Self>); fn cursor_moved(
        &mut self,
        _position: Position,
        _game: &mut Game<R, W, Self>
    ) { ... } }

User input listener.

Required methods

fn handle_key(&mut self, key: Key, game: &mut Game<R, W, Self>)

This method is called when user press any key on keyboard.

Since this library uses termion crate, keys from termion::event::Key are supported only. You can update game using game argument.

Loading content...

Provided methods

fn cursor_moved(&mut self, _position: Position, _game: &mut Game<R, W, Self>)

This method is called when user moved Cursor. Default implementation is empty. You don't need to implement it if you don't use Cursor.

The position is a new cursor position. You can update game using game argument.

Loading content...

Implementors

Loading content...