jvcleave / ofxImGui

Use ImGui in openFrameworks
293 stars 124 forks source link

Could ImGui::IsMouseHoveringAnyWindow replace settings.mouseOverGui? #50

Open hamoid opened 7 years ago

hamoid commented 7 years ago

I was wondering if this code (helpers.cpp) is required:

// Check if the mouse cursor is over this gui window.
const auto windowBounds = ofRectangle(settings.windowPos, settings.windowSize.x, settings.windowSize.y);
settings.mouseOverGui |= windowBounds.inside(ofGetMouseX(), ofGetMouseY());

when we can do:

if(ImGui::IsMouseHoveringAnyWindow()) {
    ofDrawEllipse(ofRandomWidth(), ofRandomHeight(), 20, 20);
}

There's also ImGui::IsMouseHoveringWindow().

Side note: it would be very helpful to have some documentation (even a paragraph), especially about ImGui vs ofxImGui, what's the benefit of BeginWindow vs Begin, why is ofxImGui needed or what does it make simpler. It's not so obvious when looking at the source code of both projects. Still, I'm happy that both exist :dancer: