//-------------------------------------------------------------- void ofxMuiButton::draw() { ofPushStyle(); ofPushMatrix(); // initial push ofTranslate(getHitBoxPosition()); //--------- DRAW THE BUTTON BACKGROUND // default ofFill(); ofSetColor(cActiveAreaBackground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); if(roundFrame) { // assuming that the icon is square ... ofCircle(getHitBoxWidth()/2, getHitBoxHeight()/2, getHitBoxWidth()/2); } else { ofxRect(0, 0, getHitBoxWidth(), getHitBoxHeight()); } ofNoFill(); ofSetColor(cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); if(useIcon) { int iconWidth = icon->getIcon(getValue())->getWidth(); int iconHeight = icon->getIcon(getValue())->getHeight();; int hitWidth = getHitBoxWidth(); int hitHeight = getHitBoxHeight(); int xlateX = 0; int xlateY = 0; // center the icon ofPushMatrix(); if(iconWidth < hitWidth) { int diffX = hitWidth - iconWidth; xlateX = diffX/2; } else { int diffX = iconWidth - hitWidth; xlateX = -diffX/2; } if(iconHeight < hitHeight) { int diffY = hitHeight - iconHeight; xlateY = diffY/2; } else { int diffY = iconHeight - hitHeight; xlateY = -diffY/2; } ofTranslate(xlateX, xlateY); icon->getIcon(getValue())->draw(0,0); ofPopMatrix(); } else { ofFill(); ofxRect(0, 0, getHitBoxWidth(), getHitBoxHeight()); } ofNoFill(); ofSetColor(cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); if(roundFrame) { // assuming that the icon is square ... ofCircle(getHitBoxWidth()/2, getHitBoxHeight()/2, getHitBoxWidth()/2); } else { ofxRect(0, 0, getHitBoxWidth(), getHitBoxHeight()); } ofPopMatrix(); // HIT RECT PUSH ofPopStyle(); }
//-------------------------------------------------------------- void ofxMuiWindow::draw() { ofPushStyle(); ofPushMatrix(); // initial push ofTranslate(getHitBoxPosition()); ofSetColor(255,0,255); if(isMinimized) { //ofxRect(0.0f, 0.0f, width, windowButtonHeight + 1); ofxRect(0.0f, 0.0f, minimizedRect.width,minimizedRect.height); } else { ofxRect(0.0f, 0.0f, getHitBoxWidth(), getHitBoxHeight()); } ofNoFill(); /* if(name != "") { if(isMinimized) { ofPushMatrix(); ofTranslate(mGlobals->mPadLeft,mGlobals->mPadTop); drawParamString(windowButtonWidth*2, 0, name, false); ofPopMatrix(); } else { drawHeadString(mBorder, mBorder + windowButtonHeight, name, false); } } if(mBorder > 0) { // border //glColor4f(mGlobals->mBorderColor.r, mGlobals->mBorderColor.g, mGlobals->mBorderColor.b, mGlobals->mBorderColor.a); ofSetColor(mGlobals->mBorderColor); if(isMinimized) { ofxRect(0.0f, 0.0f, minimizedRect.width,minimizedRect.height); //ofxRect(0.0f, 0.0f, width, windowButtonHeight ); } else { ofxRect(0.0f, 0.0f, width, height); } } if(isEnabled && !isMinimized) { ofxMuiObject* tmpObj; for(int i = 0; i < childObjects.size(); i++) { tmpObj = (ofxMuiObject*)childObjects.at(i); tmpObj->draw(); } } else { // minMaxButton->draw(); // enableDisableButton->draw(); } */ ofPopMatrix(); ofPopStyle(); }
//-------------------------------------------------------------- void ofxMuiKnob::draw() { // pre calculate colors for reuse ofColor activeAreaBackground = cActiveAreaBackground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); ofColor activeAreaFrame = cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); ofColor activeForeground = cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); ofEnableAlphaBlending(); ofPushStyle(); ofPushMatrix(); ofTranslate(getHitBoxPosition()); ofPushMatrix(); ofTranslate(getHitBoxCenter()); ofRotateZ(ofRadToDeg(zeroAngle)); ofFill(); ofSetColor(activeAreaBackground); ofEllipse(0,0,innerRadiusW*2.0f,innerRadiusH*2.0f); // draw a little arrow ofNoFill(); ofPushMatrix(); ofRotateZ(ofRadToDeg(knobAngle)); dialArrow.setStrokeColor(activeAreaFrame); dialArrow.draw(0,0); ofPopMatrix(); dialRangeShape.setFillColor(activeAreaBackground); dialRangeShape.setFilled(true); dialRangeShape.draw(0,0); dialValueShape.setFillColor(activeForeground); dialValueShape.setFilled(true); dialValueShape.draw(0,0); dialShape.setStrokeColor(activeAreaFrame); dialShape.setFilled(false); dialShape.draw(0,0); ofSetColor(activeAreaFrame); ofNoFill(); ofPushMatrix(); ofRotateZ(angleValue0); ofLine(innerRadiusW,0,outerRadiusH,0); ofPopMatrix(); ofPushMatrix(); ofRotateZ(angleValue1); ofLine(innerRadiusW,0,outerRadiusH,0); ofPopMatrix(); ofPushMatrix(); ofRotateZ(angleRange1); ofLine(innerRadiusW,0,outerRadiusH,0); ofPopMatrix(); if(getBounds().isBounded()) { } else { } ofDisableAlphaBlending(); ofPopMatrix(); ofPopMatrix(); ofPopStyle(); }