Class for dynamic actions that are connected with SFML events. More...
Public Types | |
enum | ActionType { Hold, PressOnce, ReleaseOnce } |
Type for actions. More... | |
Public Member Functions | |
Action (sf::Keyboard::Key key, ActionType action=Hold) | |
Construct key action. More... | |
Action (sf::Mouse::Button mouseButton, ActionType action=Hold) | |
Construct mouse button action. More... | |
Action (JoystickButton joystickState, ActionType action=Hold) | |
Construct joystick button action. More... | |
Action (JoystickAxis joystickAxis) | |
Construct joystick axis action. More... | |
Action (sf::Event::EventType eventType) | |
Construct SFML event action. More... | |
Related Functions | |
Action | operator|| (const Action &lhs, const Action &rhs) |
OR operator of two actions: The resulting action is in effect if at least one of lhs and rhs is active. More... | |
Action | operator&& (const Action &lhs, const Action &rhs) |
AND operator of two actions: The resulting action is in effect if both lhs and rhs are active. More... | |
Action | operator! (const Action &action) |
NOT operator of an action: The resulting action is in effect if action is not active. More... | |
Action | eventAction (std::function< bool(const sf::Event &)> filter) |
Creates a custom action that operates on events. More... | |
Action | realtimeAction (std::function< bool()> filter) |
Creates a custom action that operates on realtime input. More... | |
Class for dynamic actions that are connected with SFML events.
Use this class to build complex constellations of different events (key strokes, pressed mouse buttons, etc.) and associate it with a ActionMap instance.
|
explicit |
Construct key action.
Creates an action that is in effect when key is manipulated. The second parameter specifies whether KeyPressed events, KeyReleased events or sf::Keyboard::isKeyPressed() act as action source.
|
explicit |
Construct mouse button action.
Creates an action that is in effect when mouseButton is manipulated. The second parameter specifies whether MouseButtonPressed events, MouseButtonReleased events or sf::Mouse::isButtonPressed() act as action source.
|
explicit |
Construct joystick button action.
Creates an action that is in effect when the joystick button stored in joystickState is manipulated. The second parameter specifies whether JoyButtonPressed events, JoyButtonReleased events or sf::Joystick::isButtonPressed() act as action source.
|
explicit |
Construct joystick axis action.
Creates an action that is in effect when the absolute value of the joystick axis position exceeds a threshold (both axis and threshold are stored in joystickAxis). The source of the action is sf::Joystick::getAxisPosition() and not JoystickMoved events. This implies that the action will also be active if the axis remains unchanged in a position above the threshold.
|
explicit |
Construct SFML event action.
Creates an action that is in effect when a SFML event of the type eventType is fired.