#include <controller.h>
Public Member Functions | |
Controller (int timerInterval=1) | |
virtual bool | isCombatController () const |
bool | notifyKeyPressed (int key) |
bool | notifyMousePress (const Common::Point &mousePos) |
int | getTimerInterval () |
virtual void | setActive () |
virtual bool | keyPressed (int key) |
virtual bool | mousePressed (const Common::Point &mousePos) |
virtual void | keybinder (KeybindingAction action) |
virtual void | timerFired () |
bool | shouldQuit () const |
Static Public Member Functions | |
static void | timerCallback (void *data) |
A generic controller base class. Controllers are classes that contain the logic for responding to external events (e.g. keyboard, mouse, timers).
bool Ultima::Ultima4::Controller::notifyKeyPressed | ( | int | key | ) |
The event manager will call this method to notify the active controller that a key has been pressed. The key will be passed on to the virtual keyPressed method.
bool Ultima::Ultima4::Controller::notifyMousePress | ( | const Common::Point & | mousePos | ) |
The event manager will call this method to notify that the left button was clicked
|
static |
A simple adapter to make a timer callback into a controller method call.
|
virtual |
control methods subclasses may want to override Called when a controller is made active
Reimplemented in Ultima::Ultima4::GameController, Ultima::Ultima4::CombatController, Ultima::Ultima4::MenuController, and Ultima::Ultima4::ReadDirController.
|
inlinevirtual |
Key was pressed
Reimplemented in Ultima::Ultima4::KeyHandlerController, Ultima::Ultima4::IntroController, Ultima::Ultima4::MenuController, Ultima::Ultima4::ReadStringController, Ultima::Ultima4::AlphaActionController, Ultima::Ultima4::ReagentsMenuController, Ultima::Ultima4::ReadChoiceController, Ultima::Ultima4::ReadPlayerController, Ultima::Ultima4::WaitController, and Ultima::Ultima4::ZtatsController.
|
inlinevirtual |
Mouse button was pressed
Reimplemented in Ultima::Ultima4::WaitableController< T >, Ultima::Ultima4::WaitableController< Direction >, Ultima::Ultima4::WaitableController< void *>, Ultima::Ultima4::WaitableController< int >, Ultima::Ultima4::WaitableController< Common::String >, Ultima::Ultima4::GameController, Ultima::Ultima4::IntroController, and Ultima::Ultima4::MenuController.
|
inlinevirtual |
Handles keybinder actions
Reimplemented in Ultima::Ultima4::CombatController, Ultima::Ultima4::GameController, Ultima::Ultima4::MenuController, Ultima::Ultima4::ReadDirController, Ultima::Ultima4::ReagentsMenuController, Ultima::Ultima4::AlphaActionController, Ultima::Ultima4::ReadChoiceController, and Ultima::Ultima4::ZtatsController.
|
virtual |
The default timerFired handler for a controller. By default, timers are ignored, but subclasses can override this method and it will be called every <interval> 1/4 seconds.
Reimplemented in Ultima::Ultima4::GameController, Ultima::Ultima4::IntroController, and Ultima::Ultima4::WaitController.
bool Ultima::Ultima4::Controller::shouldQuit | ( | ) | const |
Returns true if game should quit