Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
KeyboardManager Class Reference

#include <KeyboardManager.h>

Public Member Functions

 KeyboardManager ()
 
virtual ~KeyboardManager ()
 
void Initialize ()
 
void Shutdown ()
 
void HandleEvent (const SDL_Event *ev)
 
void BeginFrame ()
 
bool IsKeyHeld (SDL_Scancode sc)
 
bool IsKeyPressed (SDL_Scancode sc)
 
bool IsKeyReleased (SDL_Scancode sc)
 

Static Public Member Functions

static KeyboardManagerGetInstance ()
 
static KeyboardManagerGet ()
 

Private Member Functions

void PostKeyEvent (SDL_KeyboardEvent const &ke)
 

Private Attributes

std::string name
 
std::mutex m_mutex
 
bool m_keyStates [SDL_SCANCODE_COUNT] = {false}
 
bool m_keysPressedThisFrame [SDL_SCANCODE_COUNT] = {false}
 
bool m_keysReleasedThisFrame [SDL_SCANCODE_COUNT] = {false}
 

Detailed Description

Definition at line 9 of file KeyboardManager.h.

Constructor & Destructor Documentation

◆ KeyboardManager()

KeyboardManager::KeyboardManager ( )
inline

Definition at line 12 of file KeyboardManager.h.

References Initialize(), and name.

+ Here is the call graph for this function:

◆ ~KeyboardManager()

virtual KeyboardManager::~KeyboardManager ( )
inlinevirtual

Definition at line 17 of file KeyboardManager.h.

References Shutdown().

+ Here is the call graph for this function:

Member Function Documentation

◆ BeginFrame()

void KeyboardManager::BeginFrame ( )

Definition at line 27 of file KeyboardManager.cpp.

References GetComponentTypeID_Static(), m_keysPressedThisFrame, m_keysReleasedThisFrame, and m_mutex.

Referenced by SDL_AppEvent(), and SDL_AppIterate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Get()

static KeyboardManager & KeyboardManager::Get ( )
inlinestatic

Definition at line 23 of file KeyboardManager.h.

References GetInstance().

Referenced by InputsManager::HandleEvent(), InputMappingSystem::Process(), CameraSystem::ProcessKeyboardInput(), SDL_AppEvent(), SDL_AppIterate(), and InputsManager::Shutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInstance()

KeyboardManager & KeyboardManager::GetInstance ( )
static

Definition at line 7 of file KeyboardManager.cpp.

References GetComponentTypeID_Static().

Referenced by Get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleEvent()

void KeyboardManager::HandleEvent ( const SDL_Event ev)

Definition at line 56 of file KeyboardManager.cpp.

References GetComponentTypeID_Static(), m_keysPressedThisFrame, m_keysReleasedThisFrame, m_keyStates, m_mutex, and PostKeyEvent().

Referenced by InputsManager::HandleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Initialize()

void KeyboardManager::Initialize ( )

Definition at line 13 of file KeyboardManager.cpp.

References m_keysPressedThisFrame, m_keysReleasedThisFrame, m_keyStates, and SYSTEM_LOG.

Referenced by KeyboardManager().

+ Here is the caller graph for this function:

◆ IsKeyHeld()

bool KeyboardManager::IsKeyHeld ( SDL_Scancode  sc)

Definition at line 35 of file KeyboardManager.cpp.

References GetComponentTypeID_Static(), m_keyStates, and m_mutex.

+ Here is the call graph for this function:

◆ IsKeyPressed()

bool KeyboardManager::IsKeyPressed ( SDL_Scancode  sc)

Definition at line 42 of file KeyboardManager.cpp.

References GetComponentTypeID_Static(), m_keysPressedThisFrame, and m_mutex.

+ Here is the call graph for this function:

◆ IsKeyReleased()

bool KeyboardManager::IsKeyReleased ( SDL_Scancode  sc)

Definition at line 49 of file KeyboardManager.cpp.

References GetComponentTypeID_Static(), m_keysReleasedThisFrame, and m_mutex.

+ Here is the call graph for this function:

◆ PostKeyEvent()

void KeyboardManager::PostKeyEvent ( SDL_KeyboardEvent const ke)
private

Definition at line 88 of file KeyboardManager.cpp.

References Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Input, Olympe_EventType_Keyboard_KeyDown, Olympe_EventType_Keyboard_KeyUp, and EventQueue::Push().

Referenced by HandleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Shutdown()

void KeyboardManager::Shutdown ( )

Definition at line 22 of file KeyboardManager.cpp.

References SYSTEM_LOG.

Referenced by InputsManager::Shutdown(), and ~KeyboardManager().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_keysPressedThisFrame

bool KeyboardManager::m_keysPressedThisFrame[SDL_SCANCODE_COUNT] = {false}
private

Definition at line 43 of file KeyboardManager.h.

Referenced by BeginFrame(), HandleEvent(), Initialize(), and IsKeyPressed().

◆ m_keysReleasedThisFrame

bool KeyboardManager::m_keysReleasedThisFrame[SDL_SCANCODE_COUNT] = {false}
private

Definition at line 44 of file KeyboardManager.h.

Referenced by BeginFrame(), HandleEvent(), Initialize(), and IsKeyReleased().

◆ m_keyStates

bool KeyboardManager::m_keyStates[SDL_SCANCODE_COUNT] = {false}
private

Definition at line 42 of file KeyboardManager.h.

Referenced by HandleEvent(), Initialize(), and IsKeyHeld().

◆ m_mutex

std::mutex KeyboardManager::m_mutex
private

Definition at line 38 of file KeyboardManager.h.

Referenced by BeginFrame(), HandleEvent(), IsKeyHeld(), IsKeyPressed(), and IsKeyReleased().

◆ name

std::string KeyboardManager::name
private

Definition at line 37 of file KeyboardManager.h.

Referenced by KeyboardManager().


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