added input system
This commit is contained in:
49
TSE_Core/src/interfaces/IKeyInputHandler.cpp
Normal file
49
TSE_Core/src/interfaces/IKeyInputHandler.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user