2 #include "input_handler.hpp"
7 using namespace dragonblocks;
9 void InputHandler::processInput(double dtime)
11 cursor_delta = vec2(mouse_sensitivity * dtime) * (vec2)window->getCursorDelta();
13 for (auto it = is_down.begin(); it != is_down.end(); it++) {
15 if (! window->isKeyDown(key)) {
20 for (auto it = listened_keys.begin(); it != listened_keys.end(); it++) {
22 if (window->isKeyDown(key)) {
28 void InputHandler::listenFor(int key)
30 listened_keys.insert(key);
33 void InputHandler::dontListenFor(int key)
35 listened_keys.erase(key);
38 bool InputHandler::isKeyDown(int key)
40 return is_down.find(key) != is_down.end();
43 bool InputHandler::wasKeyDown(int key)
45 return was_down.find(key) != was_down.end();
48 vec2 InputHandler::getCursorDelta()
53 void InputHandler::setWindow(Window *w)