本文整理汇总了C++中ofxUIEventArgs::getSlider方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxUIEventArgs::getSlider方法的具体用法?C++ ofxUIEventArgs::getSlider怎么用?C++ ofxUIEventArgs::getSlider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxUIEventArgs
的用法示例。
在下文中一共展示了ofxUIEventArgs::getSlider方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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();
}
}
}
}
示例3: guiEvent
//--------------------------------------------------------------
void AnimationWaves::guiEvent(ofxUIEventArgs &e)
{
Animation::guiEvent(e);
string name = e.getName();
if (name == "nbWavePoints")
{
m_nbWavePoints = (int) e.getSlider()->getScaledValue();
updateNbPointsForWaves();
}
}
示例4: 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);
}
}
}
示例5: guiEvent
void ofApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.getName();
cout << "got event from: " << name << endl;
if(name == "VAR")
{
ofxUISlider *sliderValue = (ofxUISlider *) e.getSlider();
ofxOscMessage m;
m.setAddress("/var");
m.addFloatArg(sliderValue->getValue());
sender.sendMessage(m);
}
}
示例6: 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();
}
}
示例7: 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")
// {
//.........这里部分代码省略.........
示例8: guiEvent
//--------------------------------------------------------------
void testApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.widget->getName();
int kind = e.widget->getKind();
if(kind == OFX_UI_WIDGET_TOGGLE)
{
ofxUIToggle *toggle = (ofxUIToggle *) e.widget;
if (name == "ENEMIES") {
creatingEnemies = true;
}
if (name == "COLLECTABLES") {
creatingEnemies = false;
}
}
if (name == "Included Patterns") {
if (patternList->isOpen() == true) {
cout << "Show Remove Button" << endl;
removeButton->setVisible(true);
removeButton->setLabelText("REMOVE");
}
else {
cout << "Hide Remove Button" << endl;
removeButton->setVisible(false);
}
}
if (name == "Starting") {
ofxUISlider *speedSlider = (ofxUISlider *) e.getSlider();
speed = speedSlider->getScaledValue();
currentSpeed = speed;
}
if (name == "Multiplier") {
ofxUISlider *multiSlider = (ofxUISlider *) e.getSlider();
multiplier = multiSlider->getScaledValue();
}
if(name == "SIZE")
{
ofxUISlider *slider = (ofxUISlider *) e.getSlider();
pointSize = slider->getScaledValue();
}
if(name == "clear pattern") {
buttonCount++;
if(buttonCount ==2) {
enemies.clear();
collectables.clear();
XML.clear();
}
}
if (name == "save pattern") {
buttonCount++;
if (buttonCount == 2) {
savePattern();
buttonCount = 0;
}
}
if (name == "add to level") {
buttonCount++;
if (buttonCount == 2) {
patterns.push_back(patternInput->getTextString() + ".xml");
patternList->addToggle(patternInput->getTextString());
savePattern();
buttonCount = 0;
}
}
if (name == "REMOVE PATTERN") {
buttonCount++;
if (buttonCount ==2) {
vector<ofxUIWidget *> &selected = patternList->getSelected();
for(int i = 0; i < selected.size(); i++)
{
cout << "SELECTED: " << selected[i]->getName() << endl;
patterns.erase(patterns.begin() + i);
patternList->removeToggle(selected[i]->getName());
}
buttonCount = 0;
}
}
if (name == "SAVE LEVEL") {
buttonCount++;
if (buttonCount == 2) {
ofxXmlSettings levelXML;
levelXML.setValue("name", levelInput->getTextString());
levelXML.setValue("author", authorInput->getTextString());
levelXML.setValue("complete", completeInput->getTextString());
levelXML.setValue("speed", speedSlider->getValue());
levelXML.setValue("multiplier", multiSlider->getValue());
for (int i = 0; i < patterns.size(); i++) {
levelXML.setValue("file", patterns[i], i);
}
//.........这里部分代码省略.........