libsuit
0.1.1
SFML User Interface Toolkit
|
An action that can be triggered by different controls. More...
#include <ui/Action.h>
Public Member Functions | |
Action (std::string name) | |
Construct an action with a name. More... | |
const std::string & | getName () const |
Get the name of the action. More... | |
Type of the action | |
void | setContinuous () |
Set the action continuous. More... | |
bool | isContinuous () const |
Tell whether the action is continuous. More... | |
void | setInstantaneous () |
Set the action instantaneous. More... | |
bool | isInstantaneous () const |
Tell whether the action is instantaneous. More... | |
Controls for the action | |
void | addGamepadAxisControl (unsigned int id, sf::Joystick::Axis axis, Direction dir) |
Add a gamepad axis control. More... | |
void | addGamepadButtonControl (unsigned int id, unsigned int button) |
Add a gamepad button control. More... | |
void | addKeyControl (sf::Keyboard::Key key) |
Add a key control. More... | |
void | addMouseButtonControl (sf::Mouse::Button button) |
Add a mouse button control. More... | |
void | addCloseControl () |
Add a close control. More... | |
State of the action | |
void | update (const sf::Event &event) |
Update the state of the action thanks to an event. More... | |
bool | isActive () |
Tell whether the action is active. More... | |
void | reset () |
Reset the state of the action. More... | |
An action that can be triggered by different controls.
ui::Action::Action | ( | std::string | name | ) |
Construct an action with a name.
name | the name of the action. |
void ui::Action::addCloseControl | ( | ) |
Add a close control.
void ui::Action::addGamepadAxisControl | ( | unsigned int | id, |
sf::Joystick::Axis | axis, | ||
Direction | dir | ||
) |
Add a gamepad axis control.
id | the id of the gamepad. |
axis | the axis of the gamepad. |
dir | the direction of the axis of the gamepad. |
void ui::Action::addGamepadButtonControl | ( | unsigned int | id, |
unsigned int | button | ||
) |
Add a gamepad button control.
id | the id of the gamepad. |
button | the button of the gamepad |
void ui::Action::addKeyControl | ( | sf::Keyboard::Key | key | ) |
void ui::Action::addMouseButtonControl | ( | sf::Mouse::Button | button | ) |
|
inline |
Get the name of the action.
bool ui::Action::isActive | ( | ) |
Tell whether the action is active.
An action is active if at least one of its control is active.
bool ui::Action::isContinuous | ( | ) | const |
Tell whether the action is continuous.
bool ui::Action::isInstantaneous | ( | ) | const |
Tell whether the action is instantaneous.
void ui::Action::reset | ( | ) |
Reset the state of the action.
This function depends of the type of the action.
void ui::Action::setContinuous | ( | ) |
Set the action continuous.
A continuous action is an action that is active as long as the user do not desactivate it. A reset() call does not desactivate the action.
void ui::Action::setInstantaneous | ( | ) |
Set the action instantaneous.
An instantaneous action is an action that is active until the next reset() call.
void ui::Action::update | ( | const sf::Event & | event | ) |
Update the state of the action thanks to an event.
event | the event to update the action. |