Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

adcox
Copy link
Contributor

@adcox adcox commented Jun 14, 2016

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.

…even if they occur within one frame) are caught.
@adcox adcox closed this Jun 14, 2016
@adcox
Copy link
Contributor Author

adcox commented Jun 14, 2016

Nevermind, found a few bugs to iron out yet with this implementation.

@adcox
Copy link
Contributor Author

adcox commented Jun 15, 2016

Ok, I fixed those bugs and tested more thoroughly. Should be good to go!

@adcox adcox reopened this Jun 15, 2016
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
Copy link
Owner

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;
}

Copy link
Contributor Author

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

@adcox
Copy link
Contributor Author

adcox commented Jun 17, 2016

Found bug when vSync was turned off.

@adcox adcox closed this Jun 17, 2016
@adcox
Copy link
Contributor Author

adcox commented Jun 17, 2016

By changing the strategy ever so slightly to track when the mouse was released, the bug with vSync = FALSE has been resolved.

@adcox adcox reopened this Jun 17, 2016
@adcox
Copy link
Contributor Author

adcox commented Aug 11, 2016

I'm going to move the pull request to a branch other than master

@adcox adcox closed this Aug 11, 2016
@adcox adcox mentioned this pull request Aug 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicks not registered
2 participants