|
Avara3D 0.2.0
C++ API reference
|
Exposes keyboard, pointer-button, pointer-motion, and scroll state. More...
#include <a3d/input/DesktopInputContext.h>
Public Types | |
| enum class | Key : int |
| Identifies keyboard keys reported by desktop-style input contexts. More... | |
| enum class | MouseButton : int |
| Identifies one of up to eight pointer buttons. More... | |
Public Types inherited from a3d::InputContext | |
| using | DidUpdateCallback = std::function< void(InputContext &inputContext, const UpdateInfo &info)> |
| Callback invoked after input state has been updated for the current Runner host update. More... | |
Public Member Functions | |
| DesktopInputContext () | |
| Creates a DesktopInputContext with no active input state. More... | |
| bool | keyDown (Key key) |
Returns whether key is currently held down. More... | |
| bool | mouseButtonDown (MouseButton button) |
Returns whether button is currently held down. More... | |
| bool | keyPressed (Key key) |
Returns and consumes an unread press transition for key. More... | |
| bool | mouseButtonPressed (MouseButton button) |
Returns and consumes an unread press transition for button. More... | |
| bool | keyReleased (Key key) |
Returns and consumes an unread release transition for key. More... | |
| bool | mouseButtonReleased (MouseButton button) |
Returns and consumes an unread release transition for button. More... | |
| std::unordered_set< Key > | keysDown () |
| Returns a copy of all keys currently held down. More... | |
| std::unordered_set< MouseButton > | mouseButtonsDown () |
| Returns a copy of all pointer buttons currently held down. More... | |
| std::unordered_set< Key > | keysPressed () |
| Returns and consumes all currently unread key-press transitions. More... | |
| std::unordered_set< MouseButton > | mouseButtonsPressed () |
| Returns and consumes all currently unread pointer-button press transitions. More... | |
| const math::vec2 & | mousePosition () const |
| Returns the current pointer position in logical viewport coordinates. More... | |
| const math::vec2 & | mousePositionDelta () const |
| Returns pointer displacement observed during the current input update. More... | |
| const math::vec2 & | mouseScrollWheelDelta () const |
| Returns scroll displacement observed during the current input update. More... | |
Public Member Functions inherited from a3d::InputContext | |
| InputContext () | |
| Creates an InputContext with no did-update callback. More... | |
| DidUpdateCallback | didUpdateCallback () const |
| Returns the callback invoked after each input update. More... | |
| void | didUpdateCallback (DidUpdateCallback callback) |
| Sets the did-update callback; an empty callback disables it. More... | |
Exposes keyboard, pointer-button, pointer-motion, and scroll state.
Applications normally obtain a compatible DesktopInputContext from Window::InputContext() and install it on a Scene. Down-state queries are persistent, while pressed and released queries consume unread transitions. Pointer and scroll deltas describe the most recently completed input update.
Definition at line 27 of file DesktopInputContext.h.
|
strong |
Identifies keyboard keys reported by desktop-style input contexts.
Definition at line 33 of file DesktopInputContext.h.
|
strong |
Identifies one of up to eight pointer buttons.
Definition at line 160 of file DesktopInputContext.h.
| a3d::DesktopInputContext::DesktopInputContext | ( | ) |
Creates a DesktopInputContext with no active input state.
| bool a3d::DesktopInputContext::keyDown | ( | Key | key | ) |
Returns whether key is currently held down.
| bool a3d::DesktopInputContext::keyPressed | ( | Key | key | ) |
Returns and consumes an unread press transition for key.
| bool a3d::DesktopInputContext::keyReleased | ( | Key | key | ) |
Returns and consumes an unread release transition for key.
| std::unordered_set< Key > a3d::DesktopInputContext::keysDown | ( | ) |
Returns a copy of all keys currently held down.
| std::unordered_set< Key > a3d::DesktopInputContext::keysPressed | ( | ) |
Returns and consumes all currently unread key-press transitions.
| bool a3d::DesktopInputContext::mouseButtonDown | ( | MouseButton | button | ) |
Returns whether button is currently held down.
| bool a3d::DesktopInputContext::mouseButtonPressed | ( | MouseButton | button | ) |
Returns and consumes an unread press transition for button.
| bool a3d::DesktopInputContext::mouseButtonReleased | ( | MouseButton | button | ) |
Returns and consumes an unread release transition for button.
| std::unordered_set< MouseButton > a3d::DesktopInputContext::mouseButtonsDown | ( | ) |
Returns a copy of all pointer buttons currently held down.
| std::unordered_set< MouseButton > a3d::DesktopInputContext::mouseButtonsPressed | ( | ) |
Returns and consumes all currently unread pointer-button press transitions.
| const math::vec2 & a3d::DesktopInputContext::mousePosition | ( | ) | const |
Returns the current pointer position in logical viewport coordinates.
The origin is the upper-left corner; positive X points right and positive Y points down.
| const math::vec2 & a3d::DesktopInputContext::mousePositionDelta | ( | ) | const |
Returns pointer displacement observed during the current input update.
Positive X is rightward motion and positive Y is upward motion. The value is reset from newly accumulated pointer events on each input update.
| const math::vec2 & a3d::DesktopInputContext::mouseScrollWheelDelta | ( | ) | const |
Returns scroll displacement observed during the current input update.