Rubeus::RInputManager class

The Input manager. Manages key strokes, mouse buttons, and cursor/scroll inputs.

Base classes

class RMasterComponent
A master component. Serves as parent class for all components.

Public static variables

static std::unordered_map<int, bool> KeyMap
Mapping of all keys and the bool value of whether they are being pressed.
static std::unordered_map<int, bool> MouseButtonMap
Mapping of all mouse buttons and the bool value of whether they are being pressed.
static RML::Vector2D MousePosition
Mouse position of the current active cursor.
static RML::Vector2D MouseScroll
Scroll value being inputted to input manager.

Constructors, destructors, conversion operators

RInputManager(const GraphicComponents::RWindowComponent* window)
Constructor.
~RInputManager() virtual
Destructor.

Public functions

void addKeyToKeyBinding(const std::string& keyBinding, const EKeyboardKeys& keyName)
Add a key to a keybinding.
void addKeysToKeyBinding(const std::string& keyBinding, const std::vector<EKeyboardKeys>& keyNames)
Add an array of keys to a keybinding.
void activate(const std::string& keyBinding)
Activate a keybinding.
void deactivate(const std::string& keyBinding)
Deactivate a keybinding.
auto isKeyBindingPressed(const std::string& keyBinding) -> bool
Check if a key corresponding to a keybinding is being used.
auto isKeyPressed(const EKeyboardKeys& keyName) -> bool
Check whether a key is being pressed.
auto isMouseButtonPressed(const EMouseButtons& buttonName) -> bool
Check whether a mouse button is being pressed.
auto getMousePosition() const -> const RML::Vector2D&
Get the current mouse position.
auto getMouseScroll() const -> const RML::Vector2D&
Get the current mouse scroll values.
void enable()
Enable the Input Manager. All input queries will function normally.
void disable()
Disable the Input Manager. All input queries will return false.
void InputManager_ok(var data = NULL)
Checks if input manager is ready for use.

Function documentation

Rubeus::RInputManager::RInputManager(const GraphicComponents::RWindowComponent* window)

Constructor.

Parameters
window The window object in current use.

void Rubeus::RInputManager::addKeyToKeyBinding(const std::string& keyBinding, const EKeyboardKeys& keyName)

Add a key to a keybinding.

Parameters
keyBinding Name of the keybinding.
keyName Name of the key.

void Rubeus::RInputManager::addKeysToKeyBinding(const std::string& keyBinding, const std::vector<EKeyboardKeys>& keyNames)

Add an array of keys to a keybinding.

Parameters
keyBinding Name of the keybinding.
keyNames Array of names of the keys.

void Rubeus::RInputManager::activate(const std::string& keyBinding)

Activate a keybinding.

Parameters
keyBinding The keybinding to be activated.

void Rubeus::RInputManager::deactivate(const std::string& keyBinding)

Deactivate a keybinding.

Parameters
keyBinding The keybinding to be deactivated.

bool Rubeus::RInputManager::isKeyBindingPressed(const std::string& keyBinding)

Check if a key corresponding to a keybinding is being used.

Parameters
keyBinding The keybinding to be checked for use.
Returns Whether any of the keys linked with the keybinding are being pressed.

bool Rubeus::RInputManager::isKeyPressed(const EKeyboardKeys& keyName)

Check whether a key is being pressed.

Parameters
keyName The key to be checked for presses.
Returns Whether the key is being pressed.

bool Rubeus::RInputManager::isMouseButtonPressed(const EMouseButtons& buttonName)

Check whether a mouse button is being pressed.

Parameters
buttonName The button to be checked for presses.
Returns Whether the mouse button is being pressed.

const RML::Vector2D& Rubeus::RInputManager::getMousePosition() const

Get the current mouse position.

Returns Vector2D of the mouse position.

const RML::Vector2D& Rubeus::RInputManager::getMouseScroll() const

Get the current mouse scroll values.

Returns Vector2D of the mouse scroll values.

void Rubeus::RInputManager::enable()

Enable the Input Manager. All input queries will function normally.

void Rubeus::RInputManager::disable()

Disable the Input Manager. All input queries will return false.

void Rubeus::RInputManager::InputManager_ok(var data = NULL)

Checks if input manager is ready for use.

Parameters
data NULL