void PS3EYECaptureApp::setup() { using namespace ps3eye; // list out the devices std::vector<PS3EYECam::PS3EYERef> devices( PS3EYECam::getDevices() ); console() << "found " << devices.size() << " cameras" << std::endl; mTimer = Timer(true); mCamFrameCount = 0; mCamFps = 0; mCamFpsLastSampleFrame = 0; mCamFpsLastSampleTime = 0; gui = new ciUICanvas(0,0,320, 480); float gh = 15; float slw = 320 - 20; if(devices.size()) { eye = devices.at(0); bool res = eye->init(640, 480, 60); console() << "init eye result " << res << std::endl; eye->start(); frame_bgr = new uint8_t[eye->getWidth()*eye->getHeight()*3]; mFrame = Surface(frame_bgr, eye->getWidth(), eye->getHeight(), eye->getWidth()*3, SurfaceChannelOrder::BGR); memset(frame_bgr, 0, eye->getWidth()*eye->getHeight()*3); gui->addWidgetDown(new ciUILabel("EYE", CI_UI_FONT_MEDIUM)); eyeFpsLab = new eyeFPS(CI_UI_FONT_MEDIUM); gui->addWidgetRight(eyeFpsLab); // controls gui->addWidgetDown(new ciUIToggle(gh, gh, false, "auto gain")); gui->addWidgetRight(new ciUIToggle(gh, gh, false, "auto white balance")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 63, eye->getGain(), "gain")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 63, eye->getSharpness(), "sharpness")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 255, eye->getExposure(), "exposure")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 255, eye->getBrightness(), "brightness")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 255, eye->getContrast(), "contrast")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 255, eye->getHue(), "hue")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 255, eye->getBlueBalance(), "blue balance")); gui->addWidgetDown(new ciUISlider(slw, gh, 0, 255, eye->getRedBalance(), "red balance")); gui->registerUIEvents(this, &PS3EYECaptureApp::guiEvent); } }
void ciUIDynamicDropDownApp::setup() { guiWidth = getWindowWidth()*.5; guiHeight= getWindowHeight(); dim = guiWidth*.0625; length = guiWidth-CI_UI_GLOBAL_WIDGET_SPACING*2; bgValue = 0.75; gui = new ciUICanvas(0,0,guiWidth, guiHeight); gui->addWidgetDown(new ciUILabel("CIUI: DYNAMIC DROP DOWN", CI_UI_FONT_LARGE)); gui->addWidgetDown(new ciUILabel("PRESS '1' TO ADD TO LIST", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabel("PRESS '2' TO DELETE FROM LIST", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabel("PRESS '3' TO DELETE ALL IN LIST", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabel("PRESS '4' TO OPEN/CLOSE THE LIST", CI_UI_FONT_MEDIUM)); vector<string> names; names.push_back("ONE"); names.push_back("TWO"); names.push_back("THREE"); names.push_back("FOUR"); names.push_back("FIVE"); ddl = new ciUIDropDownList(length, "DYNAMIC DROP DOWN", names, CI_UI_FONT_MEDIUM); ddl->setAllowMultiple(true); gui->addWidgetDown(ddl); gui->registerUIEvents(this, &ciUIDynamicDropDownApp::guiEvent); }
void ciUIButtonsApp::setup() { guiWidth = getWindowWidth()*.5; guiHeight= getWindowHeight(); dim = guiWidth*.0625; length = guiWidth-CI_UI_GLOBAL_WIDGET_SPACING*2; bgValue = 0.75; gui = new ciUICanvas(0,0,guiWidth, guiHeight); gui->addWidgetDown(new ciUILabel("CIUI: BUTTONS & TOGGLES", CI_UI_FONT_LARGE)); gui->addWidgetDown(new ciUISpacer(length, 2)); gui->addWidgetDown(new ciUILabel("SIMPLE BUTTONS & TOGGLES", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUIButton(dim*2,dim*2,false, "BUTTON", CI_UI_FONT_SMALL)); gui->addWidgetRight(new ciUIToggle(dim*2,dim*2,false, "TOGGLE", CI_UI_FONT_SMALL)); gui->addWidgetDown(new ciUISpacer(length, 2), CI_UI_ALIGN_LEFT); gui->addWidgetDown(new ciUILabel("SINGLE IMAGE BUTTONS & TOGGLES", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUIImageButton(dim*2,dim*2, false, loadResource(PLAY_IMAGE), "PLAY")); gui->addWidgetRight(new ciUIImageToggle(dim*2,dim*2, false, loadResource(PLAY_IMAGE), "PLAY")); gui->addWidgetDown(new ciUISpacer(length, 2), CI_UI_ALIGN_LEFT); gui->addWidgetDown(new ciUILabel("MULTI-IMAGE BUTTONS & TOGGLES", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUIMultiImageButton(dim*2, dim*2, false, "toggle.png", "BTN", CI_UI_FONT_SMALL)); gui->addWidgetRight(new ciUIMultiImageToggle(dim*2, dim*2, true, "toggle.png", "TGL", CI_UI_FONT_SMALL)); gui->addWidgetDown(new ciUISpacer(length, 2)); gui->addWidgetDown(new ciUILabelButton(length, false, "LABEL BUTTON LGE", CI_UI_FONT_LARGE)); gui->addWidgetDown(new ciUILabelButton(length, false, "LABEL BUTTON MED", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabelButton(length, false, "LABEL BUTTON SML", CI_UI_FONT_SMALL)); gui->addWidgetDown(new ciUILabelToggle(length, false, "LABEL TOGGLE LGE", CI_UI_FONT_LARGE)); gui->addWidgetDown(new ciUILabelToggle(length, false, "LABEL TOGGLE MED", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabelToggle(length, false, "LABEL TOGGLE SML", CI_UI_FONT_SMALL)); gui->addWidgetDown(new ciUILabelButton(false, "BUTTON AUTO SIZE", CI_UI_FONT_SMALL)); gui->addWidgetRight(new ciUILabelToggle(false, "TOGGLE AUTO SIZE", CI_UI_FONT_SMALL)); gui->addWidgetDown(new ciUISpacer(length, 2), CI_UI_ALIGN_LEFT); vector<string> names; names.push_back("RAD 1"); names.push_back("RAD 2"); gui->addWidgetDown(new ciUIRadio(dim,dim, "RADIO HORIZONTAL", names, CI_UI_ORIENTATION_HORIZONTAL)); vector<string> names2; names2.push_back("RADIO 1"); names2.push_back("RADIO 2"); gui->addWidgetDown(new ciUIRadio(dim,dim, "RADIO VERTICAL", names2, CI_UI_ORIENTATION_VERTICAL)); ((ciUIToggleMatrix *)gui->addWidgetDown(new ciUIToggleMatrix(dim, dim, 4, 5, "TOGGLE MATRIX")))->setAllowMultiple(true); //true by default ((ciUIToggleMatrix *)gui->addWidgetRight(new ciUIToggleMatrix(dim, dim, 4, 5, "RADIO MATRIX")))->setAllowMultiple(false); gui->registerUIEvents(this, &ciUIButtonsApp::guiEvent); }
void ciUIExampleiOSApp::setupGUI2() { float w = widgetWidth; float h = dim; float spacerHeight = 2; gui1 = new ciUICanvas(gui->getRect()->getX()+gui->getRect()->getWidth(),0,menuWidth,menuHeight); gui1->addWidgetDown(new ciUILabel("MORE WIDGETS", CI_UI_FONT_LARGE)); gui1->addWidgetDown(new ciUISpacer(w, spacerHeight)); gui1->addWidgetDown(new ciUI2DPad(w, w*.5, Vec2f(w*.5,w*.25), "2DPAD"), CI_UI_ALIGN_LEFT); gui1->addWidgetDown(new ciUISpacer(w, spacerHeight)); gui1->addWidgetDown(new ciUILabel("NUMBER DIALER", CI_UI_FONT_MEDIUM)); gui1->addWidgetDown(new ciUINumberDialer(-10000.0, 10000.0, 10000.0, 4, "NUMBER DIALER", CI_UI_FONT_MEDIUM)); gui1->addWidgetDown(new ciUISpacer(w, spacerHeight), CI_UI_ALIGN_LEFT); gui1->addWidgetDown(new ciUILabel("BUTTONS & TOGGLES", CI_UI_FONT_MEDIUM)); gui1->addWidgetDown(new ciUIButton(h,h,false, "BUTTON", CI_UI_FONT_SMALL)); gui1->addWidgetRight(new ciUIToggle(h,h,false, "TOGGLE", CI_UI_FONT_SMALL)); gui1->addWidgetDown(new ciUIMultiImageButton(h, h, false, "toggle.png", "MULTI-IMAGE BUTTON", CI_UI_FONT_SMALL)); gui1->addWidgetDown(new ciUIMultiImageToggle(h, h, true, "toggle.png", "MULTI-IMAGE TOGGLE", CI_UI_FONT_SMALL)); gui1->addWidgetDown(new ciUILabelButton(w, false, "LABEL BUTTON", CI_UI_FONT_MEDIUM, h)); gui1->addWidgetDown(new ciUILabelButton(false, "BUTTON AUTO SIZE", CI_UI_FONT_SMALL)); gui1->addWidgetDown(new ciUILabelToggle(w, false, "LABEL TOGGLE", CI_UI_FONT_MEDIUM, h)); gui1->addWidgetDown(new ciUILabelToggle(false, "TOGGLE AUTO SIZE", CI_UI_FONT_SMALL)); gui1->autoSizeToFitWidgets(); gui1->registerUIEvents(this, &ciUIExampleiOSApp::guiEvent); }
void ciUIExampleiOSApp::setupGUI1() { float w = widgetWidth; float h = dim; float spacerHeight = 2; gui = new ciUICanvas(0,0,menuWidth,menuHeight); gui->addWidgetDown(new ciUILabel("CINDER UI: CIUI", CI_UI_FONT_LARGE)); gui->addWidgetDown(new ciUISpacer(w, spacerHeight)); gui->addWidgetDown(new ciUILabel("BY REZA ALI @rezaali", CI_UI_FONT_SMALL)); gui->addWidgetDown(new ciUILabel("SLIDERS", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabel("CHANGE THEMES:", CI_UI_FONT_MEDIUM)); ((ciUISlider *)gui->addWidgetDown(new ciUISlider(w, h, 0, 44, 0.0, "THEME SELECTOR")))->setIncrement(1.0); gui->addWidgetDown(new ciUISlider(w, h, 0, 1.0, bgColorR, "RED")); gui->addWidgetDown(new ciUISlider(w, h, 0, 1.0, bgColorG, "GREEN")); gui->addWidgetDown(new ciUISlider(w, h, 0, 1.0, bgColorB, "BLUE")); gui->addWidgetDown(new ciUIRangeSlider(w, h, 0, 100, 25, 75, "RANGE SLIDER")); gui->addWidgetDown(new ciUIMinimalSlider(w, h, 0, 1.00, 0.50, "MINIMAL SLIDER")); gui->addWidgetDown(new ciUIBiLabelSlider(w, h, 0, 1, .5, "BILABEL", "BILABEL", "SLIDER")); gui->addWidgetDown(new ciUIFPSSlider(w, h, 0, 120.00, 0.50, "FPS SLIDER")); gui->addWidgetDown(new ciUISpacer(w, spacerHeight)); gui->autoSizeToFitWidgets(); gui->registerUIEvents(this, &ciUIExampleiOSApp::guiEvent); }
void ciUISimpleExampleApp::setup() { backgroundColor.r = 0.5; backgroundColor.g = 0.5; backgroundColor.b = 0.5; red = .75; green = .75; blue = .75; alpha = .8; radius = 150; drawFill = true; backgroundColor = ColorA(233.0/255.0, 52.0/255.0, 27.0/255.0); resolution = 30; position = Vec2f(getWindowWidth()*.5, getWindowHeight()*.5); guiWidth = getWindowWidth()*.5; guiHeight= getWindowHeight(); dim = guiWidth*.0625; length = guiWidth-CI_UI_GLOBAL_WIDGET_SPACING*2; gui = new ciUICanvas(0,0,guiWidth, guiHeight); gui->addWidgetDown(new ciUILabel("CIUI: SIMPLE EXAMPLE", CI_UI_FONT_LARGE)); gui->addWidgetDown(new ciUILabel("BACKGROUND CONTROL", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUISlider(length/3.0 - CI_UI_GLOBAL_WIDGET_SPACING, dim, 0, 1.0, (float)backgroundColor.r, "BGR")); gui->addWidgetRight(new ciUISlider(length/3.0 - CI_UI_GLOBAL_WIDGET_SPACING, dim, 0, 1.0, (float)backgroundColor.g, "BGG")); gui->addWidgetRight(new ciUISlider(length/3.0 - CI_UI_GLOBAL_WIDGET_SPACING, dim, 0, 1.0, (float)backgroundColor.b, "BGB")); gui->addWidgetDown(new ciUILabel("CIRCLE CONTROL", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUISlider(length/3.0 - CI_UI_GLOBAL_WIDGET_SPACING, dim, 0.0, 1.0, red, "RED")); gui->addWidgetRight(new ciUISlider(length/3.0 - CI_UI_GLOBAL_WIDGET_SPACING, dim, 0.0, 1.0, green, "GREEN")); gui->addWidgetRight(new ciUISlider(length/3.0 - CI_UI_GLOBAL_WIDGET_SPACING, dim, 0.0, 1.0, blue, "BLUE")); gui->addWidgetSouthOf(new ciUISlider(length,dim, 0.0, 1.0, alpha, "ALPHA"), "RED"); gui->addWidgetDown(new ciUISlider(length,dim, 0.0, 600.0, radius, "RADIUS")); gui->addWidgetDown(new ciUISlider(length,dim, 3, 60, resolution, "RESOLUTION")); gui->addWidgetDown(new ciUILabelToggle(length, drawFill, "DRAW FILL", CI_UI_FONT_MEDIUM)); float padWidth = length; float padHeight = length*((float)getWindowHeight()/(float)getWindowWidth()); gui->addWidgetDown(new ciUI2DPad(padWidth, padHeight, Vec2f(padWidth*.5, padHeight*.5), "POSITION")); gui->addWidgetDown(new ciUISpacer(length, 2)); gui->addWidgetDown(new ciUILabel("HIDE & SHOW GUI BY PRESSING 'g'", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabel("MOUSE OVER A SLIDER AND", CI_UI_FONT_MEDIUM)); gui->addWidgetDown(new ciUILabel("PRESS UP, DOWN, LEFT, RIGHT", CI_UI_FONT_MEDIUM)); gui->registerUIEvents(this, &ciUISimpleExampleApp::guiEvent); }