27 lines
795 B
C++
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;
|
||
|
}
|
||
|
}
|