Arcade Shooter
Public Member Functions | Static Public Attributes | Friends | List of all members
KatanaEngine::InputState Class Reference

Handles the state of multiple player input devices. More...

#include <InputState.h>

Public Member Functions

bool IsKeyDown (Key key) const
 Determines if a keyboard key is currently being pressed down. More...
 
bool IsKeyUp (Key key) const
 Determines if a keyboard key is currently not being pressed down. More...
 
bool IsNewKeyPress (Key key) const
 Determines if a keyboard key was just pressed this frame. More...
 
bool IsNewKeyRelease (Key key) const
 Determines if a keyboard key was just released this frame. More...
 
Point GetMousePosition () const
 Gets the current screen position of the mouse cursor. More...
 
bool IsMouseButtonDown (MouseButton button) const
 Determines if a mouse button is currently being pressed down. More...
 
bool IsMouseButtonUp (MouseButton button) const
 Determines if a mouse button is currently not being pressed down. More...
 
bool WasMouseButtonDown (MouseButton button) const
 Determines if a mouse button was being pressed down during the previous frame. More...
 
bool WasMouseButtonUp (MouseButton button) const
 Determines if a mouse button was not being pressed down during the previous frame. More...
 
bool IsNewMouseButtonPress (MouseButton button) const
 Determines if a mouse button was just pressed this frame. More...
 
bool IsNewMouseButtonRelease (MouseButton button) const
 Determines if a mouse button was just released this frame. More...
 
bool IsButtonUp (Button button, int8_t &indexOut, int8_t controllingIndex=-1) const
 Determines if a the button on an Xbox controller is up. More...
 
bool IsButtonDown (Button button, int8_t &indexOut, int8_t controllingIndex=-1) const
 Determines if a the button on an Xbox controller is down. More...
 
bool IsNewButtonPress (Button button, int8_t &indexOut, int8_t controllingIndex=-1) const
 Determines if a the button on an Xbox controller was just pressed this frame. More...
 
bool IsNewButtonRelease (Button button, int8_t &indexOut, int8_t controllingIndex=-1) const
 Determines if a the button on an Xbox controller just released this frame. More...
 
GamePadState GetGamePadState (const int8_t gamePadIndex) const
 Get the current state of an Xbox controller. More...
 

Static Public Attributes

static const uint8_t MAX_NUM_GAMEPADSTATES = 4
 The maximum number of Xbox controllers that the system can manage.
 

Friends

class Game
 

Detailed Description

Handles the state of multiple player input devices.

Member Function Documentation

◆ GetGamePadState()

GamePadState KatanaEngine::InputState::GetGamePadState ( const int8_t  gamePadIndex) const

Get the current state of an Xbox controller.

Parameters
gamePadIndexThe index of the desired game pad state.
Returns
The game pad's current state.

◆ GetMousePosition()

Point KatanaEngine::InputState::GetMousePosition ( ) const
inline

Gets the current screen position of the mouse cursor.

Returns
Returns the mouse position coordinates.

◆ IsButtonDown()

bool KatanaEngine::InputState::IsButtonDown ( Button  button,
int8_t &  indexOut,
int8_t  controllingIndex = -1 
) const

Determines if a the button on an Xbox controller is down.

Parameters
buttonThe button to test.
indexOutThe index of the controller with the pressed button.
controllingIndexThe index of the controller to test. If the controllingIndex is not valid, all controllers will be tested indexOut will be set to the first detected index matching the condition.
Returns
Returns true if the button is down, false otherwise.

◆ IsButtonUp()

bool KatanaEngine::InputState::IsButtonUp ( Button  button,
int8_t &  indexOut,
int8_t  controllingIndex = -1 
) const

Determines if a the button on an Xbox controller is up.

Parameters
buttonThe button to test.
indexOutThe index of the controller with the released button.
controllingIndexThe index of the controller to test. If the controllingIndex is not valid, all controllers will be tested indexOut will be set to the first detected index matching the condition.
Returns
Returns true if the button is up, false otherwise.

◆ IsKeyDown()

bool KatanaEngine::InputState::IsKeyDown ( Key  key) const

Determines if a keyboard key is currently being pressed down.

Parameters
keyThe key to test.
Returns
Returns true if the key is down, false otherwise.

◆ IsKeyUp()

bool KatanaEngine::InputState::IsKeyUp ( Key  key) const

Determines if a keyboard key is currently not being pressed down.

Parameters
keyThe key to test.
Returns
Returns true if the key is up, false otherwise.

◆ IsMouseButtonDown()

bool KatanaEngine::InputState::IsMouseButtonDown ( MouseButton  button) const
inline

Determines if a mouse button is currently being pressed down.

Parameters
buttonThe button to test.
Returns
Returns true if the button is down, false otherwise.

◆ IsMouseButtonUp()

bool KatanaEngine::InputState::IsMouseButtonUp ( MouseButton  button) const
inline

Determines if a mouse button is currently not being pressed down.

Parameters
buttonThe button to test.
Returns
Returns true if the button is up, false otherwise.

◆ IsNewButtonPress()

bool KatanaEngine::InputState::IsNewButtonPress ( Button  button,
int8_t &  indexOut,
int8_t  controllingIndex = -1 
) const

Determines if a the button on an Xbox controller was just pressed this frame.

Parameters
buttonThe button to test.
indexOutThe index of the controller with the pressed button.
controllingIndexThe index of the controller to test. If the controllingIndex is not valid, all controllers will be tested indexOut will be set to the first detected index matching the condition.
Returns
Returns true if the button was just pressed, false otherwise.

◆ IsNewButtonRelease()

bool KatanaEngine::InputState::IsNewButtonRelease ( Button  button,
int8_t &  indexOut,
int8_t  controllingIndex = -1 
) const

Determines if a the button on an Xbox controller just released this frame.

Parameters
buttonThe button to test.
indexOutThe index of the controller with the released button.
controllingIndexThe index of the controller to test. If the controllingIndex is not valid, all controllers will be tested indexOut will be set to the first detected index matching the condition.
Returns
Returns true if the button was just released, false otherwise.

◆ IsNewKeyPress()

bool KatanaEngine::InputState::IsNewKeyPress ( Key  key) const

Determines if a keyboard key was just pressed this frame.

Parameters
keyThe key to test.
Returns
Returns true if the key was just pressed, false otherwise.

◆ IsNewKeyRelease()

bool KatanaEngine::InputState::IsNewKeyRelease ( Key  key) const

Determines if a keyboard key was just released this frame.

Parameters
keyThe key to test.
Returns
Returns true if the key was just released, false otherwise.

◆ IsNewMouseButtonPress()

bool KatanaEngine::InputState::IsNewMouseButtonPress ( MouseButton  button) const
inline

Determines if a mouse button was just pressed this frame.

Parameters
buttonThe button to test.
Returns
Returns true if the button was just pressed, false otherwise.

◆ IsNewMouseButtonRelease()

bool KatanaEngine::InputState::IsNewMouseButtonRelease ( MouseButton  button) const
inline

Determines if a mouse button was just released this frame.

Parameters
buttonThe button to test.
Returns
Returns true if the button was just released, false otherwise.

◆ WasMouseButtonDown()

bool KatanaEngine::InputState::WasMouseButtonDown ( MouseButton  button) const
inline

Determines if a mouse button was being pressed down during the previous frame.

Parameters
buttonThe button to test.
Returns
Returns true if the button was down during the last frame, false otherwise.

◆ WasMouseButtonUp()

bool KatanaEngine::InputState::WasMouseButtonUp ( MouseButton  button) const
inline

Determines if a mouse button was not being pressed down during the previous frame.

Parameters
buttonThe button to test.
Returns
Returns true if the button was up during the last frame, false otherwise.

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