aboutsummaryrefslogtreecommitdiff
path: root/src/glfw
diff options
context:
space:
mode:
Diffstat (limited to 'src/glfw')
-rw-r--r--src/glfw/window.cc11
-rw-r--r--src/glfw/window.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/src/glfw/window.cc b/src/glfw/window.cc
index 98890b7..4f14501 100644
--- a/src/glfw/window.cc
+++ b/src/glfw/window.cc
@@ -37,14 +37,19 @@ int Window::getHeight() const {
return _height;
}
-std::tuple<bool,int,int> Window::getMouse() const {
- const bool clicked = glfwGetMouseButton(_handle, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS;
+std::tuple<int,int,int> Window::getMouse() const {
+ int state = 0;
+ if ( glfwGetMouseButton(_handle, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS ) {
+ state = 1;
+ } else if ( glfwGetMouseButton(_handle, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS ) {
+ state = 2;
+ }
double x, y;
glfwGetCursorPos(_handle, &x, &y);
return std::make_tuple(
- clicked,
+ state,
x - int(getWidth()/2),
int(getHeight()/2 - y)
);
diff --git a/src/glfw/window.h b/src/glfw/window.h
index af7ba4d..143d457 100644
--- a/src/glfw/window.h
+++ b/src/glfw/window.h
@@ -27,7 +27,7 @@ public:
int getWidth() const;
int getHeight() const;
- std::tuple<bool,int,int> getMouse() const;
+ std::tuple<int,int,int> getMouse() const;
KeyWatcher getKeyWatcher(int key) const;