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

How to remove mouse events

$
0
0

@nunos wrote:

If I have a very simple app like this:

void ofApp::setup(){}

void ofApp::update(){}

void ofApp::draw(){}

void ofApp::mousePressed(ofMouseEventArgs &mouse) {
    cout << "mouse pressed" << endl;
}

void ofApp::mouseMoved(ofMouseEventArgs &mouse) {}
void ofApp::mouseReleased(ofMouseEventArgs &mouse) {}
void ofApp::mouseDragged(ofMouseEventArgs &mouse) {}

void ofApp::keyPressed(int key){
    cout << "key pressed" << endl;
    ofUnregisterMouseEvents(this);
}

Even after pressing a key and seeing the key pressed message, I keep getting mouse pressed messages whenever I click the mouse. What am I missing here? Thanks!

P.S: I would like to be able to do something like this, so that I could enable and disable the mouse events as I wish in a different app.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles