Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Engine::Input::Input Class Reference

A class used to represent a single input in an InputManager. More...

#include <Input.hpp>

Public Member Functions

 Input (InputParams params)
 The main constructor intended to be used by an InputManager.
 
 Input ()
 
 ~Input ()
 
void Update ()
 Updates the state of each possible input solution.
 
bool IsPressed () const
 Checks if the input is just pressed.
 
bool IsReleased () const
 Checks if the input is just released.
 
bool IsDown () const
 Checks if the input is down.
 
float Strength () const
 
char GetInput (InputDevice mode) const
 

Public Attributes

float currentStrength = 0
 

Detailed Description

A class used to represent a single input in an InputManager.

Used as a compositional class to the InputManager class, this object will get linked to an input device singleton.

Your input is a combination of the following:

Constructor & Destructor Documentation

◆ Input() [1/2]

Engine::Input::Input::Input ( InputParams  params)

The main constructor intended to be used by an InputManager.

Takes in a keycode, mouse button, and/or gamepad input in that order. The input will automatically be linked to one of the possible input device classes.

Parameters
paramsThe parameters of the input

◆ Input() [2/2]

Engine::Input::Input::Input ( )
inline

@breif Base Constructor

The default constructor that is not linked to any input.

◆ ~Input()

Engine::Input::Input::~Input ( )

Object Destructor

Member Function Documentation

◆ GetInput()

char Engine::Input::Input::GetInput ( InputDevice  mode) const

Returns the input parameter for the given device

Specific Cases

These are the specific cases based on the input device:

  • KEYBOARD: Returns the key code
  • MOUSE: Returns the mouse button
  • GAMEPAD: Returns the gamepad input
Parameters
modeThe input device
Returns
The input parameter. If there is an error with the input device, returns an Engine::Success::FAILURE as a char

◆ IsDown()

bool Engine::Input::Input::IsDown ( ) const

Checks if the input is down.

Returns
True if the input is down

◆ IsPressed()

bool Engine::Input::Input::IsPressed ( ) const

Checks if the input is just pressed.

Returns
True if the input is just pressed

◆ IsReleased()

bool Engine::Input::Input::IsReleased ( ) const

Checks if the input is just released.

Returns
True if the input is just released

◆ Strength()

float Engine::Input::Input::Strength ( ) const

Returns the input strength of the current input

Returns
a value between 0 and 1 on the magnitude of the input

◆ Update()

void Engine::Input::Input::Update ( )

Updates the state of each possible input solution.

Override currentStrength first with a value between 0 and 1 to indicate the strength of the input to update to. This will update pressed, released, and strength values of the input.

Warning
This should only be called by the InputManager

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