kick
|
00001 // 00002 // mouse_input.h 00003 // UnitTest_KickCPP 00004 // 00005 // Created by morten on 24/04/14. 00006 // 00007 // 00008 00009 #pragma once 00010 00011 #include <iostream> 00012 #include <set> 00013 00014 #include "glm/glm.hpp" 00015 00016 namespace kick { 00017 class MouseInput { 00018 public: 00019 // returns true if mouse button was pressed down in this frame 00020 static bool down(int button); 00021 // returns true if mouse button is down is this frame 00022 static bool pressed(int button); 00023 // returns true if mouse button is released in this frame 00024 static bool up(int button); 00025 static void buttonPressStarted(int button); 00026 static void buttonPressEnded(int button); 00027 00028 static glm::ivec2 position(); 00029 00030 static void setPosition(glm::ivec2 position); 00031 00032 static glm::ivec2 positionDelta(); 00033 00034 static void setPositionDelta(glm::ivec2 positionDelta); 00035 00036 static glm::ivec2 mouseWheelDelta(); 00037 00038 static void setMouseWheelDelta(glm::ivec2 mouseWheelDelta); 00039 00041 static void reset(); 00042 static const int mouseButtons = 5; 00043 00044 static int clicks(); 00045 00046 static void setClicks(int clicks); 00047 private: 00048 MouseInput() = delete; 00049 // absolute mouse position (relative to upper left corner) 00050 static glm::ivec2 mPosition; 00051 static glm::ivec2 mPositionDelta; 00052 static glm::ivec2 mMouseWheelDelta; 00053 static int mClicks; 00054 00055 static bool mButtonDown[mouseButtons]; 00056 static bool mButtonPressed[mouseButtons]; 00057 static bool mButtonUp[mouseButtons]; 00058 }; 00059 }