Represents various input action types, such as buttons, axes (controller trigger, mouse wheel), vectors (mouse, thumb stick), and multi-button combinations.
More...
|
| | Action (Action &&o) |
| |
|
| Action (const Action &)=delete |
| |
| | Action (Type t, Data d={.button={nullptr, false, 0}}) |
| |
| Action & | AddCallback (is::signals::signal< void(float state, float delta)>::slot_type callback) |
| |
| Action & | AddCallbackNamed (is::signals::signal< void(const std::string_view name, float state, float delta)>::slot_type callback) |
| |
| Action & | AddFloatCallback (is::signals::signal< void(float state, float delta)>::slot_type callback) |
| |
| Action & | AddFloatCallbackNamed (is::signals::signal< void(const std::string_view name, float state, float delta)>::slot_type callback) |
| |
| Action & | AddPressedCallback (is::signals::signal< void()>::slot_type callback) |
| |
| Action & | AddPressedCallbackNamed (is::signals::signal< void(const std::string_view name)>::slot_type callback) |
| |
| Action & | AddReleasedCallback (is::signals::signal< void()>::slot_type callback) |
| |
| Action & | AddReleasedCallbackNamed (is::signals::signal< void(const std::string_view name)>::slot_type callback) |
| |
| Action & | AddVectorCallback (is::signals::signal< void(Vector2 state, Vector2 delta)>::slot_type callback) |
| |
| Action & | AddVectorCallbackNamed (is::signals::signal< void(const std::string_view name, Vector2 state, Vector2 delta)>::slot_type callback) |
| |
| Action && | Move () |
| | Helper function which moves the action, equivalent to calling std::move but can be chained for convenience. More...
|
| |
| Action && | move () |
| |
| Action & | operator= (Action &&o) |
| |
|
Action & | operator= (const Action &)=delete |
| |
| void | PollEvents (std::string_view name) |
| | Function which updates the state of the action and invokes the callback if a change occured. More...
|
| |
| Action & | SetCallback (is::signals::signal< void(float state, float delta)>::slot_type callback) |
| |
| Action & | SetCallbackNamed (is::signals::signal< void(const std::string_view name, float state, float delta)>::slot_type callback) |
| |
| Action & | SetFloatCallback (is::signals::signal< void(float state, float delta)>::slot_type callback) |
| |
| Action & | SetFloatCallbackNamed (is::signals::signal< void(const std::string_view name, float state, float delta)>::slot_type callback) |
| |
| Action & | SetPressedCallback (is::signals::signal< void()>::slot_type callback) |
| |
| Action & | SetPressedCallbackNamed (is::signals::signal< void(const std::string_view name)>::slot_type callback) |
| |
| Action & | SetReleasedCallback (is::signals::signal< void()>::slot_type callback) |
| |
| Action & | SetReleasedCallbackNamed (is::signals::signal< void(const std::string_view name)>::slot_type callback) |
| |
| Action & | SetVectorCallback (is::signals::signal< void(Vector2 state, Vector2 delta)>::slot_type callback) |
| |
| Action & | SetVectorCallbackNamed (is::signals::signal< void(const std::string_view name, Vector2 state, Vector2 delta)>::slot_type callback) |
| |
|
| static Action | button (Button button, bool combo=false) |
| | Action that is invoked whenever the abstract button is pressed. More...
|
| |
| static Action | button_axis (ButtonSet positive, ButtonSet negative, bool normalize=true) |
| | Action that combines button sets pointing in 2 opposing directions into a signed value which represents the direction of the currently pressed buttons. More...
|
| |
| static Action | button_pair (ButtonSet left, ButtonSet right, bool normalize=true) |
| | Action that combines button sets pointing in 2 opposing directions into a signed value which represents the direction of the currently pressed buttons. More...
|
| |
| static Action | button_set (ButtonSet buttons={}, bool combo=false) |
| | Action that is invoked whenever the one of the collection of buttons are pressed. More...
|
| |
| static Action | gamepad_axes (GamepadAxis horizontal=GAMEPAD_AXIS_LEFT_X, GamepadAxis vertical=GAMEPAD_AXIS_LEFT_Y, int gamepadHorizontal=0, int gamepadVertical=-1) |
| | Action that merges two seperate gamepad axis into a single vector. More...
|
| |
| static Action | gamepad_axis (GamepadAxis axis=GAMEPAD_AXIS_LEFT_X, int gamepad=0) |
| | Action that is invoked whenever the gamepad axis (usually triggers) is de/pressed. More...
|
| |
| static Action | gamepad_button (GamepadButton b, int gamepad=0, bool combo=false) |
| | Action that is invoked whenever the gamepad button is pressed. More...
|
| |
| static Action | joy (GamepadButton b, int gamepad=0, bool combo=false) |
| | Action that is invoked whenever the gamepad button is pressed. More...
|
| |
| static Action | key (KeyboardKey key, bool combo=false) |
| | Action that is invoked whenever the keyboard key is pressed. More...
|
| |
| static Action | mouse_button (MouseButton b, bool combo=false) |
| | Action that is invoked whenever the mouse button is pressed. More...
|
| |
| static Action | mouse_position () |
| | Action that is invoked whenever the mouse moves. More...
|
| |
| static Action | mouse_wheel () |
| | Action that is invoked whenever the mouse wheel is adjusted. More...
|
| |
| static Action | mouse_wheel_vector () |
| | Action that is invoked whenever the mouse wheel is adjusted (also supports wheels that can tilt side to side). More...
|
| |
| static Action | pad (GamepadButton b, int gamepad=0, bool combo=false) |
| | Action that is invoked whenever the gamepad button is pressed. More...
|
| |
| static Action | quad (ButtonSet up, ButtonSet down, ButtonSet left, ButtonSet right, bool normalized=true) |
| | Action that combines button sets pointing in 4 cardinal directions into a vector which represents the direction of the currently pressed buttons. More...
|
| |
| static Action | wasd (ButtonSet up={Button::key(KEY_W), Button::key(KEY_UP)}, ButtonSet left={Button::key(KEY_A), Button::key(KEY_LEFT)}, ButtonSet down={Button::key(KEY_S), Button::key(KEY_DOWN)}, ButtonSet right={Button::key(KEY_D), Button::key(KEY_RIGHT)}, bool normalized=true) |
| | Action that combines button sets pointing in 4 cardinal directions into a vector which represents the direction of the currently pressed buttons. More...
|
| |
Represents various input action types, such as buttons, axes (controller trigger, mouse wheel), vectors (mouse, thumb stick), and multi-button combinations.
Definition at line 137 of file BufferedRaylib.hpp.
| static Action raylib::Action::button |
( |
Button |
button, |
|
|
bool |
combo = false |
|
) |
| |
|
inlinestatic |
Action that is invoked whenever the abstract button is pressed.
Callback signature: [](const std::string_view name, uint8_t pressed, bool wasPressed) -> void; The value in pressed represents how many buttons in the set are currently pressed
- Parameters
-
| button | the button to listen for |
| combo | wether all of the buttons in the set need to be pressed for a trigger (defaults to only a single button needing to be pressed) |
- Returns
- Action
Definition at line 351 of file BufferedRaylib.hpp.
References button().
Referenced by button(), key(), mouse_button(), and pad().
| static Action raylib::Action::button_axis |
( |
ButtonSet |
positive, |
|
|
ButtonSet |
negative, |
|
|
bool |
normalize = true |
|
) |
| |
|
inlinestatic |
Action that combines button sets pointing in 2 opposing directions into a signed value which represents the direction of the currently pressed buttons.
Callback signature: [](const std::string_view name, float dir, float delta) -> void
- Parameters
-
| positive | set of keys to represent the positive direction |
| negative | set of keys to represent the negative direction |
| normalized | normally if there is more than one button in a set, the value will grow to reflect how many buttons are pushed. While true the absolute value will never excede 1. |
- Returns
- Action
Definition at line 457 of file BufferedRaylib.hpp.
Referenced by button_pair().
| static Action raylib::Action::button_pair |
( |
ButtonSet |
left, |
|
|
ButtonSet |
right, |
|
|
bool |
normalize = true |
|
) |
| |
|
inlinestatic |
Action that combines button sets pointing in 2 opposing directions into a signed value which represents the direction of the currently pressed buttons.
Callback signature: [](const std::string_view name, float dir, float delta) -> void
- Parameters
-
| left | set of keys to represent left (negative) axis |
| right | set of keys to represent right (positive) axis |
| normalized | normally if there is more than one button in a set, the value will grow to reflect how many buttons are pushed. While true the absolute value will never excede 1. |
- Returns
- Action
Definition at line 474 of file BufferedRaylib.hpp.
References button_axis().
| static Action raylib::Action::key |
( |
KeyboardKey |
key, |
|
|
bool |
combo = false |
|
) |
| |
|
inlinestatic |
Action that is invoked whenever the keyboard key is pressed.
Callback signature: [](const std::string_view name, uint8_t pressed, bool wasPressed) -> void; The value in pressed represents how many buttons in the set are currently pressed
- Parameters
-
| key | the key to listen for |
| combo | wether all of the buttons in the set need to be pressed for a trigger (defaults to only a single button needing to be pressed) |
- Returns
- Action
Definition at line 362 of file BufferedRaylib.hpp.
References button(), and key().
Referenced by key().
| static Action raylib::Action::pad |
( |
GamepadButton |
b, |
|
|
int |
gamepad = 0, |
|
|
bool |
combo = false |
|
) |
| |
|
inlinestatic |
Action that is invoked whenever the gamepad button is pressed.
Callback signature: [](const std::string_view name, uint8_t pressed, bool wasPressed) -> void; The value in pressed represents how many buttons in the set are currently pressed
- Parameters
-
| b | the button to listen for |
| gamepad | id of the gamepad to listen for (default 0) |
| combo | wether all of the buttons in the set need to be pressed for a trigger (defaults to only a single button needing to be pressed) |
- Returns
- Action
Definition at line 385 of file BufferedRaylib.hpp.
References button().
Referenced by gamepad_button(), and joy().
| static Action raylib::Action::quad |
( |
ButtonSet |
up, |
|
|
ButtonSet |
down, |
|
|
ButtonSet |
left, |
|
|
ButtonSet |
right, |
|
|
bool |
normalized = true |
|
) |
| |
|
inlinestatic |
Action that combines button sets pointing in 4 cardinal directions into a vector which represents the direction of the currently pressed buttons.
ex. If the up and left buttons are pressed, the resulting vector will be pointing upward and leftward. Callback signature: [](const std::string_view name, Vector2 dir, Vector2 delta) -> void
- Parameters
-
| up | set of keys to represent up (+y) axis |
| down | set of keys to represent down (-y) axis |
| left | set of keys to represent left (-x) axis |
| right | set of keys to represent right (+x) axis |
| normalized | normally if there is more than one button in a set, the vector's length will grow to reflect how many buttons are pushed. While true none of the vector's axis will ever excede 1. |
- Note
- The resulting vector itself will not be normalized! If you need it to have a length of 1 you will be on your own...
- Returns
- Action
Definition at line 524 of file BufferedRaylib.hpp.
Action that combines button sets pointing in 4 cardinal directions into a vector which represents the direction of the currently pressed buttons.
ex. If the up and left buttons are pressed, the resulting vector will be pointing upward and leftward. Callback signature: [](const std::string_view name, Vector2 dir, Vector2 delta) -> void
- Note
- This function is the same as quad, but the parameter order is changed to represent the common wasd convetion (and defaults are set to support it)
- Parameters
-
| up | set of keys to represent up (+y) axis (default up arrow and w) |
| left | set of keys to represent left (-x) axis (default left arrow and a) |
| down | set of keys to represent down (-y) axis (default down arrow and s) |
| right | set of keys to represent right (+x) axis (default right arrow and d) |
| normalized | when true the resulting vector is normalized so that it always has a length of one (default true) |
- Returns
- Action
Definition at line 545 of file BufferedRaylib.hpp.
References raylib::Button::key().