hibiscus/core/input/manager.cpp

27 lines
795 B
C++
Raw Permalink Normal View History

2023-07-30 16:06:47 +00:00
#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;
}
}