Using mouseX variable in custom class

hi, each time I call the mouseX or mouseY variables inside a custom created class I get an undeclared identifier error. I think I have added the right includes at the top of my class

#include "ofMain.h" #include "ofBaseApp.h"

Am I missing something else ? I’d really like to access mouse position inside a custom class

Hi, try ofGetMouseX().
mouseX is only available in ofBaseApp (and thus ofApp) and set with mouseMoved()
Good luck

1 Like