Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofGetMouseX(), ofGetMouseY() only update after clicking

$
0
0

@Epiphany99 wrote:

Hi, I ve some problems with some bacic things... :confused:

I´ve loaded a picture and tried to draw it always at the position of the mouse cursor, but the position of the picture only change, while clicking the mouse. I have no idea why... :open_mouth:

Here my code:

ofApp.h:
float posX, posY;
ofImage myImage;

ofApp::setup():
myImage.loadImage("HandCursor.png")

ofApp::update():
posX = ofGetMouseX();
posY = ofGetMouseY();

ofApp::draw():
myImage.draw(posX-64, posY-64)

I also have tried it without the update()-function, but also with the same (wrong) result.

BG and thank you :slightly_smiling:

Epi

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles