![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
The input manager. More...
#include <InputManager.h>
Classes | |
struct | BindGameEventInfo |
A game event binding. More... | |
struct | BindInfo |
A command binding. More... | |
Public Member Functions | |
InputManager () | |
Constructor. More... | |
virtual | ~InputManager () |
Destructor. More... | |
void | Input (const VGears::Event &event) override |
Makes the input manager itself handles an input event. More... | |
void | Update () |
Update keyboard and mouse buttons, movements and scroll status. More... | |
void | UpdateDebug () override |
Updates the input manager with debug information. More... | |
void | OnResize () override |
Handles resizing events. More... | |
void | ClearField () override |
Clears all field information in the input manager. More... | |
void | ClearBattle () override |
Clears all battle information in the input manager. More... | |
void | ClearWorld () override |
Clears all world map information in the input manager. More... | |
void | ButtonPressed (int button, char text, bool down) |
Triggered when a keyboard button is pressed or released. More... | |
void | MousePressed (int button, bool down) |
Triggered when a mouse button is pressed or released. More... | |
void | MouseMoved (int x, int y) |
Triggered when a mouse moves. More... | |
void | MouseScrolled (int value) |
Triggered when a mouse scrolls. More... | |
void | Reset () |
Resets all keyboard and mouse events to their default state. More... | |
bool | IsButtonPressed (int button) const |
Checks if a button is being pressed. More... | |
void | GetInputEvents (InputEventArray &input_events) |
Retrieves the current input events. More... | |
void | InitCmd () |
Initializes all command bindings. More... | |
void | BindCommand (ConfigCmd *cmd, const Ogre::StringVector ¶ms, const ButtonList &buttons) |
Binds a command to an input event. More... | |
void | BindGameEvent (const Ogre::String &event, const ButtonList &buttons) |
Binds a game event to an input event. More... | |
void | ActivateBinds (const int button) |
Activates all bindings for a button. More... | |
void | AddGameEvents (const int button, const VGears::EventType type) |
Adds a game event associated to a button. More... | |
![]() | |
Manager () | |
Constructor. More... | |
virtual | ~Manager () |
Destructor. More... | |
Module | GetModule () const |
Retrieves the currently selected module. More... | |
bool | IsModule (const Module module) const |
Checks the currently selected module. More... | |
bool | IsFieldModule () const |
Checks if the currently selected module is the field module. More... | |
bool | IsBattleModule () const |
Checks if the currently selected module is the battle module. More... | |
bool | IsWorldModule () const |
Checks if the currently selected module is the world module. More... | |
void | SetModule (const Module module) |
Sets the current module for the entity manager. More... | |
void | SetFieldModule () |
Sets the current module to the field mode. More... | |
void | SetBattleModule () |
Sets the current module to the battle mode. More... | |
void | SetWorldModule () |
Sets the current module to the world map mode. More... | |
void | SetPreviousModule () |
Sets the module that was loaded before a battle. More... | |
virtual void | Input (const VGears::Event &event)=0 |
Handles an input event. More... | |
void | Update () |
Called every frame, performs an update on the things controlled by the manager. More... | |
virtual void | UpdateDebug ()=0 |
Called every frame, performs an update on the things controlled by the manager. More... | |
virtual void | OnResize ()=0 |
Handles resizing events. More... | |
void | Clear () |
Clears the manager. More... | |
void | Clear (const Module module) |
Clears the manager. More... | |
virtual void | ClearField ()=0 |
Clear all field information in the manager. More... | |
virtual void | ClearBattle ()=0 |
Clear all battle information in the manager. More... | |
virtual void | ClearWorld ()=0 |
Clear all world map information in the manager. More... | |
void | ClearAll () |
Clears the manager. More... | |
void | ScriptSetPaused (const bool paused) |
Handles game pausing. More... | |
Private Member Functions | |
void | UpdateField () override |
Updates the input manager while on the fields. More... | |
void | UpdateBattle () override |
Updates the input manager while on a battle. More... | |
void | UpdateWorld () override |
Updates the input manager while on the world map. More... | |
Private Attributes | |
bool | button_state_ [256] |
The state of eahc button. More... | |
char | button_text_ [256] |
The text of each button. More... | |
bool | repeat_first_wait_ |
Indicates if a key held down is waiting to repeat events. More... | |
float | repeat_timer_ |
The time a key has been pressed. More... | |
InputEventArray | event_queue_ |
The event queue. More... | |
std::vector< BindInfo > | binds_ |
List of command bindings. More... | |
std::vector< BindGameEventInfo > | bind_game_events_ |
List of game event bindings. More... | |
Additional Inherited Members | |
![]() | |
enum | Module { FIELD = 0 , BATTLE = 1 , WORLD = 2 } |
The modules the entity manager can handle. More... | |
![]() | |
virtual void | UpdateField ()=0 |
Updates the field entities in the manager. More... | |
virtual void | UpdateBattle ()=0 |
Updates the battle entities in the manager. More... | |
virtual void | UpdateWorld ()=0 |
Updates the world map entities in the manager. More... | |
void | Update (Module module) |
Updates the entities of one module in the manager. More... | |
![]() | |
Module | module_ |
The currently selected module. More... | |
Module | prev_module_ |
The previous module. More... | |
bool | paused_ |
Indicates if the game is paused. More... | |
The input manager.
It handles input events and creates {
InputManager::InputManager | ( | ) |
Constructor.
|
virtual |
Destructor.
void InputManager::ActivateBinds | ( | const int | button | ) |
Activates all bindings for a button.
[in] | button | ID of the button. |
void InputManager::AddGameEvents | ( | const int | button, |
const VGears::EventType | type | ||
) |
Adds a game event associated to a button.
[in] | button | ID of the button. |
[in] | type | Event type. |
void InputManager::BindCommand | ( | ConfigCmd * | cmd, |
const Ogre::StringVector & | params, | ||
const ButtonList & | buttons | ||
) |
Binds a command to an input event.
[in] | cmd | Command to bind. |
[in] | params | Command arguments. |
[in] | buttons | Buttons to bind to the command. |
void InputManager::BindGameEvent | ( | const Ogre::String & | event, |
const ButtonList & | buttons | ||
) |
Binds a game event to an input event.
[in] | event | The game event to bind. |
[in] | buttons | Buttons to bind to the event. |
void InputManager::ButtonPressed | ( | int | button, |
char | text, | ||
bool | down | ||
) |
Triggered when a keyboard button is pressed or released.
Creates an {
[in] | button | Pressed button ID. |
[in] | text |
[in] | down | True if the button has been pressed, false if it has been released. It gets assigned to parameter 2 of the event. |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
void InputManager::GetInputEvents | ( | InputEventArray & | input_events | ) |
Retrieves the current input events.
The input event queue will be empty after calling this function.
[out] | input_events | The current events will be loaded here. |
void InputManager::InitCmd | ( | ) |
Initializes all command bindings.
|
overridevirtual |
Makes the input manager itself handles an input event.
[in] | event | Event to handle. |
Implements Manager.
bool InputManager::IsButtonPressed | ( | int | button | ) | const |
Checks if a button is being pressed.
[in] | button | Button code. |
void InputManager::MouseMoved | ( | int | x, |
int | y | ||
) |
Triggered when a mouse moves.
Creates an {
[in] | x | New mouse's X coordinate. It gets assigned to parameter 1 of the event. |
[in] | y | New mouse's Y coordinate. It gets assigned to parameter 2 of the event. |
void InputManager::MousePressed | ( | int | button, |
bool | down | ||
) |
Triggered when a mouse button is pressed or released.
Creates an {
[in] | button | Pressed button ID. |
[in] | down | True if the button has been pressed, false if it has been released. It gets assigned to parameter 1 of the event. |
void InputManager::MouseScrolled | ( | int | value | ) |
Triggered when a mouse scrolls.
Creates an {
[in] | value | Number of lines scrolled. Positive for scroll down, negative for scroll up. It gets assigned to parameter 1 of the event. |
|
overridevirtual |
Handles resizing events.
Implements Manager.
void InputManager::Reset | ( | ) |
Resets all keyboard and mouse events to their default state.
Keyboard and mouse are considered to not pressed, the mouse movement and scroll are considered 0.
void InputManager::Update | ( | ) |
Update keyboard and mouse buttons, movements and scroll status.
|
overrideprivatevirtual |
|
overridevirtual |
Updates the input manager with debug information.
Implements Manager.
|
overrideprivatevirtual |
|
overrideprivatevirtual |
|
private |
List of game event bindings.
|
private |
List of command bindings.
|
private |
The state of eahc button.
|
private |
The text of each button.
|
private |
The event queue.
|
private |
Indicates if a key held down is waiting to repeat events.
|
private |
The time a key has been pressed.