jubilant-funicular
Public Types | Public Member Functions | Private Attributes | List of all members
nta::InputManager Class Reference

keeps track of all input More...

#include <InputManager.h>

Collaboration diagram for nta::InputManager:
Collaboration graph
[legend]

Public Types

using key_type = unsigned int
 

Public Member Functions

 InputManager (CreateInputManagerKey)
 
glm::vec2 getMouseCoords () const
 returns the mouse's coordinates
 
glm::vec2 getMouseCoordsStandard (int height) const
 returns the mouse's coordinates with the y axis flipped (0 represents the bottom of the screen instead of top)
 
MouseWheelMotion getMouseWheelMotion () const
 returns the mouse wheel's motion
 
bool isPressed (key_type key) const
 returns whether or not specified key is pressed
 
bool justPressed (key_type key) const
 returns whether or not the key was just pressed this frame
 
bool justReleased (key_type key) const
 returns whether or not the key was just released this frame
 
void pressKey (key_type key)
 tells InputManager that specified key was pressed
 
void releaseKey (key_type key)
 tells InputManager that specified key was released
 
void setMouseCoords (float x, float y)
 tells InputManager where the mouse is
 
void setMouseWheelMotion (const MouseWheelMotion &motion)
 tells InputManager how the wheel is rolling
 
void update (SDL_Event &event)
 updates internal state
 
void update_keys (SDL_Event &event)
 updates key information
 
void update_mouse (SDL_Event &event)
 update mouse information
 
void updatePrev ()
 updates the state of m_prevKeyMap
 

Private Attributes

std::unordered_map< key_type, bool > m_keyMap
 stores whether each key is pressed or not
 
std::unordered_map< key_type, bool > m_prevKeyMap
 stores whether the key was pressed last frame or not
 
glm::vec2 m_mouseCoords
 stores the location of the mouse in mouse coordinates
 
MouseWheelMotion m_mouseWheelMotion
 stores the motion of the mouse wheel
 

Detailed Description

keeps track of all input

Definition at line 20 of file InputManager.h.


The documentation for this class was generated from the following files: