| 36 | } |
| 37 | |
| 38 | void ofApp::onButtonEvent(ofxDatGuiButtonEvent e) |
| 39 | { |
| 40 | // we have a couple ways to figure out which button was clicked // |
| 41 | |
| 42 | // we can compare our button pointer to the target of the event // |
| 43 | if (e.target == button){ |
| 44 | numClicks++; |
| 45 | if (numClicks == 1){ |
| 46 | button->setLabel("YOU CLICKED ME ONCE"); |
| 47 | } else{ |
| 48 | button->setLabel("YOU CLICKED ME "+ofToString(numClicks)+" TIMES"); |
| 49 | } |
| 50 | |
| 51 | // or we can check against the label of the event target // |
| 52 | } else if(e.target->getLabel() == "TOGGLE FULLSCREEN"){ |
| 53 | isFullscreen =!isFullscreen; |
| 54 | ofSetFullscreen(isFullscreen); |
| 55 | if (!isFullscreen) { |
| 56 | ofSetWindowShape(1920, 1080); |
| 57 | ofSetWindowPosition((ofGetScreenWidth()/2)-(1920/2), 0); |
| 58 | } |
| 59 | positionButtons(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | void ofApp::positionButtons() |
| 64 | { |