-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified MousePressed and MouseReleased action to catch all clicks #38
Conversation
…even if they occur within one frame) are caught.
Nevermind, found a few bugs to iron out yet with this implementation. |
Ok, I fixed those bugs and tested more thoroughly. Should be good to go! |
io.MousePos = ImVec2((float)ofGetMouseX(), (float)ofGetMouseY()); | ||
for(int i = 0; i < 5; i++){ | ||
io.MouseDown[i] = engine->mousePressed[i]; | ||
engine->mousePressed[i] = engine->mouseDragged || false; // Don't set to false if the mouse is being dragged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this do the same thing? Seems to me that false
by itself will always evaluate to true
if(engine->mouseDragged)
{
engine->mousePressed[i] = true;
}else
{
engine->mousePressed[i] = false;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - A more concise form would be
engine->mousePressed[i] = engine->mouseDragged
Found bug when vSync was turned off. |
By changing the strategy ever so slightly to track when the mouse was released, the bug with vSync = FALSE has been resolved. |
I'm going to move the pull request to a branch other than master |
After reviewing the ImGui code and examples, I discovered that their code does not set io.MouseDown to false when the mouse is released. Instead, io.MouseDown is set to false one frame later. I've implemented a solution very similar to the ImGui example code; this resolves #37.