本文整理汇总了C++中ofxUIEventArgs::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxUIEventArgs::getName方法的具体用法?C++ ofxUIEventArgs::getName怎么用?C++ ofxUIEventArgs::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxUIEventArgs
的用法示例。
在下文中一共展示了ofxUIEventArgs::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
示例2: selectAudioUnit
//-------------
void ofApp::selectAudioUnit(ofxUIEventArgs &e) {
if (e.getButton()->getValue()) return;
if (e.getName() == "Aalto") {
setupAalto();
}
else if (e.getName() == "Kaivo") {
setupKaivo();
}
}
示例3: guiEvent
void GUIAxes::guiEvent(ofxUIEventArgs &e){
// events based on mouse released
if(ofGetMousePressed()){return;}
string name = e.getName();
int axe = getNumAxe(e.getParent());
ofLogNotice("GUI") << e.getParent()->getName() << " // " << e.getName() << "// " << axe ;
// attributes and aggregator modification
if( axe!=-1 && attr[axe]->getSelected().size()>0 ){
if(isAnAttributeList(e.getParent())){
shouldUpdateAggregator = axe;
}
else if (aggr[axe]->getSelected().size()>0 && scaleType[axe]->getSelectedIndeces().size()>0) {
reorderAxe(axe);
}
}
else if(e.getParent() == coordinateType){
for(int i = 0 ; i <3; i++){
reorderAxe(i);
}
}
// mins maxs modifications
else if (e.getKind() == OFX_UI_WIDGET_NUMBERDIALER){
axe = getNumAxe(e.widget);
float s =((ofxUINumberDialer*)e.widget)->getValue();
ofVec3f mask(axe==0?1:0,axe==1?1:0,axe==2?1:0);
if(name.substr(0,name.length()-1)=="min"){
Physics::mins = s*mask + (-mask+ofVec3f(1))*Physics::mins;
}
if(name.substr(0,name.length()-1)=="max"){
Physics::maxs = s*mask + (-mask+ofVec3f(1))*Physics::maxs;
}
scaleType[axe]->getToggles()[2]->setValue(true);
scaleType[axe]->getToggles()[2]->triggerSelf();
Physics::orderByAttributes(attr[axe]->getSelected()[0]->getName()+"."+aggr[axe]->getSelected()[0]->getName(), axe, scaleType[axe]->getSelectedIndeces()[0]);
}
checkOverlapingDDL(e);
}
示例4: 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();
}
}
}
示例5: guiEvent
void TestScene::guiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
int kind = e.getKind();
//cout << "got event from: " << name << endl;
}
示例6: guiEvent
void SuperColliderLoopElement::guiEvent(ofxUIEventArgs &e) {
if (e.getName() == "Play") {
setPlaying(isPlay);
}
else if (e.getName() == "Rec") {
setToRecord(toRecord);
}
else if (e.getName() == "Solo") {
setSolo(solo);
SuperColliderLoopElement *ref = this;
ofNotifyEvent(soloEvent, ref);
}
else if (e.getName() == "Del") {
SuperColliderLoopElement *ref = this;
ofNotifyEvent(deleteEvent, ref);
}
else if (e.getName() == "Skip") {
skip = pow((float) 2, (float) ((ofxUIRadio *) gui->getWidget("Skip"))->getValue());
count = beat % (numBeats * getSkip());
}
else if (e.getName() == "BusIn") {
int channel = ((ofxUIRadio *) gui->getWidget("BusIn"))->getValue();
bufWriter->set("channel", channel);
}
else if (e.getName() == "Volume") {
cout << "write vol " << volume << endl;
bufReader->set("volume", volume);
}
}
示例7: 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;
}
}
示例8: selfGuiEvent
void CloudsVisualSystemMazeGenerator::selfGuiEvent(ofxUIEventArgs &e)
{
if (e.getName() == "GROUND CAM") {
if (!settings.groundCam)
{
mazeCam.setFlyOver(maze[0]->getWidth()/2);
}
}
}
示例9: 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() ;
}
示例10: guiEvent
//--------------------------------------------------------------
void ofApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
string alignment = "alignment";
if(name == "pixelWidth" || name == "pixelWidthLarge"){
((ofxUITextInput*)settingCanvas->getWidget("pixelWidthText"))->setTextString(ofToString(float(desideredPixelWidthLarge)+desideredPixelWidth));
}else if(name == "pixelWidthText"){
string val = ((ofxUITextInput*)e.widget)->getTextString();
float fval = ofToFloat(val);
desideredPixelWidth = fmodf(fval,1.0);
desideredPixelWidthLarge = floor(fval);
}else if(name == "Calibrate Menu"){
lastState = state;
state = Calibratig;
settingCanvas->setVisible(false);
calibrateCanvas->setVisible(true);
}else if(name.substr(0,alignment.size()) == alignment ){
int start = alignment.size()+1;
int x = ofToInt(name.substr(start,start+1));
int y = ofToInt(name.substr(start+2,start+3));
texAlign.x = x == 0 ? 0 : x == 1 ? 0.5 : 1.0;
texAlign.y = y == 0 ? 1.0 : y == 1 ? 0.5 : 0.0;
}else if(name == "Settings Menu"){
lastState = state;
state = Settings;
settingCanvas->setVisible(true);
calibrateCanvas->setVisible(false);
}else if(name == "Calibration Size"){
ofxUIRadio* w = ((ofxUIRadio*)e.widget);
string active = w->getActiveName();
vector<string> names(calibrationSizeOptionsNames,end(calibrationSizeOptionsNames));
int pos = find(names.begin(), names.end(), active) - names.begin();
((ofxUILabel*)calibrateCanvas->getWidget("selected_calibration"))->setLabel(calibrationSizeOptionsNames[pos]);
currentCalibratorTolLengthInMM = calibrationSizeOptionsValues[pos];
}else if(name == "Read From Marker"){
outPixelPerMM = calibratorTool.getLength() / currentCalibratorTolLengthInMM;
}else if(name == "Syphon Servers"){
ofxUIRadio *syphon_list = (ofxUIRadio*)e.widget;
string active = syphon_list->getActiveName();
vector<string> parts = ofSplitString(active, "::");
syphonServerDesc = ofxSyphonServerDescription(parts[0],parts[1]);
syphonClient.set(syphonServerDesc);
}else if(name == "Mode"){
ofxUIRadio *mode_list = (ofxUIRadio*)e.widget;
if(mode_list->getActiveName() == "Round"){
mode = 0;
}else {
mode = 1;
}
}
}
示例11: guiEvent
//--------------------------------------------------------------
void AnimationWaves::guiEvent(ofxUIEventArgs &e)
{
Animation::guiEvent(e);
string name = e.getName();
if (name == "nbWavePoints")
{
m_nbWavePoints = (int) e.getSlider()->getScaledValue();
updateNbPointsForWaves();
}
}
示例12: 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;
}
}
}
}
示例13: 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;
}
}
示例14: guiEvent
void ofApp::guiEvent(ofxUIEventArgs &e){
string name = e.getName();
int kind = e.getKind();
if (name=="simulate") {
simulate = ((ofxUIToggle *)e.widget)->getValue();
} else if (name == "enable actuator 1"){
enableActuator(1);
} else if (name == "enable actuator 2"){
enableActuator(2);
}
}
示例15: onGuiEvent
void testApp::onGuiEvent( ofxUIEventArgs &e){
// Send Message To Log. Where is message coming from?
cout << "I got a message" << e.getName() << endl;
// Force Slider
if( e.getName() == "Mass"){
ofxUISlider * ForceSlider = (ofxUISlider*)e.widget;
mass = ForceSlider -> getScaledValue();
}
if( e.getName() == "Alpha"){
ofxUISlider * ForceSlider = (ofxUISlider*)e.widget;
alphaLevel = ForceSlider -> getScaledValue();
}
// Alpha Slider
if( e.getName() == "Field"){
ofxUISlider * AlphaSlider = (ofxUISlider*)e.widget;
fieldForce = AlphaSlider -> getScaledValue();
}
}