Brunot
Loading...
Searching...
No Matches
Keys Class Reference

Class that can interact with the keyboard. More...

#include <Keys.h>

Collaboration diagram for Keys:
[legend]

Public Member Functions

 Keys ()
auto update () -> void
auto showMenu () -> void
auto getInputMap () const -> const std::unordered_map< int, std::string > &
 Returns the map of glfw mouse button codes.
auto getEnabled () const -> bool
 Returns if key input is currently enabled or not.
auto setEnabled (bool newState) -> void
 Sets whether input from the keyboard is accepted or not.

Static Public Member Functions

static auto keyCallback (GLFWwindow *window, int pressedKey, int scancode, int action, int mods) -> void
 Registers which keys are pressed.
static auto sendKeyPressedMessage (unsigned int GLFWKey) -> void
 Callback used by GLFW whenever a button on the keyboard is pressed/released. Broadcasts a message on press.
static constexpr auto getKeyDeviceID () -> int
 Used to keep our use of the Key input device ID consistent.

Private Attributes

std::unordered_map< int, std::string > keyMap
 A map that takes GLFW mouse button codes and maps them to input event names.
bool enabled
 If this is off, we don't do anything on key press.

Static Private Attributes

static constexpr auto keyDeviceID = -1
 ID representing all key input done.

Detailed Description

Class that can interact with the keyboard.

@Keys.h

Constructor & Destructor Documentation

◆ Keys()

Keys::Keys ( )
Here is the call graph for this function:

Member Function Documentation

◆ getEnabled()

auto Keys::getEnabled ( ) const->bool

Returns if key input is currently enabled or not.

◆ getInputMap()

auto Keys::getInputMap ( ) const->conststd::unordered_map< int, std::string > &

Returns the map of glfw mouse button codes.

◆ getKeyDeviceID()

constexpr auto Keys::getKeyDeviceID ( ) ->int
inlinestaticconstexpr

Used to keep our use of the Key input device ID consistent.

Here is the caller graph for this function:

◆ keyCallback()

auto Keys::keyCallback ( GLFWwindow * window,
int pressedKey,
int scancode,
int action,
int mods )->void
static

Registers which keys are pressed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendKeyPressedMessage()

auto Keys::sendKeyPressedMessage ( unsigned int GLFWKey) ->void
static

Callback used by GLFW whenever a button on the keyboard is pressed/released. Broadcasts a message on press.

Todo
: Add proper logging for this
Here is the call graph for this function:

◆ setEnabled()

auto Keys::setEnabled ( bool newState) ->void

Sets whether input from the keyboard is accepted or not.

◆ showMenu()

auto Keys::showMenu ( ) ->void

◆ update()

auto Keys::update ( ) ->void

Member Data Documentation

◆ enabled

bool Keys::enabled
private

If this is off, we don't do anything on key press.

◆ keyDeviceID

auto Keys::keyDeviceID = -1
staticconstexprprivate

ID representing all key input done.

◆ keyMap

std::unordered_map<int, std::string> Keys::keyMap
private

A map that takes GLFW mouse button codes and maps them to input event names.


The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Framework/Keys.h
  • /home/egrazil/sites/Brunot/The House/source/Framework/Keys.cpp