Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
KeyboardManager.h
Go to the documentation of this file.
1#pragma once
2
3#include "message.h"
4#include <SDL3/SDL.h>
5#include <mutex>
6#include "system_utils.h"
7#include <string>
8
10{
11public:
13 {
14 name = "KeyboardManager";
15 Initialize();
16 }
18 {
19 Shutdown();
20 }
21
23 static KeyboardManager& Get() { return GetInstance(); }
24
25 void Initialize();
26 void Shutdown();
27
28 void HandleEvent(const SDL_Event* ev);
29
30 // Pull API for reading keyboard state
31 void BeginFrame();
35
36private:
37 std::string name;
38 std::mutex m_mutex;
40
41 // State tracking for pull API
45};
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
void PostKeyEvent(SDL_KeyboardEvent const &ke)
bool m_keysPressedThisFrame[SDL_SCANCODE_COUNT]
static KeyboardManager & Get()
bool m_keyStates[SDL_SCANCODE_COUNT]
bool IsKeyHeld(SDL_Scancode sc)
bool m_keysReleasedThisFrame[SDL_SCANCODE_COUNT]
static KeyboardManager & GetInstance()
bool IsKeyPressed(SDL_Scancode sc)
bool IsKeyReleased(SDL_Scancode sc)
void HandleEvent(const SDL_Event *ev)
virtual ~KeyboardManager()