added input system

This commit is contained in:
2026-01-17 18:01:48 +01:00
parent 6d90c91209
commit cf5602417b
21 changed files with 120171 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
#include "IKeyInputHandler.hpp"
#include "IInputManager.hpp"
TSE::IKeyInputHandler::~IKeyInputHandler()
{
if(enabled()) Disable();
}
bool TSE::IKeyInputHandler::enabled() const
{
return Enabled;
}
void TSE::IKeyInputHandler::Enable()
{
if(!enabled())
{
IInputManager::instance()->RegisterKeyHandler(this);
}
}
void TSE::IKeyInputHandler::Disable()
{
if(enabled())
{
IInputManager::instance()->UnregisterKeyHandler(this);
}
}
void TSE::IKeyInputHandler::onKeyDown(IKeyInputHandler *handler, const Key &key, const Modifier &mods)
{
handler->OnKeyDown(key, mods);
}
void TSE::IKeyInputHandler::onKeyUp(IKeyInputHandler *handler, const Key &key, const Modifier &mods)
{
handler->OnKeyUp(key, mods);
}
void TSE::IKeyInputHandler::onKeyHold(IKeyInputHandler *handler, const Key &key, const Modifier &mods)
{
handler->OnKeyHold(key, mods);
}
void TSE::IKeyInputHandler::onChar(IKeyInputHandler *handler, const std::string &c)
{
handler->OnChar(c);
}