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

#include <Input.h>

Collaboration diagram for Keys:
[legend]

Public Member Functions

 Keys ()
auto update (float dt) -> void
auto getInputMap () const -> const std::unordered_map< int, std::string > &
auto showMenu () -> void
auto getEnabled () const -> bool
auto setEnabled (bool newState) -> void
auto getMousePosition () const -> std::pair< float, float >
auto getMouseWorldCoords () const -> const Vector4D &

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 mouseButtonCallback (GLFWwindow *window, int pressedButton, int action, int mods) -> void
 Registers which mouse buttons are pressed.
static auto sendKeyPressedMessage (unsigned int GLFWKey) -> void
 Helper function that creates and broadcasts a message of a key being pressed.

Private Member Functions

auto setMouseWorldCoords (const Vector4D &coords) -> void
auto setImGuiMouseWorldCoords (Vector4D &pos) -> void

Private Attributes

std::unordered_map< int, std::string > inputMap
 A map that takes GLFW key codes and maps them to input event names.
bool enabled
 If this is off, we don't do anything on key press.
Vector4D mouseWorldCoords = {0.f, 0.f, 0.f, 1.f}

Constructor & Destructor Documentation

◆ Keys()

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

Member Function Documentation

◆ getEnabled()

auto Keys::getEnabled ( ) const->bool

◆ getInputMap()

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

◆ getMousePosition()

auto Keys::getMousePosition ( ) const->std::pair< float, float >
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMouseWorldCoords()

auto Keys::getMouseWorldCoords ( ) const->constVector4D &

◆ 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:

◆ mouseButtonCallback()

auto Keys::mouseButtonCallback ( GLFWwindow * window,
int pressedButton,
int action,
int mods )->void
static

Registers which mouse buttons 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

Helper function that creates and broadcasts a message of a key being pressed.

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

◆ setEnabled()

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

◆ setImGuiMouseWorldCoords()

auto Keys::setImGuiMouseWorldCoords ( Vector4D & pos) ->void
private
Here is the call graph for this function:

◆ setMouseWorldCoords()

auto Keys::setMouseWorldCoords ( const Vector4D & coords) ->void
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ showMenu()

auto Keys::showMenu ( ) ->void
Here is the call graph for this function:

◆ update()

auto Keys::update ( float dt) ->void
Here is the call graph for this function:

Member Data Documentation

◆ enabled

bool Keys::enabled
private

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

◆ inputMap

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

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

◆ mouseWorldCoords

Vector4D Keys::mouseWorldCoords = {0.f, 0.f, 0.f, 1.f}
private

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