本文整理汇总了C++中ofxUIEventArgs::getButton方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxUIEventArgs::getButton方法的具体用法?C++ ofxUIEventArgs::getButton怎么用?C++ ofxUIEventArgs::getButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxUIEventArgs
的用法示例。
在下文中一共展示了ofxUIEventArgs::getButton方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guiEvent
//--------------------------------------------------------------
void TestScene::guiEvent(ofxUIEventArgs &e) {
name = e.getName() ;
if ( name == "LOAD SETTINGS" && e.getButton()->getValue() == true )
loadSettings() ;
if ( name == "SAVE SETTINGS" && e.getButton()->getValue() == true )
saveSettings() ;
}
示例2: guiSystemEvent
void CloudsVisualSystemFlocking::guiSystemEvent(ofxUIEventArgs &e){
string name = e.getName();
if(name == "ADD PARTICLE")
{
if(e.getButton()->getValue())
{
for(int i = 0; i < 100; i++)
{
ofxBoidParticle *bp = new ofxBoidParticle(ofVec3f(ofRandom(-debugGridSize, debugGridSize), ofRandom(-debugGridSize, debugGridSize), ofRandom(-debugGridSize, debugGridSize)));
bp->setParticlesRef(&ps->getParticles());
ps->addParticle(bp);
}
}
}
else if(name == "BORDER")
{
*(ps->bWidth) = debugGridSize;
*(ps->bHeight) = debugGridSize;
*(ps->bDepth) = debugGridSize;
}
else if(name == "ZONE RADIUS")
{
(*ps->zoneRadiusHalf) = (*ps->zoneRadius)/2.0;
(*ps->zoneRadiusSqrd) = powf((*ps->zoneRadius), 2.0);
}
else if(name == "KILL PARTICLES")
{
if(e.getButton()->getValue())
{
ps->clear();
}
}
else if(name == "PRINT SETTINGS")
{
if(e.getButton()->getValue())
{
ps->printSettings();
}
}
else if(name == "RANDOMIZE")
{
if(e.getButton()->getValue())
{
randomize();
}
}
}
示例3: guiEvent
void ofApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
int kind = e.getKind();
cout << "got event from: " << name << endl;
if(kind == OFX_UI_WIDGET_NUMBERDIALER)
{
ofxUINumberDialer *n = (ofxUINumberDialer *) e.widget;
cout << n->getValue() << endl;
}
if(name == "SAMPLER")
{
ofxUIImageSampler *is = (ofxUIImageSampler *) e.widget;
ofColor clr = is->getColor();
red = clr.r;
blue = clr.b;
green = clr.g;
}
else if(name == "BUTTON")
{
ofxUIButton *button = (ofxUIButton *) e.getButton();
bdrawGrid = button->getValue();
}
else if(name == "TOGGLE")
{
ofxUIToggle *toggle = (ofxUIToggle *) e.getToggle();
bdrawGrid = toggle->getValue();
if(textInput != NULL)
{
textInput->setFocus(bdrawGrid);
}
}
else if(name == "RADIO VERTICAL")
{
ofxUIRadio *radio = (ofxUIRadio *) e.widget;
cout << radio->getName() << " value: " << radio->getValue() << " active name: " << radio->getActiveName() << endl;
}
else if(name == "TEXT INPUT")
{
ofxUITextInput *ti = (ofxUITextInput *) e.widget;
if(ti->getInputTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER)
{
cout << "ON ENTER: ";
}
else if(ti->getInputTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS)
{
cout << "ON FOCUS: ";
}
else if(ti->getInputTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS)
{
cout << "ON BLUR: ";
}
string output = ti->getTextString();
cout << output << endl;
}
}
示例4: selectAudioUnit
//-------------
void ofApp::selectAudioUnit(ofxUIEventArgs &e) {
if (e.getButton()->getValue()) return;
if (e.getName() == "Aalto") {
setupAalto();
}
else if (e.getName() == "Kaivo") {
setupKaivo();
}
}
示例5: guiEvent
void ofApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
int kind = e.getKind();
cout << "got event from: " << name << endl;
if(name == "RED")
{
ofxUISlider *slider = (ofxUISlider *) e.getSlider();
cout << "RED " << slider->getScaledValue() << endl;
red = slider->getScaledValue();
}
else if(name == "GREEN")
{
ofxUISlider *slider = (ofxUISlider *) e.getSlider();
cout << "GREEN " << slider->getScaledValue() << endl;
green = slider->getScaledValue();
}
else if(name == "BLUE")
{
ofxUISlider *slider = (ofxUISlider *) e.getSlider();
cout << "BLUE " << slider->getScaledValue() << endl;
blue = slider->getScaledValue();
}
else if(name == "BUTTON")
{
ofxUIButton *button = (ofxUIButton *) e.getButton();
bdrawGrid = button->getValue();
}
else if(name == "TOGGLE")
{
ofxUIToggle *toggle = (ofxUIToggle *) e.getToggle();
bdrawGrid = toggle->getValue();
}
else if(name == "TEXT INPUT")
{
ofxUITextInput *textinput = (ofxUITextInput *) e.widget;
if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER)
{
cout << "ON ENTER: ";
}
else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS)
{
cout << "ON FOCUS: ";
}
else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS)
{
cout << "ON BLUR: ";
}
string output = textinput->getTextString();
cout << output << endl;
}
}
示例6: handleEvents
//--------------------------------------------------------------
void toolCalibration::handleEvents(ofxUIEventArgs& e)
{
string name = e.getName();
OFAPPLOG->begin("toolCalibration::handleEvents('"+name+"')");
OFAPPLOG->println("- kind="+ofToString(e.getKind()));
if (e.getKind() == OFX_UI_WIDGET_TOGGLE)
{
ofxUIToggle* pToggle = e.getToggle();
if (pToggle->getValue())
{
mp_modelData = 0;
m_editModelPropertyName = name;
if (pToggle->getParent() == mp_radioApparel)
{
m_editModel = EDIT_APPAREL;
mp_modelData = &m_apparelData;
}
else
if (pToggle->getParent() == mp_radioManikin)
{
m_editModel = EDIT_MANIKIN;
mp_modelData = &m_manikinData;
}
if (mp_modelData)
{
mp_modelData->reset();
mp_modelData->m_modelPositionSensitivity = m_modelPositionSensitivity;
mp_modelData->m_modelScaleSensitivity = m_modelScaleSensitivity;
}
}
}
else if (e.getKind() == OFX_UI_WIDGET_LABELBUTTON)
{
if (name == "savePropertiesDevice" && e.getButton()->getValue()==1)
{
GLOBALS->getApp()->apparelModel.saveProperties();
OSC_SENDER->saveCalibration();
}
}
OFAPPLOG->end();
}
示例7: guiEvent
//------------------------------------------------------------------------------------
//GUI STUFF
void ofApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
if(name == "Load Video"){
videoLoaded = false;
ofxUIButton *button = (ofxUIButton *) e.getButton();
if (button->getValue()){
timeline.stop();
//pausePlayback = true;
ofFileDialogResult result = ofSystemLoadDialog("Choose a Video File",false);
if(result.bSuccess){
//need to clear old data
//timeline.removeTrack("Video");
loadVideo(result.getPath(),result.getName());
}
}
}
else if (name == "Toggle Min Movement"){
minMovementBool = e.getToggle()->getValue();
minMove->setVisible(minMovementBool);
}
else if (name == "Toggle Max Movement"){
maxMovementBool = e.getToggle()->getValue();
maxMove->setVisible(maxMovementBool);
}
else if(name == "Min Movement") {
minMovementThresh = e.getSlider()->getValue();
}
else if(name == "Max Movement") {
maxMovementThresh = e.getSlider()->getValue();
}
else if(name == "Length Range"){
if(loopLengthSlider->getState() != OFX_UI_STATE_DOWN){
timeline.stop();
minPeriod = (int)(fps*minPeriodSecs);
maxPeriod = (int)(fps*maxPeriodSecs);
}
}
}
示例8: guiEvent
//--------------------------------------------------------------
void Animation::guiEvent(ofxUIEventArgs &e)
{
string name = e.widget->getName();
int kind = e.widget->getKind();
if (kind == OFX_UI_WIDGET_SLIDER_H || kind == OFX_UI_WIDGET_SLIDER_V)
{
if (name == "volume")
{
m_soundPlayer.setVolume( ((ofxUISlider*) e.widget)->getScaledValue() );
}
else
{
if (mp_obj)
{
ofxJSValue retVal;
ofxJSValue args[2];
args[0] = string_TO_ofxJSValue( name );
args[1] = float_TO_ofxJSValue( ((ofxUISlider*) e.widget)->getScaledValue() );
ofxJSCallFunctionNameObject_IfExists(mp_obj,"eventUI", args,2,retVal);
}
}
}
else
if (kind == OFX_UI_WIDGET_TOGGLE)
{
// TODO : not cool here
if (guiEventTogglesSound(name))
{
m_soundPlayer.m_listSoundNames.clear();
for (int i=0; i<m_listSoundNames.size(); i++){
ofxUIToggle* pSoundToggle = (ofxUIToggle*) mp_UIcanvas->getWidget( m_listSoundNames[i] );
if (pSoundToggle->getValue()){
// ofLog() << m_name << " / " << m_listSoundNames[i];
m_soundPlayer.add( m_listSoundNames[i] );
}
}
}
else
{
if (mp_obj)
{
bool valToggle = ((ofxUIToggle*) e.widget)->getValue() ;
ofxJSValue retVal;
ofxJSValue args[2];
args[0] = string_TO_ofxJSValue( name );
args[1] = int_TO_ofxJSValue( valToggle ? 1 : 0 );
ofxJSCallFunctionNameObject_IfExists(mp_obj,"eventUI", args,2,retVal);
}
}
}
else if (kind == OFX_UI_WIDGET_LABELBUTTON)
{
if ( e.getButton()->getValue())
{
if (name == "Save")
{
string filename = mp_teConfigName->getTextString();
saveConfiguration(filename);
m_configurationCurrent = filename;
}
else if (name == "Load")
{
string filename = mp_teConfigName->getTextString();
m_configurationCurrent = filename;
loadConfiguration(filename);
}
else if (name == "exportTemplate")
{
exportMidiSettingsTemplate();
}
}
}
}
示例9: guiEvent
void Calibration::guiEvent(ofxUIEventArgs &e)
{
if(e.getName() == "ps3_gain")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setGain(slider->getValue());
}
else if(e.getName() == "ps3_brightness")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setBrightness(slider->getValue());
}
else if(e.getName() == "ps3_contrast")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setContrast(slider->getValue());
}
else if(e.getName() == "ps3_redbalance")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setRedBalance(slider->getValue());
}
else if(e.getName() == "ps3_bluebalance")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setBlueBalance(slider->getValue());
}
else if(e.getName() == "ps3_exposure")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setExposure(slider->getValue());
}
else if(e.getName() == "ps3_hue")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setHue(slider->getValue());
}
else if(e.getName() == "ps3_sharpness")
{
ofxUIIntSlider *slider = (ofxUIIntSlider *) e.getSlider();
ps3eye.setSharpness(slider->getValue());
}
else if(e.getName() == "save_camera")
{
ofxUIButton *btn = (ofxUIButton *) e.getButton();
if (btn->getValue())
guihash["1"]->saveSettings("settings/"+guihash["1"]->getName()+"Settings.xml");
}
else if(e.getName() == "load_camera")
{
ofxUIButton *btn = (ofxUIButton *) e.getButton();
if (btn->getValue())
guihash["1"]->loadSettings("settings/"+guihash["1"]->getName()+"Settings.xml");
}
else if(e.getName() == "save_blobtracker")
{
ofxUIButton *btn = (ofxUIButton *) e.getButton();
if (btn->getValue())
guihash["1"]->saveSettings("settings/"+guihash["1"]->getName()+"Settings.xml");
}
else if(e.getName() == "load_blobtracker")
{
ofxUIButton *btn = (ofxUIButton *) e.getButton();
if (btn->getValue())
guihash["2"]->loadSettings("settings/"+guihash["2"]->getName()+"Settings.xml");
}
else if(e.getName() == "save_warper")
{
ofxUIButton *btn = (ofxUIButton *) e.getButton();
if (btn->getValue())
warper.save("settings/warper.xml");
}
else if(e.getName() == "load_warper")
{
ofxUIButton *btn = (ofxUIButton *) e.getButton();
if (btn->getValue())
warper.load("settings/warper.xml");
}
else if(e.getName() == "warper_mode")
{
ofxUIToggle *tgl = (ofxUIToggle *) e.getToggle();
if (tgl->getValue())
warper.activate();
else
warper.deactivate();
}
// else if(e.getName() == "FULLSCREEN")
// {
//.........这里部分代码省略.........