// Voxspatium Engine - Voxel Planets Engine // Copyright (C) 2018 Evert "Diamond" Prants // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef __INPUT_H__ #define __INPUT_H__ #include "util/Singleton.h" #include "util/Math3D.h" #include class Input : public Singleton { public: void flush(); void pressKey(unsigned int keyID); void releaseKey(unsigned int keyID); void setMouseCoords(float x, float y); void setMouseWheel(int vert, int horiz); bool isKeyDown(unsigned int keyID); bool isKeyPressed(unsigned int keyID); glm::vec2 getMouseCoords() const { return m_mouseCoords; } glm::vec2 getOldMouseCoords() const { return m_oldMouseCoords; } int getMouseWheelVertical() const { return m_mwheelY; } int getMouseWheelHorizontal() const { return m_mwheelX; } friend class Singleton; private: bool wasKeyDown(unsigned int keyID); std::unordered_map m_keyMap; std::unordered_map m_oldKeyMap; glm::vec2 m_mouseCoords; glm::vec2 m_oldMouseCoords; int m_mwheelY; int m_mwheelX; }; #endif // __INPUT_H__