hibiscus/core/input/manager.cpp
2023-07-30 18:06:47 +02:00

27 lines
795 B
C++

#include "manager.hpp"
namespace hibis {
InputManager::InputManager() {}
InputManager::~InputManager() {}
bool InputManager::isKeyPressed(int scancode) {
if (mKeyScancodes.find(scancode) != mKeyScancodes.end()) return (mKeyScancodes[scancode] == Pressed || mKeyScancodes[scancode] == Held);
else return false;
}
bool InputManager::isKeyJustPressed(int scancode) {
if (mKeyScancodes.find(scancode) != mKeyScancodes.end()) return mKeyScancodes[scancode] == Pressed;
else return false;
}
bool InputManager::isKeyJustReleased(int scancode) {
if (mKeyScancodes.find(scancode) != mKeyScancodes.end()) return mKeyScancodes[scancode] == Released;
else return false;
}
void InputManager::setKeyPressState(int scancode, PressTypes type) {
mKeyScancodes[scancode] = type;
}
}