| 33 | } |
| 34 | |
| 35 | void ofApp::draw() |
| 36 | { |
| 37 | float w = ofGetWidth()/numCols; |
| 38 | float h = ofGetHeight()/numRows; |
| 39 | |
| 40 | for (int i=0; i<numRows*numCols; i++) { |
| 41 | float x = w * (i%numCols); |
| 42 | float y = h * (floor(i/numCols)); |
| 43 | // fill the box if the corresponding button in the matrix is selected // |
| 44 | if (matrix->getButtonAtIndex(i)->getSelected() == true) { |
| 45 | ofFill(); |
| 46 | ofSetColor(ofColor::fromHex(0xEEEEEE)); |
| 47 | ofDrawRectangle(x, y, w, h); |
| 48 | } |
| 49 | // draw wireframe / |
| 50 | ofNoFill(); |
| 51 | ofSetColor(ofColor::fromHex(0x303030)); |
| 52 | ofDrawRectangle(x, y, w, h); |
| 53 | // draw box number // |
| 54 | ofRectangle bounds = font.getStringBoundingBox(ofToString(i+1), 0, 0); |
| 55 | font.drawString(ofToString(i+1), x+w/2-bounds.width/2, y+h/2+bounds.height/2); |
| 56 | } |
| 57 | matrix->draw(); |
| 58 | } |
| 59 | |
| 60 | void ofApp::onMatrixEvent(ofxDatGuiMatrixEvent e) |
| 61 | { |
nothing calls this directly
no test coverage detected