Hello. Total newby here.
Let’s say I want the horizontal movement of the mouse do something if the ‘A’ key is being pressed and do another thing if the ‘B’ key is being pressed? How could I do that?
I know there are the event driven mouseMoved and keyPressed methods, but how can I check for a key inside the mouseMoved?
Thanks for the fast reply Arthur. I was wondering if there wasn’t an easier way, since what I want to do is not complex at all. Here is a dummy code:
void testApp::mouseMoved(int x, int y ){
if (theKeyPressedRightNow == 'a') {
// do something with the mouseX
} else {
// do something else with the mouseX
}
}
The keys would act as modifiers to the mouseMoved.
All the best,
HEMOglobina
Note that many keyboards can get locks when too many keys are pressed or released at the same time, so you may end up with stray keys which appear to be pressed when they are actually not being held down.