![]() |
Copperfield Engine 0.1
C++ Game Engine
|
Interface to retrieve keyboard and mouse input. More...
#include <input.hpp>
Public Member Functions | |
| InputManager (const Window &window, InputButtonMap input_button_map) | |
| Creates and binds an input map. More... | |
| void | setCursorMode (CursorMode mode) const |
| Overrides the CursorMode of the Window. More... | |
| void | toggleCursor () const |
| Alternates the CursorMode between Normal and Disabled. More... | |
| bool | buttonDown (const std::string &action) const |
| Checks if any of the buttons assigned to an action have been pressed during the frame. More... | |
| bool | buttonUp (const std::string &action) const |
| Checks if any of the buttons assigned to an action have been released during the frame. More... | |
| bool | buttonPressed (const std::string &action) const |
| Checks if any of the buttons assigned to an action is currently held down More... | |
| coma::Vec2 | getMousePosition () const |
| Gets the position of the mouse. More... | |
| coma::Vec2 | getMouseOffset () const |
| Gets the pixels the mouse has displaced since the last frame. More... | |
| coma::Vec3 | getMouseRotation (const coma::Vec3 &start_rotation) const |
| Gets an updated rotation based on the mouse offset. More... | |
| void | setMouseRotation (coma::Vec3 &start_rotation, float sensitivity=1.0f) const |
| Updates a rotation based on the mouse offset. More... | |
Interface to retrieve keyboard and mouse input.
This class is closely related to the InputButtonMap.
| InputManager::InputManager | ( | const Window & | window, |
| InputButtonMap | input_button_map | ||
| ) |
Creates and binds an input map.
| window | Window handle reference |
| input_button_map | Map to bind |
| bool InputManager::buttonDown | ( | const std::string & | action | ) | const |
Checks if any of the buttons assigned to an action have been pressed during the frame.
| action | Action to check |
| bool InputManager::buttonPressed | ( | const std::string & | action | ) | const |
Checks if any of the buttons assigned to an action is currently held down
| action | Action to check |
| bool InputManager::buttonUp | ( | const std::string & | action | ) | const |
Checks if any of the buttons assigned to an action have been released during the frame.
| action | Action to check |
| coma::Vec2 InputManager::getMouseOffset | ( | ) | const |
Gets the pixels the mouse has displaced since the last frame.
| coma::Vec2 InputManager::getMousePosition | ( | ) | const |
Gets the position of the mouse.
Gets the position of the mouse in pixels relative to the top-left corner.
| coma::Vec3 InputManager::getMouseRotation | ( | const coma::Vec3 & | start_rotation | ) | const |
Gets an updated rotation based on the mouse offset.
| start_rotation | Rotation to update in euler |
Can be useful for a first-person camera.
| void InputManager::setCursorMode | ( | CursorMode | mode | ) | const |
Overrides the CursorMode of the Window.
| mode | Mode to use |
| void InputManager::setMouseRotation | ( | coma::Vec3 & | start_rotation, |
| float | sensitivity = 1.0f |
||
| ) | const |
Updates a rotation based on the mouse offset.
| start_rotation | Rotation to update in euler |
| sensitivity | Rotation speed multiplier |
Can be useful for a first-person camera.