Platformer
Platformer
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
InputManager Class Reference

This class manages the inputs of our game as a singleton. More...

#include <InputManager.hpp>

Collaboration diagram for InputManager:
Collaboration graph

Public Member Functions

void PollInput ()
 Polls for input from the keyboard.
 
bool ShouldQuit () const
 Gets whether or not the game should quit. More...
 
 InputManager (const InputManager &)=delete
 Stop the compiler from generating methods to copy the object.
 
InputManageroperator= (const InputManager &)=delete
 Stop the compiler from generating methods to copy the object.
 

Static Public Member Functions

static InputManagerinstance ()
 The singleton instance of the InputManager.
 
static bool GetActionPressed (Input action)
 Gets whether or not the given input was just pressed. More...
 
static bool GetActionHeld (Input action)
 Gets whether or not the given input is held. More...
 
static Vector2 GetMousePos ()
 Gets the position of the most recent mouse event. More...
 

Private Member Functions

 InputManager ()
 Constructs an InputManager.
 
 ~InputManager ()
 Destructs an InputManager.
 
void ClearPresses ()
 Resets the inputPressed map to falses each frame.
 
void UpEvent (Input input)
 Called when an up event is registered for an input.
 
void DownEvent (Input input)
 Called when a down event is registered for an input.
 

Private Attributes

std::map< Input, bool > inputHeld
 Array of inputs that are currently held down.
 
std::map< Input, bool > inputPressed
 Array of inputs that were just pressed.
 
bool quitFlag
 Whether or not the game should quit.
 
Vector2 mousePos
 Location of the last mouse event.
 

Detailed Description

This class manages the inputs of our game as a singleton.

Member Function Documentation

◆ GetActionHeld()

bool InputManager::GetActionHeld ( Input  action)
static

Gets whether or not the given input is held.

Returns
Whether or not the given input is held
Parameters
actionThe input to be checked
Here is the call graph for this function:

◆ GetActionPressed()

bool InputManager::GetActionPressed ( Input  action)
static

Gets whether or not the given input was just pressed.

Returns
Whether or not the given input was just pressed
Parameters
actionThe input to be checked
Here is the call graph for this function:

◆ GetMousePos()

Vector2 InputManager::GetMousePos ( )
static

Gets the position of the most recent mouse event.

Returns
the position of the most recent mouse event.
Here is the call graph for this function:

◆ ShouldQuit()

bool InputManager::ShouldQuit ( ) const

Gets whether or not the game should quit.

Returns
Whether or not the game should quit

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