Skip to content
Snippets Groups Projects
Commit 3b20d81c authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added click detection (edge detect)

parent f5a54a20
No related branches found
No related tags found
No related merge requests found
#include <input_state.hpp>
#include <iostream>
#include <imgui_bundle.hpp>
#include <leveler.hpp>
bool InputState::mwheel_pressed = false;
bool InputState::lmb_pressed = false;
bool InputState::lmb_click = false;
bool InputState::rmb_pressed = false;
float InputState::mpos_x = 0.f;
float InputState::mpos_y = 0.f;
......@@ -19,6 +21,7 @@ void InputState::update(const unsigned width, const unsigned height) {
mmot_x = 0.f;
mmot_y = 0.f;
mwheelmot_y = 0.f;
lmb_click = false;
SDL_Event event;
while (SDL_PollEvent(&event)) {
......@@ -52,6 +55,7 @@ void InputState::update(const unsigned width, const unsigned height) {
std::cout << "LMB Pressed" << std::endl << std::flush;
#endif
lmb_pressed = true;
lmb_click = true;
break;
case SDL_BUTTON_RIGHT:
#ifndef NDEBUG
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment