Beispiel #1
0
//--------------------------------------------------------------
void ofxMuiButton::setButtonIcon(const ofxMuiIconName& _buttonIcon) {
    buttonIconName = _buttonIcon;
    if(buttonIconName == ICON_NONE) {
        icon = NULL;
        useIcon = false;
        // assume that it has or will be set
        //hitBox.width = defaults->buttonWidth;
        //hitBox.height = icon->getHeight();
    } else {
        icon = defaults->getIcon(buttonIconName);
        
        setHitBoxWidth(icon->getWidth());
        setHitBoxHeight(icon->getHeight());

        useIcon = true;
    }
    
    requestBoxLayout();
}
Beispiel #2
0
//--------------------------------------------------------------
void ofxMuiButton::setButtonHeight(int _height) {
    setHitBoxHeight(_height);
    requestBoxLayout();
}
Beispiel #3
0
//--------------------------------------------------------------
void ofxMuiKnob::init() {

    setObjectType("KNOB");

    setHitBoxWidth(defaults->knobWidth);
    setHitBoxHeight(defaults->knobHeight);

    // set default key binding
    keyBind_increaseValue('=');
    keyBind_decreaseValue('-');

    setBoxProperties(defaults->knobBoxProperties);

    // set values
    setValue(0);
    //setBoundsMin(0.0f);
    //setBoundsMax(1.0f);

    //valueLabel->d();
    label->enable();

    lastKnobAngle = 0.0f;
    knobAngle = 0.0f;
    dKnobAngle = 0.0f;

    zeroAngle = HALF_PI; // up

    boundaryWedgeAngle = PI/4.0f;

    innerRadiusPct = 0.60f;
    outerRadiusPct = 1.00f;

    innerRadiusW = getHitBoxHalfWidth() * innerRadiusPct;
    outerRadiusW = getHitBoxHalfWidth() * outerRadiusPct;
    innerRadiusH = getHitBoxHalfHeight() * innerRadiusPct;
    outerRadiusH = getHitBoxHalfHeight() * outerRadiusPct;

    float b = innerRadiusW;
    float v = b / 6.0f;
    dialArrow.moveTo(0,-v);
    dialArrow.lineTo(b,0);
    dialArrow.lineTo(0,+v);
    dialArrow.close();
    dialArrow.setFilled(false);

    dialShape.setArcResolution(360);
    dialRangeShape.setArcResolution(360);
    dialValueShape.setArcResolution(360);

    needsRedraw = true;


    normCtrlDragStartMin = 0.0f;
    normCtrlDragStartMax = 0.0f;
    totalDragDelta = ofPoint(0.0f,0.0f);

    dKnobScaler = 0.01f;

    smartRotate = false;
    smoothedCenter = getHitBoxCenter();
    smoothedCenterAlpha = 0.95;

    requestBoxLayout();
}