Custom Cursor over ofxGUI

I chose to work on the GUI and Cursor for a school project. I’ve made cursors without any issue using the ofApp::mouseMoved and cie events, and it worked like a charm, but when I added an ofxGui panel, my cursor refused to go over, ofApp::mouseMoved and cie events simply stop triggering.

1 Like

ofxGui uses events priority so for example when using it while also using an easy cam the camera doesn’t move when you move a sldier.

To add an event with priority greater then ofxGui’s you need to use ofEvents instead of the ofApp callbacks like:

in your setup

ofAddListener(ofEvents().mouseMoved, this, ofApp::mouseMovedEvent, OF_EVENT_ORDER_BEFORE_APP - 100);

then add the new event listener:

void ofApp::mouseMovedEvent(ofMouseEventArgs & mouse){

then inside that function just use mouse.x, mouse.y to position the mouse as you would do with the regular ofApp callback.

you will need to do the same for every other mouse function.

If I want to use ofxGui mouse events so my cursor is an arrow when over, how can I set them?

EDIT : Found the error. Need & before ofApp.

ofAddListener(ofEvents().mouseMoved, this, &ofApp::mouseMovedEvent, OF_EVENT_ORDER_BEFORE_APP - 100);