Get previous mouse coordinate

Help me please.
How I can get mouse coordinate from previous frame. Like pmouseX in Processing.

Thank you.

You’ll want to store the mouse coordinates as a ofPoint each frame. (You can also store the x and y as separate values, if you like.)

Something like:

In your header declare something akin to:
ofPoint previousMouse;

void YourApp::update() {
// things going on here

// at end of update...
previousMouse.set(mouseX, mouseY);
}

Thanks!!!

… or, you can just use:

ofGetPreviousMouseX();
ofGetPreviousMouseY();

Oh, thank you!

1 Like

That works too, haha.

1 Like