void GroupingApp::setup() {
	fbo = gl::Fbo(getWindowWidth(), getWindowHeight());
	
	gui = new SimpleGUI(this, Font(loadResource(RES_SGUI_FONT), 8));
	gui->lightColor = ColorA(1, 1, 0, 1);	
	gui->addColumn();
	gui->addLabel("CONTROLS");
	gui->addParam("Rotation", &rotation, 0, 360, 0);
	gui->addParam("Size", &size, 100, 600, 200); 	
	gui->addParam("Color", &color, ColorA(0,0.5,1,0.5), SimpleGUI::RGB); //use R,G,B,A sliders
	gui->addColumn();	
	gui->addLabel("RENDER TYPE");
	gui->addParam("Fill", &fill, true, RENDER_TYPE_GROUP); //if we specify group id, we create radio button set
	gui->addParam("Stroke", &stroke, false, RENDER_TYPE_GROUP); //i.e. only one of the buttons can be active at any time	
	strokePanel = gui->addPanel();
	gui->addParam("Thickness", &thickness, 1, 10);
	gui->addColumn();
	gui->addLabel("OPTIONS");
	gui->addParam("Auto Rotation", &autoRotation, false); 	
	gui->addColumn();
	gui->addLabel("PREVIEW");
	gui->addParam("PreviewTex", &fbo.getTexture()); 	
	
	gui->load(CONFIG_FILE); //we load settings after specifying all the 
	//params because we need to know their name and type
	
	timer.start();
	prevTime = timer.getSeconds();
	
	
}
Exemple #2
0
void RogersGuiApp::setup() {
    rotation = 0;
    screenshot = gl::Texture(getWindowWidth(), getWindowHeight()); //uninitialized texture with random pixels from GPU memory
	IntVarControl *ic;
	BoolVarControl *bc;
	PanelControl *pc;
	ByteVarControl *btc;
	FlagVarControl *fc;
	aString = "whatever";
	
    gui = new SimpleGUI(this);
	gui->lightColor = ColorA(1, 1, 0, 1);
	gui->addColumn();
	gui->addLabel("> READ ONLY");
    gui->addSeparator();
	gui->addLabel("READONLY");
	gui->addParam("String", &aString);						// !NEW! Update aString will update label 
	gui->addParam("Window Width", &windowWidth, 0, 1920, getWindowWidth())->setReadOnly();		// !NEW! No slider, just value
	gui->addParam("Window Height", &windowHeight, 0, 1080, getWindowHeight())->setReadOnly();	// !NEW! No slider, just value
	gui->addParam("FPS", &FPS, 0, 60, 0)->setReadOnly();	// !NEW! No slider, just value
    gui->addSeparator();
    
	// Textures
	gui->addLabel("> TEXTURES");
    gui->addSeparator();
    takeScreenshotButton = gui->addButton("Take screenshot");    
	takeScreenshotButton->registerClick(this, &RogersGuiApp::takeScreenshotButtonClick);    
    screenshotTextureControl = gui->addParam("Screenshot", &screenshot);
	screenshotTextureControl->refreshRate = 0.0;		// !NEW! let's refresh manually
	//screenshotTextureControl->refreshRate = 0.1;		// !NEW! use this for movies or syphon
    //takeScreenshotButton->unregisterClick(cbTakeScreenshotButtonClick);
    gui->addSeparator();
    gui->addParam("Null Texture example", &nullTex);	// !NEW! Null textures will be marked so
	
    //
	// ROGER:: From Grouping example
	gui->addColumn();
	gui->addLabel("> CONTROLS");
    gui->addSeparator();
    gui->addButton("Restart Animation")->registerClick(this, &RogersGuiApp::restartButtonClick);
	bc = gui->addParam("Auto Rotation ON", &autoRotation, true);
	bc->nameOff = "Auto Rotation OFF";	// !NEW! Alternative label when OFF
	gui->addParam("Rotation", &rotation, 0, 360, 0)->setDisplayValue();
	gui->addParam("Size", &size, 100, 600, 200)->setDisplayValue();
	gui->addParam("Background", &colorBack, Color(0.1, 0.1, 0.5), SimpleGUI::RGB); //use R,G,B,A sliders
	gui->addParam("Color", &color, ColorA(1, 0.2, 0.2, 0.1), SimpleGUI::RGB); //use R,G,B,A sliders
	gui->addParam("HSV", &colorBackHSV, Color(0.1, 0.1, 0.5), SimpleGUI::HSV);
	gui->addParam("HSV+A", &colorHSV, ColorA(1, 0.2, 0.2, 0.1), SimpleGUI::HSV);
    gui->addSeparator();
	gui->addLabel("RENDER TYPE");
	gui->addParam("Fill", &fill, true, RENDER_TYPE_GROUP); //if we specify group id, we create radio button set
	bc = gui->addParam("Stroke", &stroke, false, RENDER_TYPE_GROUP); //i.e. only one of the buttons can be active at any time	
	pc = gui->addPanel();
	bc->switchPanel( pc );		// !NEW! Automatically open/close a panel
	gui->addParam("Thickness", &thickness, 1, 10);
	
	//
	// LIST CONTROL
	gui->addColumn();
	gui->addLabel("> LISTS");
    gui->addSeparator();
    gui->addButton("Increase List")->registerClick(this, &RogersGuiApp::addToList);
    gui->addButton("Decrease List")->registerClick(this, &RogersGuiApp::removeFromList);
	valueLabels[0] = "val 0";
	valueLabels[1] = "val 1";
	valueLabels[2] = "val 2";
    gui->addSeparator();
	theDropDownControl = gui->addParamDropDown("Drop-Down List", &listVal, valueLabels);	// !NEW! Drop-Down control
    gui->addSeparator();
	theListControl = gui->addParamList("Explicit List", &listVal, valueLabels);				// !NEW! List control
    gui->addSeparator();
    gui->addLabel("just a label");
	
	//
	// INTS CONTROL
	gui->addColumn();
	gui->addLabel("> INTS");
    gui->addSeparator();
	gui->addParam("Int Radio (<=10)", &intValue1, 1, 3, 0)->setDisplayValue();		// !NEW! small int range will be displayed as radios
	gui->addParam("Int Radio (<=10)", &intValue2, 1, 10, 0)->setDisplayValue();		// !NEW! small int range will be displayed as radios
	gui->addParam("Int slider (>10)", &intValue3, 1, 11, 0)->setDisplayValue();		// !NEW! Display the value beside labels
	// stepped
    gui->addSeparator();
	ic = gui->addParam("Int Step 2", &intValue4, 0, 10, 0);
	ic->setDisplayValue();
	ic->setStep(2);														// !NEW! int step
	ic = gui->addParam("Int Step 2", &intValue5, 0, 18, 0);
	ic->setDisplayValue();
	ic->setStep(2);														// !NEW! int step
	ic = gui->addParam("Int Step 2", &intValue6, 0, 20, 0);
	ic->setDisplayValue();
	ic->setStep(2);														// !NEW! int step
	
	//
	// BYTE CONTROL
	gui->addColumn();
	gui->addLabel("> BYTES");
    gui->addSeparator();
	gui->addParam("Byte", &byteValue1, 0)->setDisplayValue();			// !NEW! ranges from 0-255
	btc = gui->addParam("Byte as char", &byteValue2, 0);				// !NEW! display as char
	btc->setDisplayValue();
	btc->displayChar = true;
	btc = gui->addParam("Byte as hex", &byteValue3, 0);					// !NEW! display as hex
	btc->setDisplayValue();
	btc->displayHex = true;
	// FLAGS
    gui->addSeparator();
	fc = gui->addParamFlag("Byte Flag", &flagValue, 8, 0x55);			// !NEW! Byte Flag
	fc->setDisplayValue();
	fc->displayHex = true;
	
	
	gui->load(CONFIG_FILE); //we load settings after specifying all the 
    //params because we need to know their name and type
	
	timer.start();
	prevTime = timer.getSeconds();
	
}