void tutorialComplete() { CEGUI::ToggleButton* checkbox = static_cast<CEGUI::ToggleButton*>(CEGUI::System::getSingletonPtr()-> getDefaultGUIContext().getRootWindow()->getChildElement("TabControlOpc/TabJuego/checkboxTutorial")); checkbox->setSelected(false); }
vis_settings_panel_impl::vis_settings_panel_impl( const app::zones_t &zones, const app::settings_t& s ) { GUIContext& context = System::getSingleton().getDefaultGUIContext(); CEGUI::Window* root = context.getRootWindow(); WindowManager& winMgr = WindowManager::getSingleton(); FrameWindow* mainWindow = static_cast<FrameWindow*>( CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", "MainWindow") ); mainWindow->setPosition(UVector2(cegui_reldim(0.01f), cegui_reldim(0.5f))); //demoWindow->setSize(USize(cegui_reldim(0.3f), cegui_reldim(0.3f))); mainWindow->setMinSize(USize(cegui_reldim(0.1f), cegui_reldim(0.1f))); mainWindow->setText( "Choose Zone" ); auto fn_exit = [=](const CEGUI::EventArgs& args)->bool { CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext(); CEGUI::Window* root = context.getRootWindow(); root->getChild("MainWindow")->setVisible(false); return true; }; mainWindow->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked,Event::Subscriber(fn_exit)); #if 0 PushButton* btnExit = static_cast<PushButton*>( WindowManager::getSingleton().createWindow("TaharezLook/Button", btn_exit_name) ); root->addChild(btnExit); btnExit->setPosition(UVector2(cegui_reldim(0.95f), cegui_reldim(0.95f))); btnExit->setSize( USize(cegui_reldim(0.04f), cegui_reldim(0.02f)) ); btnExit->setText( "Exit" ); btnExit->subscribeEvent(PushButton::EventClicked, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { exit_app_signal_(); return true; }) ); #endif Combobox* cbbo = static_cast<Combobox*>( CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Combobox", combo_name)); cbbo->setPosition(UVector2(cegui_reldim(0.15f), cegui_reldim( 0.1f))); //cbbo->setSize(USize(cegui_reldim(0.66f), cegui_reldim( 0.33f))); mainWindow->addChild(cbbo); root->addChild( mainWindow ); mainWindow->setVisible(false); ListboxTextItem* itm; CEGUI::Win32StringTranscoder stc; const CEGUI::Image* sel_img = &ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush"); for (auto it = zones.begin(); it!=zones.end();++it) { itm = new ListboxTextItem(stc.stringFromStdWString(it->second), it->first); itm->setSelectionBrushImage(sel_img); cbbo->addItem(itm); } cbbo->subscribeEvent(Combobox::EventListSelectionAccepted, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { Combobox* combo = static_cast<Combobox*>(static_cast<const WindowEventArgs&>(args).window->getRootWindow()->getChild("MainWindow/" + combo_name)); ListboxItem* item = combo->findItemWithText(combo->getText(), 0); if (item) { zone_changed_signal_( item->getID()); } return true; }) ); cbbo->setReadOnly(true); cbbo->setSortingEnabled(false); //cbbo->handleUpdatedListItemData(); CEGUI::ToggleButton* checkbox = static_cast<ToggleButton*>( CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Checkbox", tb_name)); checkbox->setSelected(true); checkbox->setText( "Lights" ); mainWindow->addChild(checkbox); auto settingsWindow = winMgr.loadLayoutFromFile("vis_settings.layout"); root->addChild(settingsWindow); subscribeEvent(setting_dlg + "/Settings/chkLights", ToggleButton::EventSelectStateChanged, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { bool wrap = isCheckboxSelected(setting_dlg + "/Settings/chkLights"); set_lights_signal_(wrap); return true; })); settingsWindow->setVisible(false); subscribeEvent(setting_dlg + "/LWeather/edtGrassMap", CEGUI::Editbox::EventTextAccepted, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { std::string param = getEditboxText(setting_dlg + "/LWeather/edtGrassMap"); set_map_signal_(boost::lexical_cast<float>(param.empty()?"0":param)); return true; })); subscribeEvent(setting_dlg + "/LWeather/btnApply", PushButton::EventClicked, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { std::string param = getEditboxText(setting_dlg + "/LWeather/edtGrassMap"); set_map_signal_(boost::lexical_cast<float>(param.empty()?"0":param)); return true; })); subscribeEvent(setting_dlg + "/Settings/chkShadows", ToggleButton::EventSelectStateChanged, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { bool wrap = isCheckboxSelected(setting_dlg + "/Settings/chkShadows"); set_shadows_signal_(wrap); return true; })); subscribeEvent(setting_dlg + "/Settings/chkShadowsParticles", ToggleButton::EventSelectStateChanged, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { bool wrap = isCheckboxSelected(setting_dlg + "/Settings/chkShadowsParticles"); set_shadows_part_signal_(wrap); return true; })); setItemText(setting_dlg + "/LWeather/edtRadX" , boost::str(boost::format("%.2f") % s.clouds[0].radius_x)); setItemText(setting_dlg + "/LWeather/edtRadY" , boost::str(boost::format("%.2f") % s.clouds[0].radius_y)); setItemText(setting_dlg + "/LWeather/edtX" , boost::str(boost::format("%.2f") % s.clouds[0].x)); setItemText(setting_dlg + "/LWeather/edtY" , boost::str(boost::format("%.2f") % s.clouds[0].y)); setItemText(setting_dlg + "/LWeather/edtHeight" , boost::str(boost::format("%.2f") % s.clouds[0].height)); setItemText(setting_dlg + "/LWeather/edtIntensity", boost::str(boost::format("%.2f") % s.clouds[0].intensity)); setItemText(setting_dlg + "/GWeather/edtIntensity", boost::str(boost::format("%.2f") % s.intensity)); auto cloud_settings_callback = [=](const CEGUI::EventArgs& args)->bool { app::cloud_params_t s; std::string edtRadX = boost::trim_copy(getEditboxText(setting_dlg + "/LWeather/edtRadX")); s.radius_x = boost::lexical_cast<float>(edtRadX.empty()?"0":edtRadX); std::string edtRadY = boost::trim_copy(getEditboxText(setting_dlg + "/LWeather/edtRadY")); s.radius_y = boost::lexical_cast<float>(edtRadY.empty()?"0":edtRadY); std::string edtX = boost::trim_copy(getEditboxText(setting_dlg + "/LWeather/edtX")); s.x = boost::lexical_cast<float>(edtX.empty()?"0":edtX); std::string edtY = boost::trim_copy(getEditboxText(setting_dlg + "/LWeather/edtY")); s.y = boost::lexical_cast<float>(edtY.empty()?"0":edtY); std::string edtHeight = boost::trim_copy(getEditboxText(setting_dlg + "/LWeather/edtHeight")); s.height = boost::lexical_cast<float>(edtHeight.empty()?"0":edtHeight); std::string edtIntensity = boost::trim_copy(getEditboxText(setting_dlg + "/LWeather/edtIntensity")); s.intensity = boost::lexical_cast<float>(edtIntensity.empty()?"0":edtIntensity); s.p_type = 1; set_cloud_param_signal_(s); return true; }; subscribeEvent(setting_dlg + "/LWeather/edtRadX", Editbox::EventTextAccepted, Event::Subscriber(cloud_settings_callback)); subscribeEvent(setting_dlg + "/LWeather/edtRadY", Editbox::EventTextAccepted, Event::Subscriber(cloud_settings_callback)); subscribeEvent(setting_dlg + "/LWeather/edtX" , Editbox::EventTextAccepted, Event::Subscriber(cloud_settings_callback)); subscribeEvent(setting_dlg + "/LWeather/edtY" , Editbox::EventTextAccepted, Event::Subscriber(cloud_settings_callback)); subscribeEvent(setting_dlg + "/LWeather/edtHeight", Editbox::EventTextAccepted, Event::Subscriber(cloud_settings_callback)); subscribeEvent(setting_dlg + "/LWeather/edtIntensity", Editbox::EventTextAccepted, Event::Subscriber(cloud_settings_callback)); subscribeEvent(setting_dlg + "/GWeather/edtIntensity", Editbox::EventTextAccepted, Event::Subscriber([=](const CEGUI::EventArgs& args)->bool { std::string param = boost::trim_copy(getEditboxText(setting_dlg + "/GWeather/edtIntensity")); set_global_intensity_signal_ (boost::lexical_cast<float>(param.empty()?"0":param)); return true; })); }
void GameState::enter() { mInput = InputManager::getSingletonPtr(); mRoot = Ogre::Root::getSingletonPtr(); if (mRoot != StateManager::getSingletonPtr()->GetRoot()) return; mScenMgr = mRoot->getSceneManager("Scene"); if (mScenMgr->hasCamera("GameCam")) mCam = new Camera("GameCam", mScenMgr, mRoot->getAutoCreatedWindow(), mScenMgr->getCamera("GameCam")); else mCam = new Camera("GameCam", mScenMgr, mRoot->getAutoCreatedWindow()); mCam->getOgreCam()->getViewport()->setBackgroundColour(Ogre::ColourValue::Black); mGui = GUIManager::getSingleton(); mPhysics = new Physics(mScenMgr); mExit = false; if (!CEGUI::FontManager::getSingleton().isDefined("DejaVuSans-10")) CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font"); // set up the GUI auto font = &CEGUI::FontManager::getSingleton().get("DejaVuSans-10"); mGUIRoot = mGui->LoadGUIsheet("GameLayout.layout"); mGUIRoot->getChild("Quit")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::GoToIntro, this)); mGUIRoot->getChild("BuildSkeleton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::BuildSkeleton, this)); CEGUI::ToggleButton* checkbox = static_cast<CEGUI::ToggleButton*> (mGUIRoot->getChild("skeleton Setting/Checkbox")); checkbox->setSelected(true); mGUIRoot->getChild("skeleton Setting/Checkbox")->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged, CEGUI::Event::Subscriber(&GameState::HideSettings, this)); // add the drop box options CEGUI::Combobox* ArmList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Arm Combobox")); ArmList->setReadOnly(true); ArmList->setSelection(0, 10); ArmList->activate(); CEGUI::ListboxTextItem* ArmN = new CEGUI::ListboxTextItem("No Arms", 0); ArmN->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); ArmN->setFont(font); ArmList->addItem(ArmN); auto ArmS = new CEGUI::ListboxTextItem("Short Arms", 1); ArmS->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); ArmList->addItem(ArmS); auto ArmL = new CEGUI::ListboxTextItem("Long Arms", 2); ArmL->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); ArmList->addItem(ArmL); CEGUI::Combobox* LegList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Leg Combobox")); auto LegU = new CEGUI::ListboxTextItem("Uninverted Legs", 0); LegU->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); LegU->setFont(font); LegList->addItem(LegU); auto LegI = new CEGUI::ListboxTextItem("Inverted Legs", 1); LegI->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); LegI->setFont(font); LegList->addItem(LegI); CEGUI::Combobox* TorsoList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Torso Combobox")); auto TorsoU = new CEGUI::ListboxTextItem("Upright", 0); TorsoU->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); TorsoU->setFont(font); TorsoList->addItem(TorsoU); auto TorsoH = new CEGUI::ListboxTextItem("Horizontal", 1); TorsoH->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); TorsoH->setFont(font); TorsoList->addItem(TorsoH); CEGUI::Combobox* NeckList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Neck Combobox")); auto NeckL = new CEGUI::ListboxTextItem("Long Neck", 0); NeckL->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); NeckL->setFont(font); NeckList->addItem(NeckL); auto NeckS = new CEGUI::ListboxTextItem("Short Neck", 1); NeckS->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); NeckS->setFont(font); NeckList->addItem(NeckS); CEGUI::Combobox* TailList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Tail Combobox")); auto TailN = new CEGUI::ListboxTextItem("No Tail", 0); TailN->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); TailN->setFont(font); TailList->addItem(TailN); auto TailS = new CEGUI::ListboxTextItem("Short Tail", 1); TailS->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); TailS->setFont(font); TailList->addItem(TailS); auto TailL = new CEGUI::ListboxTextItem("Long Tail", 2); TailL->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush"); TailL->setFont(font); TailList->addItem(TailL); //ArmList->setVisible(true); //LegList->setVisible(true); //TorsoList->setVisible(true); //NeckList->setVisible(true); //TailList->setVisible(true); }
bool IntroState::options(const CEGUI::EventArgs &e) { CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); _credits=false; _options=true; _info=false; //Sheet Records Window* sheetBG = WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","background_options"); sheetBG->setPosition( UVector2(cegui_reldim(0),cegui_reldim(0))); sheetBG->setSize( USize(cegui_reldim(1),cegui_reldim(1))); sheetBG->setProperty("Image","BackgroundImageOptions"); sheetBG->setProperty("FrameEnabled","False"); sheetBG->setProperty("BackgroundEnabled", "False"); CEGUI::Window* backButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","back"); backButton->setText("[font='DickVanDyke'] Back "); backButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0))); backButton->setXPosition(UDim(0.66f, 0.0f)); backButton->setYPosition(UDim(0.85f, 0.0f)); backButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::back,this)); CEGUI::Window* applyButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","apply"); applyButton->setText("[font='DickVanDyke'] apply "); applyButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0))); applyButton->setXPosition(UDim(0.66f, 0.0f)); applyButton->setYPosition(UDim(0.77f, 0.0f)); applyButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::apply,this)); CEGUI::Window* text = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","text"); text->setText("[font='DickVanDyke'] Mouse Speed"); text->setSize(CEGUI::USize(CEGUI::UDim(0.15,0),CEGUI::UDim(0.1,0))); text->setPosition(CEGUI::UVector2(CEGUI::UDim(0.12,0),CEGUI::UDim(0.32,0))); text->setProperty("FrameEnabled","False"); text->setProperty("BackgroundEnabled", "False"); text->setProperty("HorzFormatting", "RightAligned"); CEGUI::Slider* sb = static_cast<CEGUI::Slider*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Slider","SliderSpeed")); sb->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.4,0))); sb->setMaxValue(40.0f); sb->setClickStep(1.0f); sb->setCurrentValue(20.0f); sb->subscribeEvent(Slider::EventValueChanged, Event::Subscriber(&IntroState::onSliderValueChanged, this)); CEGUI::Window* sbText = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","textSliderSpeed"); sbText->setText("[font='DickVanDyke']20"); sbText->setSize(CEGUI::USize(CEGUI::UDim(0.05,0),CEGUI::UDim(0.08,0))); sbText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.36,0),CEGUI::UDim(0.38,0))); sbText->setProperty("FrameEnabled","False"); sbText->setProperty("BackgroundEnabled", "False"); sbText->setProperty("HorzFormatting", "RightAligned"); CEGUI::Window* text2 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","text2"); text2->setText("[font='DickVanDyke'] Auto-Reload Arrows"); text2->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); text2->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.46,0))); text2->setProperty("FrameEnabled","False"); text2->setProperty("BackgroundEnabled", "False"); text2->setProperty("HorzFormatting", "LeftAligned"); CEGUI::ToggleButton* cb = static_cast<CEGUI::ToggleButton*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Checkbox","CBAutoReload")); cb->setPosition(CEGUI::UVector2(CEGUI::UDim(0.08,0),CEGUI::UDim(0.52,0))); CEGUI::Window* resetButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","resetButton"); resetButton->setText("[font='DickVanDyke'] Reset Records "); resetButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0))); resetButton->setXPosition(UDim(0.40f, 0.0f)); resetButton->setYPosition(UDim(0.85f, 0.0f)); resetButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::resetRecords,this)); CEGUI::Window* configButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","configButton"); configButton->setText("[font='DickVanDyke'] Restore Config "); configButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0))); configButton->setXPosition(UDim(0.40f, 0.0f)); configButton->setYPosition(UDim(0.77f, 0.0f)); configButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::resetConfig,this)); CEGUI::Window* text3 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","FullscreenText"); text3->setText("[font='DickVanDyke'] Fullscreen"); text3->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); text3->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.57,0))); text3->setProperty("FrameEnabled","False"); text3->setProperty("BackgroundEnabled", "False"); text3->setProperty("HorzFormatting", "LeftAligned"); CEGUI::ToggleButton* cbFullscreen = static_cast<CEGUI::ToggleButton*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Checkbox","CBFullscreen")); cbFullscreen->setPosition(CEGUI::UVector2(CEGUI::UDim(0.08,0),CEGUI::UDim(0.62,0))); cbFullscreen->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,CEGUI::Event::Subscriber(&IntroState::tbFullscreenChanged,this)); CEGUI::Window* text4 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","ResolutionText"); text4->setText("[font='DickVanDyke'] Resolution"); text4->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); text4->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.35,0))); text4->setProperty("FrameEnabled","False"); text4->setProperty("BackgroundEnabled", "False"); text4->setProperty("HorzFormatting", "LeftAligned"); CEGUI::Listbox* lbRes = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","lbRes")); lbRes->setSize(CEGUI::USize(CEGUI::UDim(0.3,0),CEGUI::UDim(0.3,0))); lbRes->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5, 0),CEGUI::UDim(0.40, 0))); lbRes->subscribeEvent(Listbox::EventSelectionChanged,CEGUI::Event::Subscriber(&IntroState::changeResolution,this)); const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush"); CEGUI::ListboxTextItem* itm; itm = new CEGUI::ListboxTextItem("800x600",0); itm->setFont("DickVanDyke-28"); itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5)); itm->setSelectionBrushImage(sel_img); lbRes->addItem(itm); CEGUI::ListboxTextItem* itm2; itm2 = new CEGUI::ListboxTextItem("1200x800",1); itm2->setFont("DickVanDyke-28"); itm2->setTextColours(CEGUI::Colour(0.0,0.8,0.5)); itm2->setSelectionBrushImage(sel_img); lbRes->addItem(itm2); CEGUI::ListboxTextItem* itm3; itm3 = new CEGUI::ListboxTextItem("1920x1020",2); itm3->setFont("DickVanDyke-28"); itm3->setTextColours(CEGUI::Colour(0.0,0.8,0.5)); itm3->setSelectionBrushImage(sel_img); lbRes->addItem(itm3); sheetBG->addChild(text4); sheetBG->addChild(lbRes); sheetBG->addChild(cb); sheetBG->addChild(text2); sheetBG->addChild(cbFullscreen); sheetBG->addChild(text3); sheetBG->addChild(sbText); sheetBG->addChild(sb); sheetBG->addChild(applyButton); sheetBG->addChild(backButton); sheetBG->addChild(resetButton); sheetBG->addChild(configButton); sheetBG->addChild(text); sheet->addChild(sheetBG); if(_fullscreen){ cbFullscreen->setSelected(true); }else{ cbFullscreen->setSelected(false); } return true; }