void WidgetDemo::initialiseWidgetInspector(CEGUI::Window* container) { WindowManager& winMgr = WindowManager::getSingleton(); //Add a tabcontrol serving as WidgetInspector, allowing to switch between events+widgets and the properties display TabControl* tabControl = static_cast<TabControl*>(winMgr.createWindow("TaharezLook/TabControl", "WidgetDemoWidgetInspector")); container->addChild(tabControl); tabControl->setSize(CEGUI::USize(cegui_reldim(0.55f), cegui_reldim(0.96f))); tabControl->setPosition(CEGUI::UVector2(cegui_reldim(0.02f), cegui_reldim(0.02f))); //Create the respective windows containing the displays CEGUI::Window* widgetMainInspectionContainer = winMgr.createWindow("DefaultWindow", "WidgetInspectionContainer"); CEGUI::Window* widgetPropertiesInspectionContainer = winMgr.createWindow("DefaultWindow", "WidgetPropertiesInspectionContainer"); //Add the pages to the tab control widgetMainInspectionContainer->setText("Widget Inspector"); tabControl->addTab(widgetMainInspectionContainer); widgetPropertiesInspectionContainer->setText("Widget Properties"); tabControl->addTab(widgetPropertiesInspectionContainer); //Create properties window initialiseWidgetPropertiesDisplayWindow(widgetPropertiesInspectionContainer); //Create the widget display windows initialiseWidgetDisplayWindow(); widgetMainInspectionContainer->addChild(d_widgetDisplayWindow); initialiseWidgetsEventsLog(); widgetMainInspectionContainer->addChild(d_widgetsEventsLog); initialiseEventLights(widgetMainInspectionContainer); }
void WidgetDemo::initialiseEventLights(CEGUI::Window* container) { CEGUI::WindowManager &winMgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* horizontalLayout = winMgr.createWindow("HorizontalLayoutContainer", "EventLightsContainer"); horizontalLayout->setPosition(CEGUI::UVector2(cegui_reldim(0.085f), cegui_reldim(0.93f))); container->addChild(horizontalLayout); d_windowLightUpdatedEvent = winMgr.createWindow("SampleBrowserSkin/Light"); horizontalLayout->addChild(d_windowLightUpdatedEvent); d_windowLightUpdatedEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f))); d_windowLightUpdatedEvent->setAspectMode(CEGUI::AM_EXPAND); d_windowLightUpdatedEvent->setProperty("LightColour", "FF66FF66"); CEGUI::Window* updateEventLabel = winMgr.createWindow("Vanilla/Label"); horizontalLayout->addChild(updateEventLabel); updateEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f))); updateEventLabel->setText("EventUpdated"); updateEventLabel->setFont("DejaVuSans-12-NoScale"); updateEventLabel->setProperty("HorzFormatting", "LeftAligned"); d_windowLightMouseMoveEvent = winMgr.createWindow("SampleBrowserSkin/Light"); horizontalLayout->addChild(d_windowLightMouseMoveEvent); d_windowLightMouseMoveEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f))); d_windowLightMouseMoveEvent->setAspectMode(CEGUI::AM_EXPAND); d_windowLightMouseMoveEvent->setProperty("LightColour", "FF77BBFF"); CEGUI::Window* mouseMoveEventLabel = winMgr.createWindow("Vanilla/Label"); horizontalLayout->addChild(mouseMoveEventLabel); mouseMoveEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f))); mouseMoveEventLabel->setText("EventMouseMove"); mouseMoveEventLabel->setFont("DejaVuSans-12-NoScale"); mouseMoveEventLabel->setProperty("HorzFormatting", "LeftAligned"); }
void MenuState::createGUI() { //Limpiar interfaz del estado anterior------------------- CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); //------------------------------------------------------- CEGUI::Window* sheetBG = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","backgroundMenu"); sheetBG->setPosition(CEGUI::UVector2(cegui_reldim(0),cegui_reldim(0))); sheetBG->setSize( CEGUI::USize(cegui_reldim(1),cegui_reldim(1))); sheetBG->setProperty("Image","BackgroundImageMenu"); sheetBG->setProperty("FrameEnabled","False"); sheetBG->setProperty("BackgroundEnabled", "False"); CEGUI::ListboxTextItem* itm; CEGUI::Listbox* editBox = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","listbox")); editBox->setSize(CEGUI::USize(CEGUI::UDim(0.6,0),CEGUI::UDim(0.6,0))); editBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.20, 0),CEGUI::UDim(0.10, 0))); const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush"); std::vector<string> files = listDir("./data/Levels/*"); // ./Para directorio actual ./Carpeta/* para otra carpeta for(unsigned int i=0;i<files.size();i++){ string aux=files[i]; if(Ogre::StringUtil::endsWith(aux,".txt")){ cout << "================ File: " << aux <<"================"<< endl; _recorridos.push_back(aux); string file=Ogre::StringUtil::split(aux,"/")[3]; cout<<"File: " << file << endl; file=Ogre::StringUtil::replaceAll(file,".txt",""); cout<<"File: " << file << endl; itm = new CEGUI::ListboxTextItem(file,0); itm->setFont("DickVanDyke-28"); itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5)); itm->setSelectionBrushImage(sel_img); editBox->addItem(itm); } } //--------------------------------------------------- CEGUI::Window* playButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","playButton"); playButton->setText("[font='DickVanDyke'] Start"); playButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.07,0))); playButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.4,0),CEGUI::UDim(0.8,0))); playButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&MenuState::playB,this)); sheetBG->addChild(playButton); sheetBG->addChild(editBox); sheet->addChild(sheetBG); }
bool CFormBackendImp::LoadLayout( GUCEF::CORE::CIOAccess& layoutStorage ) {GUCEF_TRACE; CEGUI::Window* rootWindow = NULL; CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr(); GUCEF_DEBUG_LOG( 0, "Starting layout load for a GUI Form" ); try { CORE::CDynamicBuffer memBuffer( layoutStorage ); CEGUI::RawDataContainer container; container.setData( (CEGUI::uint8*) memBuffer.GetBufferPtr() ); container.setSize( (size_t) memBuffer.GetDataSize() ); rootWindow = wmgr->loadLayoutFromContainer( container ); container.setData( (CEGUI::uint8*) NULL ); container.setSize( (size_t) 0 ); } catch ( CEGUI::Exception& e ) { GUCEF_ERROR_LOG( 0, CString( "CEGUI Exception while attempting to load form layout: " ) + e.what() ); return false; } // Now that we completed loading lets see what we got from CEGUI if ( NULL != rootWindow ) { // Begin by providing a wrapper for the root window m_rootWindow = CreateAndHookWrapperForWindow( rootWindow ); if ( NULL != m_rootWindow ) { CString localWidgetName = m_rootWindow->GetName().SubstrToChar( '/', false ); m_widgetMap[ localWidgetName ] = m_rootWindow; WrapAndHookChildWindows( rootWindow ); // We will directly add the form as a child of the root for now // Note: This assumes that you have a GUISheet already set, otherwise this will result in a segfault! CEGUI::Window* globalRootWindow = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); if ( NULL != globalRootWindow ) { globalRootWindow->addChild( rootWindow ); GUCEF_DEBUG_LOG( 0, "Successfully loaded a GUI Form layout" ); return true; } else { GUCEF_ERROR_LOG( 0, "Failed to add form as a child to the global \"root\" window" ); } } rootWindow->hide(); } GUCEF_DEBUG_LOG( 0, "Failed to load a GUI Form layout" ); return false; }
void PlayState::createGUI () { _renderer = &CEGUI::OgreRenderer::bootstrapSystem(); CEGUI::Scheme::setDefaultResourceGroup ("Schemes"); CEGUI::ImageManager::setImagesetDefaultResourceGroup ("Imagesets"); CEGUI::Font::setDefaultResourceGroup ("Fonts"); CEGUI::WindowManager::setDefaultResourceGroup ("Layouts"); CEGUI::WidgetLookManager::setDefaultResourceGroup ("LookNFeel"); CEGUI::SchemeManager::getSingleton ().createFromFile ("TaharezLook.scheme"); CEGUI::System::getSingleton ().getDefaultGUIContext ().setDefaultFont ("DejaVuSans-12"); CEGUI::System::getSingleton ().getDefaultGUIContext ().getMouseCursor ().setDefaultImage ("TaharezLook/MouseArrow"); //PARCHEO RATÓN CEGUI: para que al inicio se encuentre en la misma posicion que el raton de OIS // Move CEGUI mouse to (0,0) CEGUI::Vector2f mousePos = CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().getPosition(); CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseMove(-mousePos.d_x,-mousePos.d_y); //Sheet CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton ().createWindow ("DefaultWindow","HLF/Sheet"); //Quit button CEGUI::Window* quitButton = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/QuitButton"); quitButton->setText ("Quit"); quitButton->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); quitButton->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.84, 0), CEGUI::UDim (0.01, 0))); quitButton->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::quit, this)); //Attaching buttons sheet->addChild (quitButton); CEGUI::System::getSingleton().getDefaultGUIContext ().setRootWindow (sheet); }
GUIMessageBox::GUIMessageBox(void) : d_root(CEGUI::WindowManager::getSingleton().loadLayoutFromFile("MessageBox.layout")) { using namespace CEGUI; CEGUI::Window* parent = NULL; // we will destroy the console box windows ourselves d_root->setDestroyedByParent(false); // Do events wire-up // d_root->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUIMessageBox::handleSubmit, this)); d_root->getChild("Button")-> subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUIMessageBox::handleSubmit, this)); /*CEGUI::Window* d_fontNameEditbox = static_cast<CEGUI::Editbox*>(d_root->getChild("Login/Name")); d_fontNameEditbox->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUILogin::handleSubmit, this)); d_root->getChild("Login/PassText")-> subscribeEvent(Editbox::EventTextAccepted, Event::Subscriber(&GUILogin::handleSubmit, this)); d_root->getChild("Login/Submit")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUILogin::handleSubmit, this)); */ // decide where to attach the console main window parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); // attach this window if parent is valid if (parent) parent->addChild(d_root); }
//------------------------------------------------------------------------------------- void TutorialApplication::createScene(void) { mRenderer = &CEGUI::OgreRenderer::bootstrapSystem(); CEGUI::ImageManager::setImagesetDefaultResourceGroup("Imagesets"); CEGUI::Font::setDefaultResourceGroup("Fonts"); CEGUI::Scheme::setDefaultResourceGroup("Schemes"); CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel"); CEGUI::WindowManager::setDefaultResourceGroup("Layouts"); CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme"); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow"); CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "Main"); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(sheet); CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "QuitButton"); quit->setText("Quit"); quit->setSize(CEGUI::USize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0))); quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TutorialApplication::quit, this)); sheet->addChild(quit); }
CEGUI::Window* HUDDemo::spawnPlate() { CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* plateRoot = winMgr.createWindow("DefaultWindow"); plateRoot->setSize(CEGUI::USize(cegui_absdim(0.0f), cegui_reldim(0.16f))); plateRoot->setAspectMode(CEGUI::AM_EXPAND); plateRoot->setAspectRatio(1.0f); plateRoot->setRiseOnClickEnabled(false); plateRoot->setPixelAligned(false); plateRoot->subscribeEvent(CEGUI::Window::EventMouseButtonDown, Event::Subscriber(&HUDDemo::handlePlateWindowClicked, this)); d_rootIngame->addChild(plateRoot); CEGUI::Window* plateImgWnd = winMgr.createWindow("Generic/Image", "ImageWindowPlate"); plateImgWnd->setProperty("Image", s_imageNamePlate); plateImgWnd->setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_absdim(0.0f))); plateImgWnd->setAspectRatio(3.308f); plateImgWnd->setAspectMode(CEGUI::AM_EXPAND); plateImgWnd->setVerticalAlignment(CEGUI::VA_BOTTOM); plateImgWnd->setMousePassThroughEnabled(true); plateImgWnd->setPixelAligned(false); plateRoot->addChild(plateImgWnd); CEGUI::String image = getRandomGameImage(); CEGUI::Window* plateTopping = winMgr.createWindow("Generic/Image", "ImageWindowObject"); plateTopping->setProperty("Image", image); plateTopping->setSize(CEGUI::USize(cegui_reldim(0.88f), cegui_absdim(0.0f))); plateTopping->setAspectRatio(1.0f); plateTopping->setAspectMode(CEGUI::AM_EXPAND); plateTopping->setHorizontalAlignment(CEGUI::HA_CENTRE); plateTopping->setMousePassThroughEnabled(true); plateTopping->setPixelAligned(false); plateRoot->addChild(plateTopping); int randumNumber = rand() % 10000; float posY = randumNumber / 10000.0f; plateRoot->setPosition(CEGUI::UVector2(cegui_absdim(0.0f), cegui_reldim(0.1f + 0.6f * posY))); return plateRoot; }
void WidgetDemo::initialiseWidgetSelector(CEGUI::Window* container) { WindowManager& winMgr = WindowManager::getSingleton(); initialiseSkinCombobox(container); CEGUI::Window* widgetSelectorContainer = winMgr.createWindow("Vanilla/StaticText", "WidgetSelectorContainer"); initialiseWidgetSelectorContainer(widgetSelectorContainer); container->addChild(widgetSelectorContainer); initialiseWidgetSelectorListbox(); widgetSelectorContainer->addChild(d_widgetSelectorListbox); }
bool GUILogin::OnEnter() { CEGUI::Window* parent = NULL; // decide where to attach the console main window parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); // attach this window if parent is valid if (parent) parent->addChild(d_root); return true; }
bool GUILobby::OnEnter() { CEGUI::Window* parent = NULL; // decide where to attach the console main window parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); // attach this window if parent is valid if (parent) parent->addChild(d_root); Listbox* lbox = static_cast<Listbox*>(d_root->getChild("RoomList")); lbox->resetList(); return true; }
GameDesktop::GameDesktop(sf::RenderWindow &screen) : screen_(screen), renderer_(CEGUI::OpenGLRenderer::bootstrapSystem()) { // Set up default resource groups CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes", "/usr/share/cegui-0/schemes/"); rp->setResourceGroupDirectory("imagesets", "/usr/share/cegui-0/imagesets/"); rp->setResourceGroupDirectory("fonts", "/usr/share/cegui-0/fonts/"); rp->setResourceGroupDirectory("layouts", "/usr/share/cegui-0/layouts/"); rp->setResourceGroupDirectory("looknfeels", "/usr/share/cegui-0/looknfeel"); rp->setResourceGroupDirectory("lua_scripts", "/usr/share/cegui-0/lua_scripts/"); CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets"); CEGUI::Font::setDefaultResourceGroup("fonts"); CEGUI::Scheme::setDefaultResourceGroup("schemes"); CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels"); CEGUI::WindowManager::setDefaultResourceGroup("layouts"); CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts"); // Set up the GUI CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme"); CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font"); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("WindowsLook/MouseArrow"); CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *root = wmgr.createWindow("DefaultWindow", "root"); root->setProperty("MousePassThroughEnabled", "True"); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root); CEGUI::FrameWindow *fw = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow("WindowsLook/FrameWindow", "testWindow")); root->addChild(fw); fw->setText("Hello World!"); // Initialize SFML-to-CEGUI key mapping initializeKeyMap(); screen_.setView(view_); }
time_panel_impl::time_panel_impl() { GUIContext& context = System::getSingleton().getDefaultGUIContext(); CEGUI::Window* root = context.getRootWindow(); WindowManager& winMgr = WindowManager::getSingleton(); //PushButton* TimeButtonOK = static_cast<PushButton*>( // WindowManager::getSingleton().createWindow("TaharezLook/Button", "TimeButtonOK") ); //TimeButtonOK->setPosition(UVector2(cegui_reldim(0.1f), cegui_reldim(0.75f))); //TimeButtonOK->setSize( USize(cegui_reldim(0.4f), cegui_reldim(0.15f)) ); //TimeButtonOK->setText( "OK" ); //root->addChild(TimeButtonOK); Window* TimeLabel = static_cast<Window*>( WindowManager::getSingleton().createWindow("TaharezLook/Label", label_name) ); TimeLabel->setPosition(UVector2(cegui_reldim(0.75f), cegui_reldim(0.f))); TimeLabel->setSize( USize(cegui_reldim(0.4f), cegui_reldim(0.15f)) ); root->addChild(TimeLabel); set_time(0); }
void CEGUIManager::init() { CEGUI::OpenGLRenderer &m_renderer = CEGUI::OpenGLRenderer::bootstrapSystem(); { // initialise the required dirs for the DefaultResourceProvider CEGUI::DefaultResourceProvider *resourceProvider = static_cast<CEGUI::DefaultResourceProvider*> (CEGUI::System::getSingleton().getResourceProvider()); // set resource group directories. { CEGUI::DefaultResourceProvider* rp = resourceProvider; rp->setResourceGroupDirectory("schemes", "datafiles/schemes/"); rp->setResourceGroupDirectory("imagesets", "datafiles/imagesets/"); rp->setResourceGroupDirectory("fonts", "datafiles/fonts/"); rp->setResourceGroupDirectory("layouts", "datafiles/layouts/"); rp->setResourceGroupDirectory("looknfeels", "datafiles/looknfeel/"); rp->setResourceGroupDirectory("lua_scripts", "datafiles/lua_scripts/"); } // set default resource groups. { CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets"); CEGUI::Font::setDefaultResourceGroup("fonts"); CEGUI::Scheme::setDefaultResourceGroup("schemes"); CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels"); CEGUI::WindowManager::setDefaultResourceGroup("layouts"); CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts"); // setup default group for validation schemas CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser(); if (parser->isPropertyPresent("SchemaDefaultResourceGroup")) parser->setProperty("SchemaDefaultResourceGroup", "schemas"); CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme"); CEGUI::SchemeManager::getSingleton().createFromFile("GameMenu.scheme"); CEGUI::SchemeManager::getSingleton().createFromFile("Generic.scheme"); CEGUI::SchemeManager::getSingleton().createFromFile("HUDDemo.scheme"); CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme"); CEGUI::SchemeManager::getSingleton().createFromFile("TestA.scheme"); } // Register custom objects with CEGUI: { // register custom objects with CEGUI. CEGUI::WindowFactoryManager::addFactory<CEGUI::TplWindowFactory<CEGUI::InventoryReceiver>>(); CEGUI::WindowFactoryManager::addFactory<CEGUI::TplWindowFactory<CEGUI::InventoryItem>>(); CEGUI::WindowRendererManager::addFactory<CEGUI::TplWindowRendererFactory<CEGUI::InventoryItemRenderer>>(); // load looknfeel for custom inventory components (needs TaharezLook images) CEGUI::WidgetLookManager::getSingleton().parseLookNFeelSpecificationFromFile("InventoryComponents.looknfeel"); // create mapping for the item type // This is the equivalent to the following entry in a scheme xml file: // <FalagardMapping WindowType="TaharezLook/InventoryItem" TargetType="InventoryItem" LookNFeel="TaharezLook/InventoryItem" Renderer="InventoryItemRenderer" /> CEGUI::WindowFactoryManager::getSingleton().addFalagardWindowMapping( "TaharezLook/InventoryItem", // type to create "InventoryItem", // 'base' widget type "TaharezLook/InventoryItem", // WidgetLook to use. "InventoryItemRenderer"); // WindowRenderer to use. } } CEGUI::System::getSingleton().getDefaultGUIContext(). getMouseCursor().setDefaultImage("TaharezLook/MouseArrow"); // Create windows { CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* root = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("test2.layout"); // test.layout CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root); //CEGUI::Window *dragContainerTemplate = CEGUI::WindowManager::getSingleton().loadLayoutFromString(CEGUI::String( // "<Window type = \"Generic/Image\" name = \"Image\" >" // " <Property name = \"Area\" value = \"{{0,0},{0,0},{0,64},{0,128}}\" / >" // " <Property name = \"Image\" value = \"TestA2/MadBug\" / >" // " <Property name = \"MaxSize\" value = \"{{1,0},{1,0}}\" / >" // " <Property name = \"ClippedByParent\" value = \"false\" / >" // " <Property name = \"VerticalAlignment\" value = \"Centre\" / >" // " <Property name = \"HorizontalAlignment\" value = \"Centre\" / >" // " <Property name = \"MousePassThroughEnabled\" value = \"true\" / >" // "< / Window>")); //for (int i = 0; i < 10; ++i) { //} //// create a script module. //CEGUI::LuaScriptModule& scriptmod(CEGUI::LuaScriptModule::create()); //// tell CEGUI to use this scripting module //CEGUI::System::getSingleton().setScriptingModule(&scriptmod); //CEGUI::System::getSingleton().executeScriptFile("test2.lua"); // Inventory testing: { // Create Backpack window CEGUI::Window *inventoryImageWindow = root->getChild("Inventory"); CEGUI::Window* wnd = inventoryImageWindow;//wmgr.createWindow("TaharezLook/FrameWindow"); //root->addChild(wnd); /*wnd->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0))); wnd->setSize(CEGUI::USize(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.4f, 0)));*/ wnd->setText("Backpack"); CEGUI::InventoryReceiver& receiver1 = dynamic_cast<CEGUI::InventoryReceiver&>(*wmgr.createWindow("InventoryReceiver")); wnd->addChild(&receiver1); receiver1.setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f))); receiver1.setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_reldim(1.0f))); receiver1.setContentSize(20, 2); receiver1.setUserString("BlockImage", "TestA2/InventorySlot"); // Create vault window CEGUI::Window* wnd2 = wmgr.createWindow("TestA2/InventoryWindow"); root->addChild(wnd2); wnd2->setPosition(CEGUI::UVector2(CEGUI::UDim(0.48f, 0), CEGUI::UDim(0.2f, 0))); wnd2->setSize(CEGUI::USize(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0))); wnd2->setText("Bank Vault"); CEGUI::InventoryReceiver& receiver2 = dynamic_cast<CEGUI::InventoryReceiver&>(*wmgr.createWindow("InventoryReceiver")); wnd2->addChild(&receiver2); receiver2.setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f))); receiver2.setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_reldim(1.0f))); receiver2.setContentSize(10, 10); receiver2.setUserString("BlockImage", "TestA2/InventorySlot"); // create some items and add them to the vault. CEGUI::InventoryItem& item1 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("TaharezLook/InventoryItem")); item1.setContentSize(2, 2); receiver2.addItemAtLocation(item1, 0, 0); item1.setProperty("Image", "TaharezLook/MouseArrow"); CEGUI::InventoryItem& item2 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("TaharezLook/InventoryItem")); item2.setContentSize(1, 2); receiver2.addItemAtLocation(item2, 1, 3); item2.setProperty("Image", "TestA2/MadBug"); CEGUI::InventoryItem& item3 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("InventoryItem")); item3.setUserString("BlockImage", "TaharezLook/GenericBrush"); item3.setContentSize(1, 4); receiver2.addItemAtLocation(item3, 5, 2); CEGUI::InventoryItem& item4 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("InventoryItem")); item4.setUserString("BlockImage", "TaharezLook/GenericBrush"); item4.setContentSize(1, 1); receiver2.addItemAtLocation(item4, 8, 6); CEGUI::InventoryItem& item5 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("InventoryItem")); item5.setUserString("BlockImage", "TaharezLook/GenericBrush"); item5.setContentSize(2, 3); } } }
ScoreManager::ScoreManager(void) : gameScore(0), highScoreFile(), highScore(0), lives(5), gameOverB(false), scoreLabel("SCORE_"), scoreText("Score: "), highScoreLabel("HIGH_SCORE_"), highScoreText("High Score: "), livesText("Lives: ") { /* The global timer */ timer = new Ogre::Timer(); dt = timer->getMilliseconds(); /* Load Score Resources */ highScoreFile.open("highscore.txt", std::ios::in); std::string line; while(getline(highScoreFile, line)) { if(line == "") { highScore = 0; } else { highScore = std::stoi(line); } } highScoreFile.close(); // Ogre::Overlay* ov = Ogre::OverlayManager::getSingletonPtr()->create("Overlay"); // ov->show(); // scoreOverlay = new TextOverlay(ov, scoreLabel, 0.02f, 0.9f, 0.04f); // scoreOverlay->setCol(1.0f, 1.0f, 1.0f, 1.0f); // highScoreOverlay = new TextOverlay(ov, highScoreLabel, 0.67f, 0.9f, 0.04f); // highScoreOverlay->setCol(1.0f, 1.0f, 1.0f, 1.0f); // gameOverOverlay = new TextOverlay(ov, gameOverLabel, 0.2f, 0.3f, 0.1f); // gameOverOverlay->setCol(1.0f, 0.1f, 0.1f, 1.0f); CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *sheet = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); gameScoreboard = wmgr.createWindow("AlfiskoSkin/Label", "Points"); gameScoreboard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(0.92f, 0)), CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(1, 0)))); gameScoreboard->setText("Points: 0"); highscoreBoard = wmgr.createWindow("AlfiskoSkin/Label", "HighScore"); highscoreBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.35f, 0), CEGUI::UDim(0.92f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(1, 0)))); highscoreBoard->setText("High Score: " + std::to_string(highScore)); youWinBoard = wmgr.createWindow("AlfiskoSkin/Editbox", "YouWinBoard"); youWinBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.42f, 0), CEGUI::UDim(0.33f, 0)), CEGUI::UVector2(CEGUI::UDim(0.58f, 0), CEGUI::UDim(0.4f, 0)))); youWinBoard->setText(" You Win!"); youWinBoard->setDisabled(true); youWinBoard->setMouseCursor("AlfiskoSkin/MouseArrow"); youWinBoard->hide(); youLoseBoard = wmgr.createWindow("AlfiskoSkin/Editbox", "YouLoseBoard"); youLoseBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.42f, 0), CEGUI::UDim(0.33f, 0)), CEGUI::UVector2(CEGUI::UDim(0.58f, 0), CEGUI::UDim(0.4f, 0)))); youLoseBoard->setText(" Game Over!"); youLoseBoard->setDisabled(true); youLoseBoard->setMouseCursor("AlfiskoSkin/MouseArrow"); youLoseBoard->hide(); livesBoard = wmgr.createWindow("AlfiskoSkin/Label", "Lives"); livesBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.8f, 0), CEGUI::UDim(0.92f, 0)), CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)))); livesBoard->setText("Lives: 5"); sheet->addChild(gameScoreboard); sheet->addChild(livesBoard); sheet->addChild(highscoreBoard); sheet->addChild(youWinBoard); sheet->addChild(youLoseBoard); }
void RecordsState::createGUI() { //_rendererCEGUI = &CEGUI::OgreRenderer::bootstrapSystem(); //_rendererCEGUI = CEGUI::System::getSingleton().getDefaultGUIContext(); CEGUI::Scheme::setDefaultResourceGroup ("Schemes"); CEGUI::ImageManager::setImagesetDefaultResourceGroup ("Imagesets"); CEGUI::Font::setDefaultResourceGroup ("Fonts"); CEGUI::WindowManager::setDefaultResourceGroup ("Layouts"); CEGUI::WidgetLookManager::setDefaultResourceGroup ("LookNFeel"); CEGUI::SchemeManager::getSingleton ().createFromFile ("TaharezLook.scheme"); CEGUI::System::getSingleton ().getDefaultGUIContext ().setDefaultFont ("DejaVuSans-12"); CEGUI::System::getSingleton ().getDefaultGUIContext ().getMouseCursor ().setDefaultImage ("TaharezLook/MouseArrow"); //PARCHEO RATÓN CEGUI: para que al inicio se encuentre en la misma posicion que el raton de OIS // Move CEGUI mouse to (0,0) CEGUI::Vector2f mousePos = CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().getPosition(); CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseMove(-mousePos.d_x,-mousePos.d_y); //Sheet CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton ().createWindow ("DefaultWindow","HLF/Sheet"); //Config Window CEGUI::Window* marcoRecords = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("records.layout"); //Setting Text! try { stringstream aux; aux << "media/" << RECORDS_FILENAME; string a = aux.str(); _rec->readRecords(a); //Genera el vector de records. Si no lo llamamos primero nunca tendremos records } catch (std::exception &e) { cout << "el fichero de records probablemente no existe, habrá que jugar para que se creen nuevos records. \n"; } if (!_rec->Records().empty()) { std::vector<record>::iterator it; //int i=1; //for (it = _rec->Records().begin(); it!=_rec->Records().end(); ++it) for (size_t i=0; i<_rec->Records().size(); i++) { std::stringstream s,p; s << "Text" << i; //p << it[i].posicion << ". " << it[i].nombre << " " << it[i].puntuacion; p << _rec->Records()[i].nombre << "[horz-alignment='right']" << _rec->Records()[i].puntuacion; marcoRecords->getChild(s.str())->setText(p.str()); } } marcoRecords->getChild("ExitButton")->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&RecordsState::volver, this)); //Quit button /* CEGUI::Window* quitButton = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button", "HLF/QuitButton"); quitButton->setText ("Quit"); quitButton->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); quitButton->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.1 - 0.15 / 2, 0), CEGUI::UDim (0.1, 0))); quitButton->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&RecordsState::quit, this)); */ //Attaching buttons sheet->addChild(marcoRecords); //sheet->addChild (quitButton); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(sheet); }
void IntroState::createGUI() { //CEGUI renderer = &CEGUI::OgreRenderer::bootstrapSystem(); CEGUI::Scheme::setDefaultResourceGroup("Schemes"); CEGUI::ImageManager::setImagesetDefaultResourceGroup("Imagesets"); CEGUI::Font::setDefaultResourceGroup("Fonts"); CEGUI::WindowManager::setDefaultResourceGroup("Layouts"); CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel"); CEGUI::SchemeManager::getSingleton().createFromFile("OgreTray.scheme"); CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme"); CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultFont("DejaVuSans-12"); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("OgreTrayImages/MouseArrow"); // load all the fonts (if they are not loaded yet) CEGUI::FontManager::getSingleton().createAll("*.font", "Fonts"); //Sheet CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","Sheet"); //Para liberar el raton---------------------------------------------------------------------------------------- CEGUI::Vector2f mousePos = CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().getPosition(); CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseMove(-mousePos.d_x,-mousePos.d_y); //------------------------------------------------------------------------------------------------------------- //Cargo la imagen ImageManager::getSingleton().addFromImageFile("BackgroundImage","logo.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageRecords","records.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageCredits","credits.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageMenu","wallpaper.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageBar","barra.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageMeter","medidor.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageFinish","finish.png"); CEGUI::ImageManager::getSingleton().addFromImageFile("BackgroundImageArrow","flecha.png"); CEGUI::ImageManager::getSingleton().addFromImageFile("BackgroundImagePower","RainOfArrows.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageOptions","options.png"); ImageManager::getSingleton().addFromImageFile("BackgroundImageControls","controls.png"); //Sheet Window* sheetBG = WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","background_wnd"); sheetBG->setPosition(CEGUI::UVector2(CEGUI::UDim(0.14, 0),CEGUI::UDim(0.06, 0))); sheetBG->setSize( CEGUI::USize(CEGUI::UDim(0.70, 0), CEGUI::UDim(0.45, 0))); sheetBG->setProperty("Image","BackgroundImage"); sheetBG->setProperty("FrameEnabled","False"); sheetBG->setProperty("BackgroundEnabled", "False"); //Buttons CEGUI::Window* playButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","playButton"); playButton->setText("[font='DickVanDyke'] Play"); playButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); playButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.40,0),CEGUI::UDim(0.50,0))); playButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::play,this)); CEGUI::Window* infoButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","infoButton"); infoButton->setText("[font='DickVanDyke'] How To Play"); infoButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); infoButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.40,0),CEGUI::UDim(0.58,0))); infoButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::info,this)); CEGUI::Window* optionsButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","optionsButton"); optionsButton->setText("[font='DickVanDyke'] Options"); optionsButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); optionsButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.40,0),CEGUI::UDim(0.66,0))); optionsButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::options,this)); CEGUI::Window* recordsButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","recordsButton"); recordsButton->setText("[font='DickVanDyke'] Records"); recordsButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); recordsButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.40,0),CEGUI::UDim(0.74,0))); recordsButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::records,this)); CEGUI::Window* creditsButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","creditsButton"); creditsButton->setText("[font='DickVanDyke'] Credits"); creditsButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); creditsButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.40,0),CEGUI::UDim(0.82,0))); creditsButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::credits,this)); CEGUI::Window* quitButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","quitButton"); quitButton->setText("[font='DickVanDyke'] Exit"); quitButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0))); quitButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.40,0),CEGUI::UDim(0.90,0))); quitButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::quit,this)); //Attaching buttons sheet->addChild(playButton); sheet->addChild(infoButton); sheet->addChild(optionsButton); sheet->addChild(recordsButton); sheet->addChild(creditsButton); sheet->addChild(quitButton); sheet->addChild(sheetBG); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(sheet); }
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 Application::setupCEGUI(void) { mRenderer = &CEGUI::OgreRenderer::bootstrapSystem(*mRenderWindow); CEGUI::ImageManager::setImagesetDefaultResourceGroup("Imagesets"); CEGUI::Font::setDefaultResourceGroup("Fonts"); CEGUI::Scheme::setDefaultResourceGroup("Schemes"); CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel"); CEGUI::WindowManager::setDefaultResourceGroup("Layouts"); CEGUI::SchemeManager::getSingleton().createFromFile("AlfiskoSkin.scheme"); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("AlfiskoSkin/MouseArrow"); CEGUI::FontManager &fmg = CEGUI::FontManager::getSingleton(); CEGUI::Font &font = fmg.createFreeTypeFont("arial", 20, true, "arial.ttf"); CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "_MasterRoot"); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(sheet); CEGUI::Window* quitButton = wmgr.createWindow("AlfiskoSkin/Button", "QuitButton"); quitButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(0.0f, 0)), CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.05f, 0)))); quitButton->setText("Quit"); ipWindow = wmgr.createWindow("AlfiskoSkin/Label", "ipWindow"); ipWindow->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.92f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(1, 0)))); ipWindow->setText(netManager->getIPstring()); singlePlayerButton = wmgr.createWindow("AlfiskoSkin/Button", "SinglePlayerButton"); singlePlayerButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.35f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(0.4f, 0)))); singlePlayerButton->setText("Single Player"); hostServerButton = wmgr.createWindow("AlfiskoSkin/Button", "HostButton"); hostServerButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.4f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(0.45f, 0)))); hostServerButton->setText("Host Game"); ipText = wmgr.createWindow("AlfiskoSkin/Label", "Ip Label"); ipText->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.525f, 0), CEGUI::UDim(0.45f, 0)), CEGUI::UVector2(CEGUI::UDim(0.725f, 0), CEGUI::UDim(0.5f, 0)))); ipText->setText("IP Address"); ipBox = wmgr.createWindow("AlfiskoSkin/Editbox", "Ip Box"); ipBox->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.45f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(0.5f, 0)))); joinServerButton = wmgr.createWindow("AlfiskoSkin/Button", "JoinButton"); joinServerButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.5f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(0.55f, 0)))); joinServerButton->setText("Join Game"); howToButton = wmgr.createWindow("AlfiskoSkin/Button", "HowToButton"); howToButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.3f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(0.35f, 0)))); howToButton->setText("How To Play"); howToText = wmgr.createWindow("AlfiskoSkin/MultiLineEditbox", "Instructions"); howToText->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.125f, 0), CEGUI::UDim(0.35f, 0)), CEGUI::UVector2(CEGUI::UDim(0.875f, 0), CEGUI::UDim(0.75f, 0)))); howToText->setText(instructions); static_cast<CEGUI::MultiLineEditbox*>(howToText)->setReadOnly(true); homeButton = wmgr.createWindow("AlfiskoSkin/Button", "HomeButton"); homeButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.0f, 0)), CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.05f, 0)))); homeButton->setText("Home"); replayButton = wmgr.createWindow("AlfiskoSkin/Button", "ReplayButton"); replayButton->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.4f, 0)), CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(0.45f, 0)))); replayButton->setText("Watch Replay"); sheet->addChild(singlePlayerButton); sheet->addChild(hostServerButton); sheet->addChild(joinServerButton); sheet->addChild(quitButton); sheet->addChild(ipBox); sheet->addChild(ipText); sheet->addChild(ipWindow); sheet->addChild(homeButton); sheet->addChild(replayButton); sheet->addChild(howToButton); sheet->addChild(howToText); replayButton->hide(); howToText->hide(); singlePlayerButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::StartSinglePlayer, this)); hostServerButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::StartServer, this)); joinServerButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::JoinServer, this)); quitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::Quit, this)); homeButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::Home, this)); replayButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::Replay, this)); howToButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::HowTo, this)); }
CEGUI::Window* CEGUIBuilder::createMenu() { CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); //Menu bar CEGUI::Window *menuBar = wmgr.createWindow("Ogremonics/Menubar", "menu"); menuBar->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(0.037, 0))); menuBar->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0))); //##################### //File menu CEGUI::Window *fileTopItem = wmgr.createWindow("Ogremonics/MenuItem", "fileTopItem"); fileTopItem->setText("File"); menuBar->addChild(fileTopItem); CEGUI::Window *fileMenu = wmgr.createWindow("Ogremonics/PopupMenu", "fileMenu"); fileTopItem->addChild(fileMenu); //quit item CEGUI::Window *quitApplicationItem = wmgr.createWindow( "Ogremonics/MenuItem", GUIConfiguration::quitApplicationCmd); quitApplicationItem->setText(GUIConfiguration::quitApplicationName); fileMenu->addChild(quitApplicationItem); //##################### //Evolution menu CEGUI::Window *evolutionTopItem = wmgr.createWindow("Ogremonics/MenuItem", "evolutionTopItem"); evolutionTopItem->setText("Evolution"); menuBar->addChild(evolutionTopItem); CEGUI::Window *evolutionMenu = wmgr.createWindow("Ogremonics/PopupMenu", "evolutionMenu"); evolutionTopItem->addChild(evolutionMenu); // new evolution item CEGUI::Window *newEvolutionItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdNewEvolution"); newEvolutionItem->setText("New Evolution"); evolutionMenu->addChild(newEvolutionItem); // open evolution item CEGUI::Window *openEvolutionItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdOpenEvolution"); openEvolutionItem->setText("Open Evolution..."); evolutionMenu->addChild(openEvolutionItem); // save evolution as... CEGUI::Window *saveEvolutionAsItem = wmgr.createWindow( "Ogremonics/MenuItem", "cmdSaveEvolutionAs"); saveEvolutionAsItem->setText("Save Evolution as..."); evolutionMenu->addChild(saveEvolutionAsItem); // close evolution CEGUI::Window *closeEvolutionItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdCloseEvolution"); closeEvolutionItem->setText("Close Evolution"); evolutionMenu->addChild(closeEvolutionItem); // Run evolution CEGUI::Window *runEvolutionItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdRunEvolution"); runEvolutionItem->setText("Run Evolution"); evolutionMenu->addChild(runEvolutionItem); // Pause evolution CEGUI::Window *pauseEvolutionItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdPauseEvolution"); pauseEvolutionItem->setText("Pause Evolution"); evolutionMenu->addChild(pauseEvolutionItem); // Stop evolution CEGUI::Window *stopEvolutionItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdStopEvolution"); stopEvolutionItem->setText("Stop Evolution"); evolutionMenu->addChild(stopEvolutionItem); // Browse history CEGUI::Window *browseHistoryItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdBrowseHistory"); browseHistoryItem->setText("Browse History"); evolutionMenu->addChild(browseHistoryItem); //##################### //Environment menu CEGUI::Window *environmentTopItem = wmgr.createWindow("Ogremonics/MenuItem", "environmentTopItem"); environmentTopItem->setText("Environment"); menuBar->addChild(environmentTopItem); CEGUI::Window *environmentMenu = wmgr.createWindow("Ogremonics/PopupMenu", "evolutionMenu"); environmentTopItem->addChild(environmentMenu); // Hills... CEGUI::Window *hillsItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdHills"); hillsItem->setText("Hills..."); environmentMenu->addChild(hillsItem); // Opensea CEGUI::Window *openSeaItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdOpenSea"); openSeaItem->setText("Open Sea"); environmentMenu->addChild(openSeaItem); // Plane CEGUI::Window *planeItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdPlane"); planeItem->setText("Plane"); environmentMenu->addChild(planeItem); //##################### //Population menu CEGUI::Window *populationTopItem = wmgr.createWindow("Ogremonics/MenuItem", "populationTopItem"); populationTopItem->setText("Population"); menuBar->addChild(populationTopItem); CEGUI::Window *populationMenu = wmgr.createWindow("Ogremonics/PopupMenu", "populationMenu"); populationTopItem->addChild(populationMenu); // New Population CEGUI::Window *newPopulationItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdNewPopulation"); newPopulationItem->setText("New Population"); populationMenu->addChild(newPopulationItem); // Open Population... CEGUI::Window *openPopulationItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdOpenPopulation"); openPopulationItem->setText("Open Population"); populationMenu->addChild(openPopulationItem); // Save population as... CEGUI::Window *savePopulationAsItem = wmgr.createWindow( "Ogremonics/MenuItem", "cmdSavePopulationAs"); savePopulationAsItem->setText("Save Population as..."); populationMenu->addChild(savePopulationAsItem); // Close population CEGUI::Window *closePopulationItem = wmgr.createWindow( "Ogremonics/MenuItem", "cmdClosePopulation"); closePopulationItem->setText("Close Population"); populationMenu->addChild(closePopulationItem); //##################### //Creature menu CEGUI::Window *creatureTopItem = wmgr.createWindow("Ogremonics/MenuItem", "creatureTopItem"); creatureTopItem->setText("Creature"); menuBar->addChild(creatureTopItem); CEGUI::Window *creatureMenu = wmgr.createWindow("Ogremonics/PopupMenu", "creatureMenu"); creatureTopItem->addChild(creatureMenu); // New random creature CEGUI::Window *newCreatureItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdNewCreature"); newCreatureItem->setText("New Random Creature [F5]"); creatureMenu->addChild(newCreatureItem); // Open creature... CEGUI::Window *openCreatureItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdOpenCreature"); openCreatureItem->setText("Open Creature..."); creatureMenu->addChild(openCreatureItem); // Save creature as... CEGUI::Window *saveCreatureAsItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSaveCreatureAs"); saveCreatureAsItem->setText("Save Creature As..."); creatureMenu->addChild(saveCreatureAsItem); // Close creature CEGUI::Window *closeCreatureItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdCloseCreature"); closeCreatureItem->setText("Close Creature"); creatureMenu->addChild(closeCreatureItem); // Record frames CEGUI::Window *recordFramesItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdRecordFrames"); recordFramesItem->setText("Record Frames [CTRL+R]"); creatureMenu->addChild(recordFramesItem); //##################### //Spawn menu CEGUI::Window *spawnTopItem = wmgr.createWindow("Ogremonics/MenuItem", "spawnTopItem"); spawnTopItem->setText("Spawn"); menuBar->addChild(spawnTopItem); CEGUI::Window *spawnMenu = wmgr.createWindow("Ogremonics/PopupMenu", "spawnMenu"); spawnTopItem->addChild(spawnMenu); // spawn Box CEGUI::Window *spawnBoxItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpawnBox"); spawnBoxItem->setText("Box [2]"); spawnMenu->addChild(spawnBoxItem); // spawn Sphere CEGUI::Window *spawnSphereItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpawnSphere"); spawnSphereItem->setText("Sphere [3]"); spawnMenu->addChild(spawnSphereItem); // spawn Capsule CEGUI::Window *spawnCapsuleItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpawnCapsule"); spawnCapsuleItem->setText("Capsule [6]"); spawnMenu->addChild(spawnCapsuleItem); //##################### // Action menu CEGUI::Window *actionTopItem = wmgr.createWindow("Ogremonics/MenuItem", "actionTopItem"); actionTopItem->setText("Action"); menuBar->addChild(actionTopItem); CEGUI::Window *actionMenu = wmgr.createWindow("Ogremonics/PopupMenu", "actionMenu"); actionTopItem->addChild(actionMenu); // Return to origin CEGUI::Window *returnToOriginItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdReturnToOrigin"); returnToOriginItem->setText("Return to Origin [K]"); actionMenu->addChild(returnToOriginItem); //##################### //Settings menu CEGUI::Window *settingsTopItem = wmgr.createWindow("Ogremonics/MenuItem", "settingsTopItem"); settingsTopItem->setText("Settings"); menuBar->addChild(settingsTopItem); CEGUI::Window *settingsMenu = wmgr.createWindow("Ogremonics/PopupMenu", "settingsMenu"); settingsTopItem->addChild(settingsMenu); // Evolution menu CEGUI::Window *evolutionSettingsTopItem = wmgr.createWindow( "Ogremonics/MenuItem", "evolutionSettingsTopItem"); evolutionSettingsTopItem->setText("Evolution"); settingsMenu->addChild(evolutionSettingsTopItem); CEGUI::Window *evolutionSettingsMenu = wmgr.createWindow( "Ogremonics/PopupMenu", "evolutionSettingsMenu"); evolutionSettingsTopItem->addChild(evolutionSettingsMenu); //Population menu CEGUI::Window *populationSettingsTopItem = wmgr.createWindow( "Ogremonics/MenuItem", "populationSettingsTopItem"); populationSettingsTopItem->setText("Population"); settingsMenu->addChild(populationSettingsTopItem); CEGUI::Window *populationSettingsMenu = wmgr.createWindow( "Ogremonics/PopupMenu", "populationSettingsMenu"); populationSettingsTopItem->addChild(populationSettingsMenu); // Population size CEGUI::Window *populationSizeItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdPopulationSize"); populationSizeItem->setText("Population Size..."); populationSettingsMenu->addChild(populationSizeItem); // Selection style CEGUI::Window *selectionStyleItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSelectionStyle"); selectionStyleItem->setText("Selection Style..."); populationSettingsMenu->addChild(selectionStyleItem); // Creature CEGUI::Window *creatureSettingsTopItem = wmgr.createWindow( "Ogremonics/MenuItem", "creatureSettingsTopItem"); creatureSettingsTopItem->setText("Creature"); settingsMenu->addChild(creatureSettingsTopItem); CEGUI::Window *creatureSettingsMenu = wmgr.createWindow( "Ogremonics/PopupMenu", "creatureSettingsMenu"); creatureSettingsTopItem->addChild(creatureSettingsMenu); // Rendering CEGUI::Window *renderingTopItem = wmgr.createWindow("Ogremonics/MenuItem", "renderingTopItem"); renderingTopItem->setText("Rendering"); settingsMenu->addChild(renderingTopItem); // Rendering menu CEGUI::Window *renderingMenu = wmgr.createWindow("Ogremonics/PopupMenu", "renderingMenu"); renderingTopItem->addChild(renderingMenu); // Shadows on/off CEGUI::Window *shadowsItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdShadows"); shadowsItem->setText("Shadows on/off [H]"); renderingMenu->addChild(shadowsItem); // Fog on/off CEGUI::Window *fogItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdFog"); fogItem->setText("Fog on/off [F]"); renderingMenu->addChild(fogItem); // Skybox on/off CEGUI::Window *skyboxItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSkybox"); skyboxItem->setText("Skybox on/off [B]"); renderingMenu->addChild(skyboxItem); // Greenscreen on/off CEGUI::Window *greenscreenItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdGreenscreen"); greenscreenItem->setText("Greenscreen on/off"); renderingMenu->addChild(greenscreenItem); // Status on/off CEGUI::Window *statusItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdStatus"); statusItem->setText("Status on/off"); renderingMenu->addChild(statusItem); // Polygon mode CEGUI::Window *polygonModeTopItem = wmgr.createWindow("Ogremonics/MenuItem", "polygonModeTopItem"); polygonModeTopItem->setText("Polygon mode"); renderingMenu->addChild(polygonModeTopItem); // Polygon mode menu CEGUI::Window *polygonModeMenu = wmgr.createWindow("Ogremonics/PopupMenu", "polygonModeMenu"); polygonModeTopItem->addChild(polygonModeMenu); // Solid CEGUI::Window *solidModeItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdSolidMode"); solidModeItem->setText("Solid mode"); polygonModeMenu->addChild(solidModeItem); // Wireframe CEGUI::Window *wireframeModeItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdWireframeMode"); wireframeModeItem->setText("Wireframe mode"); polygonModeMenu->addChild(wireframeModeItem); // Ambient light CEGUI::Window *ambientLightTopItem = wmgr.createWindow( "Ogremonics/MenuItem", "ambientLightTopItem"); ambientLightTopItem->setText("Ambient light"); renderingMenu->addChild(ambientLightTopItem); // Ambient light menu CEGUI::Window *ambientLightMenu = wmgr.createWindow("Ogremonics/PopupMenu", "ambientLightMenu"); ambientLightTopItem->addChild(ambientLightMenu); // 0 % CEGUI::Window *ambientLight0Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight0Cmd); ambientLight0Item->setText(GUIConfiguration::ambientLight0Name); ambientLightMenu->addChild(ambientLight0Item); // 10 % CEGUI::Window *ambientLight10Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight10Cmd); ambientLight10Item->setText(GUIConfiguration::ambientLight10Name); ambientLightMenu->addChild(ambientLight10Item); // 20 % CEGUI::Window *ambientLight20Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight20Cmd); ambientLight20Item->setText(GUIConfiguration::ambientLight20Name); ambientLightMenu->addChild(ambientLight20Item); // 30 % CEGUI::Window *ambientLight30Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight30Cmd); ambientLight30Item->setText(GUIConfiguration::ambientLight30Name); ambientLightMenu->addChild(ambientLight30Item); // 40 % CEGUI::Window *ambientLight40Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight40Cmd); ambientLight40Item->setText(GUIConfiguration::ambientLight40Name); ambientLightMenu->addChild(ambientLight40Item); // 50 % CEGUI::Window *ambientLight50Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight50Cmd); ambientLight50Item->setText(GUIConfiguration::ambientLight50Name); ambientLightMenu->addChild(ambientLight50Item); // 60 % CEGUI::Window *ambientLight60Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight60Cmd); ambientLight60Item->setText(GUIConfiguration::ambientLight60Name); ambientLightMenu->addChild(ambientLight60Item); // 70 % CEGUI::Window *ambientLight70Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight70Cmd); ambientLight70Item->setText(GUIConfiguration::ambientLight70Name); ambientLightMenu->addChild(ambientLight70Item); // 80 % CEGUI::Window *ambientLight80Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight80Cmd); ambientLight80Item->setText(GUIConfiguration::ambientLight80Name); ambientLightMenu->addChild(ambientLight80Item); // 90 % CEGUI::Window *ambientLight90Item = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::ambientLight90Cmd); ambientLight90Item->setText(GUIConfiguration::ambientLight90Name); ambientLightMenu->addChild(ambientLight90Item); // 100 % CEGUI::Window *ambientLight100Item = wmgr.createWindow( "Ogremonics/MenuItem", GUIConfiguration::ambientLight100Cmd); ambientLight100Item->setText(GUIConfiguration::ambientLight100Name); ambientLightMenu->addChild(ambientLight100Item); // Tune for speed CEGUI::Window *tuneForSpeedItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdTuneForSpeed"); tuneForSpeedItem->setText("Tune for Speed [Keypad -]"); renderingMenu->addChild(tuneForSpeedItem); // Tune for quality CEGUI::Window *tuneForQualityItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdTuneForQuality"); tuneForQualityItem->setText("Tune for Quality [Keypad +]"); renderingMenu->addChild(tuneForQualityItem); // Movement CEGUI::Window *movementTopItem = wmgr.createWindow("Ogremonics/MenuItem", "movementTopItem"); movementTopItem->setText("Movement"); settingsMenu->addChild(movementTopItem); // Movement menu CEGUI::Window *movementMenu = wmgr.createWindow("Ogremonics/PopupMenu", "movementMenu"); movementTopItem->addChild(movementMenu); // Speed 1 CEGUI::Window *speed1Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed1"); speed1Item->setText("Speed 1 [ALT-1]"); movementMenu->addChild(speed1Item); // Speed 2 CEGUI::Window *speed2Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed2"); speed2Item->setText("Speed 2 [ALT-2]"); movementMenu->addChild(speed2Item); // Speed 3 CEGUI::Window *speed3Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed3"); speed3Item->setText("Speed 3 [ALT-3]"); movementMenu->addChild(speed3Item); // Speed 4 CEGUI::Window *speed4Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed4"); speed4Item->setText("Speed 4 [ALT-4]"); movementMenu->addChild(speed4Item); // Speed 5 CEGUI::Window *speed5Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed5"); speed5Item->setText("Speed 5 [ALT-5]"); movementMenu->addChild(speed5Item); // Speed 6 CEGUI::Window *speed6Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed6"); speed6Item->setText("Speed 6 [ALT-6]"); movementMenu->addChild(speed6Item); // Speed 7 CEGUI::Window *speed7Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed7"); speed7Item->setText("Speed 7 [ALT-7]"); movementMenu->addChild(speed7Item); // Speed 8 CEGUI::Window *speed8Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed8"); speed8Item->setText("Speed 8 [ALT-8]"); movementMenu->addChild(speed8Item); // Speed 9 CEGUI::Window *speed9Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed9"); speed9Item->setText("Speed 9 [ALT-9]"); movementMenu->addChild(speed9Item); // Speed 10 CEGUI::Window *speed10Item = wmgr.createWindow("Ogremonics/MenuItem", "cmdSpeed10"); speed10Item->setText("Speed 10 [ALT-10]"); movementMenu->addChild(speed10Item); // Physics CEGUI::Window *physicsTopItem = wmgr.createWindow("Ogremonics/MenuItem", "physicsTopItem"); physicsTopItem->setText("Physics"); settingsMenu->addChild(physicsTopItem); // Physics menu CEGUI::Window *physicsMenu = wmgr.createWindow("Ogremonics/PopupMenu", "physicsMenu"); physicsTopItem->addChild(physicsMenu); // Pause simulation CEGUI::Window *pauseSimulationItem = wmgr.createWindow( "Ogremonics/MenuItem", "cmdPauseSimulation"); pauseSimulationItem->setText("Pause Simulation"); physicsMenu->addChild(pauseSimulationItem); // gravity CEGUI::Window *gravityTopItem = wmgr.createWindow("Ogremonics/MenuItem", "gravityTopItem"); gravityTopItem->setText("Gravity"); physicsMenu->addChild(gravityTopItem); //gravity menu CEGUI::Window *gravityMenu = wmgr.createWindow("Ogremonics/PopupMenu", "gravityMenu"); gravityTopItem->addChild(gravityMenu); // No gravity CEGUI::Window *noGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::noGravityCmd); noGravityItem->setText(GUIConfiguration::noGravityName); gravityMenu->addChild(noGravityItem); // Pluto gravity 0.059 CEGUI::Window *plutoGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::plutoGravityCmd); plutoGravityItem->setText(GUIConfiguration::plutoGravityName); gravityMenu->addChild(plutoGravityItem); // Moon gravity 0.166 CEGUI::Window *moonGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::moonGravityCmd); moonGravityItem->setText(GUIConfiguration::moonGravityName); gravityMenu->addChild(moonGravityItem); // Mars/Mercury gravity 0.377/0.378 CEGUI::Window *marsMercuryGravityItem = wmgr.createWindow( "Ogremonics/MenuItem", GUIConfiguration::marsMercuryGravityCmd); marsMercuryGravityItem->setText(GUIConfiguration::marsMercuryGravityName); gravityMenu->addChild(marsMercuryGravityItem); // Uranus gravity 0.889 CEGUI::Window *uranusGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::uranusGravityCmd); uranusGravityItem->setText(GUIConfiguration::uranusGravityName); gravityMenu->addChild(uranusGravityItem); // Venus/Saturn gravity 0.907/0.916 CEGUI::Window *venusSaturnGravityItem = wmgr.createWindow( "Ogremonics/MenuItem", GUIConfiguration::venusSaturnGravityCmd); venusSaturnGravityItem->setText(GUIConfiguration::venusSaturnGravityName); gravityMenu->addChild(venusSaturnGravityItem); // Earth gravity 1 CEGUI::Window *earthGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::earthGravityCmd); earthGravityItem->setText(GUIConfiguration::earthGravityName); gravityMenu->addChild(earthGravityItem); // Neptune gravity 1.12 CEGUI::Window *neptuneGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::neptuneGravityCmd); neptuneGravityItem->setText(GUIConfiguration::neptuneGravityName); gravityMenu->addChild(neptuneGravityItem); // Jupiter gravity 2.36 CEGUI::Window *jupiterGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::jupiterGravityCmd); jupiterGravityItem->setText(GUIConfiguration::jupiterGravityName); gravityMenu->addChild(jupiterGravityItem); // Sun gravity 27.930682977 CEGUI::Window *sunGravityItem = wmgr.createWindow("Ogremonics/MenuItem", GUIConfiguration::sunGravityCmd); sunGravityItem->setText(GUIConfiguration::sunGravityName); gravityMenu->addChild(sunGravityItem); // Custom gravity... CEGUI::Window *customGravityItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdCustomGravity"); customGravityItem->setText("Custom Gravity"); gravityMenu->addChild(customGravityItem); //##################### // Help menu CEGUI::Window *helpTopItem = wmgr.createWindow("Ogremonics/MenuItem", "helpTopItem"); helpTopItem->setText("Help"); menuBar->addChild(helpTopItem); CEGUI::Window *helpMenu = wmgr.createWindow("Ogremonics/PopupMenu", "helpMenu"); helpTopItem->addChild(helpMenu); // About CEGUI::Window *aboutItem = wmgr.createWindow("Ogremonics/MenuItem", "cmdAbout"); aboutItem->setText("About"); helpMenu->addChild(aboutItem); return menuBar; }