本文整理汇总了C++中ofxUIEventArgs::getToggle方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxUIEventArgs::getToggle方法的具体用法?C++ ofxUIEventArgs::getToggle怎么用?C++ ofxUIEventArgs::getToggle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxUIEventArgs
的用法示例。
在下文中一共展示了ofxUIEventArgs::getToggle方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guiEvent
void testApp::guiEvent(ofxUIEventArgs &e) {
string name = e.widget->getName();
if ( name == "PLAYHEAD" && videoPlayer.isPlaying() )
videoPlayer.setPosition( e.getSlider()->getValue() );
else if ( name == "MUTE" )
videoPlayer.setVolume( e.getToggle()->getValue() ? 0.0 : 1.0 );
else if ( name == "USE WEBCAM" ) {
if ( e.getToggle()->getValue() ) {
if ( videoSource != &videoGrabber ) {
cout << "switching back to webcam" << endl;
videoSource = &videoGrabber;
vfx1.setVideoSource( videoSource );
videoPlayer.stop();
}
}
else {
// if there is no video loaded, we stick with webcam
if ( !videoPlayer.isLoaded() ) {
cout << "no video loaded... sticking with webcam" << endl;
e.getToggle()->setValue( true );
}
else {
// make sure the video player is still playing
if ( !videoPlayer.isPlaying() ) videoPlayer.play();
videoSource = &videoPlayer;
vfx1.setVideoSource( videoSource );
videoPlayer.play();
}
}
}
}
示例2: guiEvent
void ofApp::guiEvent(ofxUIEventArgs &e)
{
if (e.getName() == "FULLSCREEN")
{
ofxUIToggle* toggle = e.getToggle();
ofSetFullscreen(toggle->getValue());
}
else if (e.getName() == "ENABLE FACE TRACKING")
{
ofxUIToggle* toggle = e.getToggle();
trackingEnabled = toggle->getValue();
}
else if (e.getName() == "SHOW TRACKER")
{
ofxUIToggle* toggle = e.getToggle();
showTracker = toggle->getValue();
}
else if (e.getName() == "SET TRACKER OFFSET") {
ofxUIButton *button = (ofxUIButton *)e.widget;
if (button->getValue()) {
trackerOffset = ofVec2f(cam.getPosition().x - trackerOffset.x,
cam.getPosition().y - trackerOffset.y);
}
}
else if (e.getName() == "REMOVE TRACKER OFFSET") {
ofxUIButton *button = (ofxUIButton *)e.widget;
if (button->getValue()) {
trackerOffset = ofVec2f();
}
}
}
示例3: mainUiEvent
void ofxUITabBar::mainUiEvent(ofxUIEventArgs &event)
{
string name = event.getName();
for (map<ofxUIToggle*, ofxUICanvas*>::iterator it=canvases.begin(); it!=canvases.end(); ++it)
{
if(active != NULL && active->getName() == name)
{
it->first->setValue(false);
it->second->disable();
active = NULL;
}
else if(it->second->getName() == name && event.getToggle()->getValue())
{
active = it->second;
it->first->setValue(true);
it->second->enable();
it->second->setPosition(rect->getX() + rect->getWidth() + padding*0.5, this->rect->getY());
}
else
{
it->first->setValue(false);
it->second->disable();
}
}
}
示例4: 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;
}
}
示例5: guiSystemEvent
void CloudsVisualSystemPaintBrush::guiSystemEvent(ofxUIEventArgs &e)
{
if (e.widget->getKind() == OFX_UI_WIDGET_TOGGLE && e.getToggle()->getValue()) {
string name = e.getName();
for (map<string, ofPixels *>::iterator it = colorMapPixelsMap.begin(); it != colorMapPixelsMap.end(); it++) {
if (it->first == name) {
colorMap = it->second;
}
}
}
}
示例6: 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;
}
}
示例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: 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();
}
示例9: guiEvent
void testApp::guiEvent(ofxUIEventArgs &e)
{
if(e.getName() == "FULLSCREEN")
{
ofxUIToggle *toggle = e.getToggle();
ofSetFullscreen(toggle->getValue());
}else if(e.getName() == "Meditation_Level")
{
ofxUISlider *slider = e.getSlider();
meditationLevel = slider->getScaledValue();
}else if(e.getName() == "camera_distance"){
ofxUISlider *slider = e.getSlider();
camDistance = slider->getScaledValue();
}else if(e.getName() == "background_color"){
ofxUISlider *slider = e.getSlider();
ofBackground(slider->getScaledValue());
}else if(e.getName() == "Whole_Scene_Position_x"){
ofxUISlider *slider = e.getSlider();
whole_scene_x = slider->getScaledValue();
}else if(e.getName() == "Whole_Scene_Position_y"){
ofxUISlider *slider = e.getSlider();
whole_scene_y = slider->getScaledValue();
}else if(e.getName() == "Whole_Scene_Position_z"){
ofxUISlider *slider = e.getSlider();
whole_scene_z = slider->getScaledValue();
}else if(e.getName() == "Whole_Scene_Rotate_x"){
ofxUISlider *slider = e.getSlider();
scene_rx = slider->getScaledValue();
}else if(e.getName() == "Whole_Scene_Rotate_y"){
ofxUISlider *slider = e.getSlider();
scene_ry = slider->getScaledValue();
}else if(e.getName() == "Whole_Scene_Rotate_z"){
ofxUISlider *slider = e.getSlider();
scene_rz = slider->getScaledValue();
}else if(e.getName() == "particle_Size"){
ofxUISlider *slider = e.getSlider();
particleSize = slider->getScaledValue();
}else if(e.getName() == "PlaneX"){
ofxUISlider *slider = e.getSlider();
planeX = slider->getScaledValue();
}else if(e.getName() == "PlaneY"){
ofxUISlider *slider = e.getSlider();
planeY = slider->getScaledValue();
}else if(e.getName() == "PlaneZ"){
ofxUISlider *slider = e.getSlider();
planeZ = slider->getScaledValue();
}else if(e.getName() == "whole_scene_scale"){
ofxUISlider *slider = e.getSlider();
whole_scene_scale = slider->getScaledValue();
}else if(e.getName() == "tv_x"){
ofxUISlider *slider = e.getSlider();
tv_x = slider->getScaledValue();
}else if(e.getName() == "tv_y"){
ofxUISlider *slider = e.getSlider();
tv_y = slider->getScaledValue();
}else if(e.getName() == "tv_z"){
ofxUISlider *slider = e.getSlider();
tv_z = slider->getScaledValue();
}else if(e.getName() == "gif_x"){
ofxUISlider *slider = e.getSlider();
image_x = slider->getScaledValue();
}else if(e.getName() == "gif_y"){
ofxUISlider *slider = e.getSlider();
image_y = slider->getScaledValue();
}else if(e.getName() == "gif_z"){
ofxUISlider *slider = e.getSlider();
image_z = slider->getScaledValue();
}else if(e.getName() == "gif_scale"){
ofxUISlider *slider = e.getSlider();
image_scale = slider->getScaledValue();
}
}
示例10: 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")
// {
//.........这里部分代码省略.........
示例11: selfGuiEvent
void CloudsVisualSystemCubeCraft::selfGuiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
if(name == "edgeColor")
{
ofxUIImageSampler* sampler = (ofxUIImageSampler *) e.widget;
edgeColor = sampler->getColor();
}
else if(name == "fillColor")
{
ofxUIImageSampler* sampler = (ofxUIImageSampler *) e.widget;
fillColor = sampler->getColor();
}
else if(name == "specColor")
{
ofxUIImageSampler* sampler = (ofxUIImageSampler *) e.widget;
fillColor2 = sampler->getColor();
}
else if(name == "fogSaturation" || name == "fogHue" || name == "fogBrightness" )
{
fogColor.setHsb(fogHue, fogSaturation, fogBrightness);
fogGui->getWidget("FOG_Color")->setColorFill( fogColor);
fogGui->getWidget("fogHue")->setColorFill( fogColor);
fogGui->getWidget("fogSaturation")->setColorFill(fogColor);
fogGui->getWidget("fogBrightness")->setColorFill(fogColor);
// fogGui->setColorBack( fogColor );
bgHue = fogHue;
bgSat = fogSaturation;
bgBri = fogBrightness;
}
else if(name == "groundHue" || name == "groundSaturation" || name == "groundBrightness")
{
groundColor.setHue(groundHue);
groundColor.setSaturation(groundSaturation);
groundColor.setBrightness(groundBrightness);
mineCraftGui->getWidget("GroundHSB")->setColorFill(groundColor);
mineCraftGui->getWidget("groundHue")->setColorFill(groundColor);
mineCraftGui->getWidget("groundSaturation")->setColorFill(groundColor);
mineCraftGui->getWidget("groundBrightness")->setColorFill(groundColor);
}
else if(name == "cloudShadowHue" || name == "cloudShadowSaturation" || name == "cloudShadowBrightness")
{
cloudShadowColor.setHue(cloudShadowHue);
cloudShadowColor.setSaturation(cloudShadowSaturation);
cloudShadowColor.setBrightness(cloudShadowBrightness);
mineCraftGui->getWidget("CloudShadowHSB")->setColorFill(cloudShadowColor);
mineCraftGui->getWidget("cloudShadowHue")->setColorFill(cloudShadowColor);
mineCraftGui->getWidget("cloudShadowSaturation")->setColorFill(cloudShadowColor);
mineCraftGui->getWidget("cloudShadowBrightness")->setColorFill(cloudShadowColor);
}
else if(name == "undergroundHue" || name == "undergroundSaturation" || name == "undergroundBrightness")
{
undergroundColor.setHue(undergroundHue);
undergroundColor.setSaturation(undergroundSaturation);
undergroundColor.setBrightness(undergroundBrightness);
mineCraftGui->getWidget("UndergroundHSB")->setColorFill(undergroundColor);
mineCraftGui->getWidget("undergroundHue")->setColorFill(undergroundColor);
mineCraftGui->getWidget("undergroundSaturation")->setColorFill(undergroundColor);
mineCraftGui->getWidget("undergroundBrightness")->setColorFill(undergroundColor);
}
if(name == "dimX" || name == "dimY" || name == "dimZ" )
{
if(bDrawCubeCraft)
{
dimY = 1;
}
resizeVoxelGrid();
}
if(name == "DrawCubeCraft" && e.getToggle()->getValue())
{
bDrawVoxels = false;
//resizeVoxelGrid();
}
if( name == "DrawVoxels" && e.getToggle()->getValue())
{
bDrawCubeCraft = false;
//resizeVoxelGrid();
}
}
示例12: if
void CloudsVisualSystem3DModelLoader::selfGuiEvent(ofxUIEventArgs &e)
{
// cout << "e.getName(): " << e.getName() << endl;
string name = e.widget->getName();
int kind = e.widget->getKind();
// if( name == "smooth model" )
// {
// bSmoothModel = e.getToggle()->getValue();
// if( bSmoothModel ){
// //smoothMesh( modelMesh, modelMesh );
// }else{
// //facetMesh( modelMesh, modelMesh );
// }
// }
if(name =="minTilt" || name == "maxTilt")
{
if(perspCam.getMaxTilt() - perspCam.getMinTilt() < 10)
{
perspCam.getMinTilt() = perspCam.getMaxTilt() - 10;
}
perspCam.setToStartPosition( boundCenter );
}
else if( name == "reset transforms")
{
positionOffset.set(0,0,0);
globalRotation.set(0,0,0);
globalRotationVelocity.set(0,0,0);
}
else if(name == "arrowHeight" || name == "arrowRadius" || name == "arrowPointHeight" )
{
resizeTheArrowMesh( arrowRadius, arrowHeight, arrowPointHeight );
}
else if( e.widget->getName() == "c1"){
ofxUIImageSampler* sampler = (ofxUIImageSampler *) e.widget;
modelColor = sampler->getColor();
}
else if( e.widget->getName() == "gridColor"){
ofxUIImageSampler* sampler = (ofxUIImageSampler *) e.widget;
gridColor = sampler->getColor();
}
else if( e.widget->getName() == "gridMajorColor"){
ofxUIImageSampler* sampler = (ofxUIImageSampler *) e.widget;
gridMajorColor = sampler->getColor();
}
else if( kind == OFX_UI_WIDGET_TOGGLE)
{
if (name == "loop")
{
bUseDuration = e.getToggle()->getValue();
}
if( e.getToggle()->getValue() )
{
string parent = e.getToggle()->getParent()->getName();
cout << "**** " << name << " TRIGGERED TOGGLE " << parent << endl;
if (parent == "shaders")
{
//switch to this active shader from a shader map
if(shaderMap.find( name ) != shaderMap.end() )
{
cout << parent << " : " << name << " : " << shaderMap[ name ] << endl;
activeShader = shaderMap[ name ];
}
}
else if(parent == "model files")
{
//load the model from the selected file
for (int i=0; i<objFiles.size(); i++)
{
if(objFiles[i] == name )
{
cout << "loading model: " << name << endl;
loadModel(name);
//loadModel( "models/" + name, bSmoothModel );
//loadModel( getVisualSystemDataPath(true) + "models/" + name, bSmoothModel );
}
}
}
else if(parent == "camera paths")
{
//load the model from the selected file
for (int i=0; i<cameraPaths.size(); i++)
{
if(cameraPaths[i] == name )
{
cout << "loading camera path: " << name << endl;
// pathCamera.loadPathFromFile(getVisualSystemDataPath(false) + "cameraPaths/" + name );
pathCamera.loadPathFromFile(getVisualSystemDataPath() + "cameraPaths/" + name );
//.........这里部分代码省略.........