Esempio n. 1
0
void ButtonsAndTexturesApp::setup() {
    rotation = 0;
    screenshot = gl::Texture(getWindowWidth(), getWindowHeight()); //uninitialized texture with random pixels from GPU memory
        
    gui = new SimpleGUI(this);
	gui->lightColor = ColorA(1, 1, 0, 1);		
	gui->addLabel("CONTROLS");
    
    //let's add a button
    gui->addButton("Restart")->registerClick(this, &ButtonsAndTexturesApp::restartButtonClick);
    
    gui->addSeparator();
    gui->addLabel("SCREENSHOT");
    
    screenshotTextureControl = gui->addParam("Screenshot", &screenshot);
    
    //you can also store reference to it and add callback as a second step
    takeScreenshotButton = gui->addButton("Take screenshot");    
	cbTakeScreenshotButtonClick = takeScreenshotButton->registerClick(this, &ButtonsAndTexturesApp::takeScreenshotButtonClick);    
    
    //to stop listening to click do this:
    //takeScreenshotButton->unregisterClick(cbTakeScreenshotButtonClick);
    
	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();

}
Esempio n. 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();
	
}
Esempio n. 3
0
void RogalarmApp::setup()
{
	mFullscreen = false;
	mUser		= false;
	mNoUserMessage    = false;
	setFullScreen(mFullscreen);
	mUserPos = 0;
	mDebug = false;	
	mKonnect = loadImage(loadResource("konnect-kinect.jpg") );
	
	try {
		mKinect = Kinect( Kinect::Device() );
		mKinectConected = true;
		
	} catch( ... ){
		mKinectConected = false;
	}
    
    
    mConfigPath = getResourcePath().c_str();
    mConfigPath += "settings.sgui.txt";
   
	
    
	mStopedTime = getElapsedSeconds();
	
	
	mTargetPosition = Vec3f::zero();
	
	mContourTexture = gl::Texture(getWindowWidth(), getWindowHeight());
	mDepthTexture = gl::Texture(getWindowWidth(), getWindowHeight());
	
	mGui = new SimpleGUI(this);
	mGui->lightColor = ColorA(1, 1, 0, 1);
	
	mGui->addLabel("CONTROLS");
	mGui->addParam("Depth Threshold", &mThreshold, 0, 255, 70);
	mGui->addParam("Min Contour Area", &mBlobMin, 10, 100, 30);
	mGui->addParam("Max Contour Area", &mBlobMax, 100, 500, 200);
	mGui->addSeparator();
	mGui->addParam("Reflection Top", &mReflectionTop, 0, 480, 0);
	mGui->addParam("Reflection Bottom", &mReflectionBottom, 0, 480, 0);
	mGui->addSeparator();
	mGui->addLabel("OPTIONS");
	mGui->addParam("Fullscreen (f)", &mFullscreen, false);
	mGui->addButton("Save Configuration")->registerClick(this, &RogalarmApp::openSaveConfigClick);
	mGui->addColumn(142, 7);
	mGui->addLabel("Contour Image");
	mGui->addParam("Contour Texture", &mContourTexture); 
	mGui->addLabel("Depth Image");
	mGui->addParam("Depth Texture", &mDepthTexture);
	
	mGui->load(mConfigPath);
	
	mHost = "10.0.1.137";
	mPort = 7110;
	mSender.setup(mHost, mPort);



}