diff options
| author | realtradam <[email protected]> | 2022-11-25 02:55:55 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-11-25 02:55:55 -0500 |
| commit | 4e7226ad1b081982e5cbed349edca1c5b0e1b779 (patch) | |
| tree | 6d497896f979e6bbcb0841d33d3a2815333cfef9 /src/input.cpp | |
| parent | 6e1d0c6a3f3699e44000f411cd93261c460f75a9 (diff) | |
| download | Ogle-4e7226ad1b081982e5cbed349edca1c5b0e1b779.tar.gz Ogle-4e7226ad1b081982e5cbed349edca1c5b0e1b779.zip | |
fixed Makefile, implemented bunnymark
Diffstat (limited to 'src/input.cpp')
| -rw-r--r-- | src/input.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/input.cpp b/src/input.cpp index bad2ce8..5622afd 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -3,9 +3,38 @@ namespace Input { + namespace { + int mouse_x; + int mouse_y; + bool mouse_click; + } void process(GLFWwindow *window) { if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); + else + { + double _mouse_x, _mouse_y; + glfwGetCursorPos(window, &_mouse_x, &_mouse_y); + mouse_x = (int)_mouse_x; + mouse_y = (int)_mouse_y; + if(GLFW_PRESS == glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT)) + mouse_click = true; + else + mouse_click = false; + } + } + + int get_mouse_x() + { + return mouse_x; + } + int get_mouse_y() + { + return mouse_y; + } + bool get_mouse_click() + { + return mouse_click; } } |
