aboutsummaryrefslogtreecommitdiff
path: root/src/glfw
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-22 21:49:07 +0100
committerAdrian Kummerlaender2019-02-22 21:49:07 +0100
commitf0b536ac93b3a9a49dfff8a7637f09b153a3b955 (patch)
treedbddeb503d50276fcee06d889d8c8b1edfd36a02 /src/glfw
parent1870b510acb351b5956402a21572835aa0d2dee0 (diff)
downloadcompustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.tar
compustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.tar.gz
compustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.tar.bz2
compustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.tar.lz
compustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.tar.xz
compustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.tar.zst
compustream-f0b536ac93b3a9a49dfff8a7637f09b153a3b955.zip
Improvise interactive wall drawing
Internal wall cells need to be disabled to prevent delayed propagation of the reflected populations. This is just quickly thrown together - both the visual drawing and the backend's material handling remain to be improved.
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;