void MantaAudioUnitController::ButtonVelocityEvent(ofxMantaEvent & evt) { if (buttonMap.count(evt.id) != 0 && buttonMap[evt.id]->toggle && evt.value > 0) { buttonMap[evt.id]->toggleHighLow(); updateButtonColor(evt.id); } else if (toFreezePads && evt.id==1 && evt.value==0) { freezePads(); } }
//-------------------------------------------------------------- /*public */void ofxSimpleButton::render(){ if (bRender) { ofPushMatrix(); ofPushStyle(); ofTranslate(b_rect.x, b_rect.y); if (b_img_fbo.size() > 0 && b_shape == BUTTON_IMAGE) { ofPushStyle(); ofEnableAlphaBlending(); ofSetColor(b_c, 255); if (b_img_fbo.size() == 2 && bToggle) { b_img_fbo[1].draw(0, 0); } else if (bAnimation && bang) { a_img_fbo.draw(0, 0); } else{ b_img_fbo[0].draw(0, 0); } ofDisableAlphaBlending(); ofPopStyle(); }else { ofPushStyle(); ofFill(); updateButtonColor(); if (b_shape == BUTTON_CIRCLE) { ofEllipse(b_rect.width/2, b_rect.height/2, b_rect.width, b_rect.height); }else if (b_shape == BUTTON_RECT){ ofRect(0, 0, b_rect.width, b_rect.height); }else if (b_shape == BUTTON_CUSTOM){ //using vertex? } ofPopStyle(); } if (useName) { ofPushStyle(); ofSetColor(b_c); ofDrawBitmapString(b_info_text, n_pos); ofPopStyle(); } if (useValue) { ofPushStyle(); ofSetColor(b_c); ofDrawBitmapString(b_val_text, v_pos); ofPopStyle(); } ofPopStyle(); ofPopMatrix(); } }
void Settings::Update(Game &game){ //update elapsedTime m_elapsedTime = (float)m_clock.restart().asMilliseconds(); //Update Mouse Rectangle m_MouseRect = sf::Rect<float>((float)sf::Mouse::getPosition(game.window).x, (float)sf::Mouse::getPosition(game.window).y + 1.0f, 1.0f, 1.0f); if (!m_startFading){ //Update Mouse selection updateMouseSelection(); //Color the buttons updateButtonColor(); } //See if we should change the ScreenState if (m_startFading){ fadeOut(); changeState(game); } }
void MantaAudioUnitController::removeButtonMapping(int index) { delete buttonMap[index]; buttonMap.erase(index); updateButtonColor(index); }
void MantaAudioUnitController::mapButtonToParameter(int index, AudioUnitInstrument & synth, string parameterName, bool toggle) { registerAudioUnit(synth); buttonMap[index] = new MantaParameterMapping(synth, parameterName, toggle); updateButtonColor(index); }