bool UpdateSaleUIDate( const CEGUI::EventArgs& e ) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Window* weimian = mgr.getWindow("Auction/SaleWnd/Text61"); weimian->setText(""); CEGUI::Window* gold = mgr.getWindow("Auction/SaleWnd/Text6"); gold->setText(""); //获取输入的出售数目 CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/SaleWnd/saleNum")); if(!edb) return false; uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(saleNum==0) return false; //设置支付位面数 weimian->setText(edb->getText()); AHdata& ah = GetInst(AHdata); uint orderID = ah.GetCanSaleID();//获取要出售的订单ID uint price = ah.GetPriceByCanSaleID(orderID);//单价 //计算价格 uint subCust = saleNum * price; //设置需要支付金币 gold->setText(CEGUI::PropertyHelper::intToString(subCust)); return true; }
void HUDDemo::createScorePopup(const CEGUI::Vector2<float>& mousePos, int points) { CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* popupWindow = winMgr.createWindow("HUDDemo/PopupLabel"); d_rootIngame->addChild(popupWindow); popupWindow->setPosition(CEGUI::UVector2(cegui_absdim(mousePos.d_x), cegui_absdim(mousePos.d_y))); popupWindow->setText(CEGUI::PropertyHelper<int>::toString(points)); popupWindow->setRiseOnClickEnabled(false); popupWindow->subscribeEvent(AnimationInstance::EventAnimationEnded, Event::Subscriber(&HUDDemo::handleScorePopupAnimationEnded, this)); popupWindow->setPixelAligned(false); popupWindow->setFont("DejaVuSans-14"); popupWindow->setPosition(popupWindow->getPosition() + CEGUI::UVector2(cegui_reldim(0.03f), cegui_reldim(-0.02f))); if(points < 0) popupWindow->setProperty("NormalTextColour", "FF880000"); else { popupWindow->setText( "+" + popupWindow->getText()); popupWindow->setProperty("NormalTextColour", "FF006600"); } CEGUI::EventArgs args; popupWindow->fireEvent("StartAnimation", args); }
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"); }
PauseState::PauseState() { m_bQuit = false; m_bQuestionActive = false; m_FrameEvent = Ogre::FrameEvent(); // Create CEGUI interface! CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); sheet = wmgr.createWindow("DefaultWindow", "PauseMenu/Sheet"); CEGUI::Window *resume = wmgr.createWindow("TaharezLook/Button", "PauseMenu/ResumeButton"); resume->setText("Resume"); resume->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.45, 0))); resume->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0))); resume->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &PauseState::onResume, this)); CEGUI::Window *menu = wmgr.createWindow("TaharezLook/Button", "PauseMenu/MenuButton"); menu->setText("Back To Menu"); menu->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.5, 0))); menu->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0))); menu->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &PauseState::onMenu, this)); sheet->addChildWindow(resume); sheet->addChildWindow(menu); }
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); }
//更新委托求购界面提示 bool UpdateAgentBuyUIDate(const CEGUI::EventArgs& e) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Window* wnd = NULL; //求购数量 CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/Buy/EditNum")); uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText()); //求购单价 edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/Buy/EditPrice")); uint price = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(cnt == 0 || price == 0)//如何一个为0,直接返回 { wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subGold"); wnd->setText("");//手续费 wnd = mgr.getWindow("Auction/Tab/Agent/Buy/Text");//总共支付 wnd->setText(""); return false; } //设置委托购买位面总价提示 wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subNum"); uint sumPrice = price * cnt; wnd->setText(CEGUI::PropertyHelper::intToString(sumPrice)); float extreCust = price * cnt * AGENT_EXTRACUST;//手续费 wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subGold"); wnd->setText(CEGUI::PropertyHelper::intToString((int)extreCust)); wnd = mgr.getWindow("Auction/Tab/Agent/Buy/Text");//总共支付 wnd->setText(CEGUI::PropertyHelper::intToString((sumPrice + (int)extreCust))); return true; }
void PlayState::createGUIInfo() { CEGUI::Window* btnNext = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/NextButton"); btnNext->setText ("NEXT"); btnNext->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); btnNext->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.01,0), CEGUI::UDim (0.01, 0))); btnNext->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::siguiente, this)); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnNext); CEGUI::Window* txtPuntos = CEGUI::WindowManager::getSingleton().createWindow ("TaharezLook/StaticText", "txtPuntos"); std::stringstream s; s << "Puntos: " << _jugadores[_idJugador]->_puntuacion; txtPuntos->setText (s.str()); txtPuntos->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); txtPuntos->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.20,0), CEGUI::UDim (0.01, 0))); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(txtPuntos); CEGUI::Window* txtMov = CEGUI::WindowManager::getSingleton().createWindow ("TaharezLook/StaticText", "txtMov"); s.str("");; s << "Movimiento: [" << _jugadores[_idJugador]->_casillaTiro.x << "," << _jugadores[_idJugador]->_casillaTiro.y << "]"; txtMov->setText (s.str()); txtMov->setSize (CEGUI::USize (CEGUI::UDim (0.30, 0), CEGUI::UDim (0.05, 0))); txtMov->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.39,0), CEGUI::UDim (0.01, 0))); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(txtMov); }
//更新寄售UI提示 bool UpdateAgentSaleUIDate(const CEGUI::EventArgs& e) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Window* wnd = NULL; CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditNum"));//寄售数量 uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText()); edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditPrice"));//寄售单价 uint price = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(cnt == 0 || price == 0)//任意一个为0,则直接返回,不更新UI { //设置支付手续费提示 wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold"); wnd->setText(""); return false; } //设置支付位面提示 wnd = mgr.getWindow("Auction/Tab/Agent/sale/subNum"); wnd->setText(CEGUI::PropertyHelper::intToString(cnt * ORDER_PER_NUM)); //设置支付手续费提示 wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold"); float extraCust = cnt * price * AGENT_EXTRACUST ; wnd->setText(CEGUI::PropertyHelper::intToString((int)extraCust)); return true; }
bool OnPlayerShopShowGoodsInfo(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CGoods* goods = static_cast<CGoods*>(wnd->getUserData()); if (!goods) return false; CEGUI::DefaultWindow* iconWnd = WDefaultWindow(GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Icon")); CEGUI::Window* nameWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Name"); CEGUI::Window* oneGroupNumWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/OneGroupNum"); CEGUI::Window* priceWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Price"); CEGUI::Window* averagePriceWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/AveragePrice"); if (!iconWnd || !nameWnd || !oneGroupNumWnd || !priceWnd || !averagePriceWnd) return false; char tempText[256]; char strImageFilePath[128] = ""; char strImageFileName[128] = ""; PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods); if (pGoodsItem!=NULL) { // 物品名字 DWORD dwNameSize = (DWORD)strlen(pGoodsItem->strGoodsName.c_str()); if (dwNameSize>20) { _snprintf(tempText,21,"%s", pGoodsItem->strGoodsName.c_str()); sprintf((tempText+20),"..."); }else sprintf(tempText,"%s", pGoodsItem->strGoodsName.c_str()); nameWnd->setText(ToCEGUIString(tempText)); // 物品图片 const char *strIconPath = GetGame()->GetPicList()->GetPicFilePathName(CPicList::PT_GOODS_ICON, pGoodsItem->goodsIconId); GetFilePath(strIconPath,strImageFilePath); GetFileName(strIconPath,strImageFileName); CEGUI::String strImagesetName = "GoodIcon/"; strImagesetName += strImageFileName; SetBackGroundImage(iconWnd,strImagesetName.c_str(),strImageFilePath,strImageFileName); // 物品单组个数 sprintf(tempText,"%d",pGoodsItem->oneGroupNum); oneGroupNumWnd->setText(ToCEGUIString(tempText)); // 物品售价 sprintf(tempText,"%d", pGoodsItem->price); priceWnd->setText(ToCEGUIString(tempText)); // 物品单个均价 char strGoodsPrice[64] = "",strNumLen[64] = ""; sprintf(strNumLen,"%d",pGoodsItem->price/pGoodsItem->oneGroupNum); float fPrice = static_cast<float>(pGoodsItem->price)/static_cast<float>(pGoodsItem->oneGroupNum); sprintf(strGoodsPrice,"%*.2f",(int)strlen(strNumLen)+2,fPrice); averagePriceWnd->setText(ToCEGUIString(strGoodsPrice)); } return true; }
MenuState::MenuState() { m_bQuit = false; m_FrameEvent = Ogre::FrameEvent(); // Create CEGUI interface! CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); sheet = wmgr.createWindow( "DefaultWindow", "MainMenu/Sheet"); CEGUI::ImagesetManager::getSingleton().createFromImageFile("BG", "mainMenuBackground.png"); CEGUI::Window* menuBackground = wmgr.createWindow("TaharezLook/StaticImage", "MainMenu/BG"); menuBackground->setProperty( "Image", "set:BG image:full_image"); menuBackground->setSize(CEGUI::UVector2(CEGUI::UDim(0.0, 1440.0), CEGUI::UDim(0.0, 900.0))); menuBackground->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, 0.0), CEGUI::UDim( 0.0, 0.0))); menuBackground->setProperty( "FrameEnabled", "False"); CEGUI::ImagesetManager::getSingleton().createFromImageFile("Loading", "loading.png"); loading = wmgr.createWindow("TaharezLook/StaticImage", "MainMenu/Loading"); loading->setProperty( "Image", "set:Loading image:full_image"); loading->setSize(CEGUI::UVector2(CEGUI::UDim(0.0, 512.0), CEGUI::UDim(0.0, 128.0))); loading->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.5, -256.0), CEGUI::UDim( 0.5, -64.0))); loading->setProperty( "FrameEnabled", "False"); loading->setProperty( "BackgroundEnabled", "False"); CEGUI::ImagesetManager::getSingleton().createFromImageFile("NeuroPulseLogo", "neuroPulseLogo_1.png"); CEGUI::Window* neuroPulseLogo = wmgr.createWindow("TaharezLook/StaticImage", "MainMenu/Logo"); neuroPulseLogo->setProperty( "Image", "set:NeuroPulseLogo image:full_image"); neuroPulseLogo->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.5, -275.0), CEGUI::UDim( 0.1, 0))); neuroPulseLogo->setSize(CEGUI::UVector2(CEGUI::UDim(0.0, 550.0), CEGUI::UDim(0.0, 200.0))); neuroPulseLogo->setProperty( "FrameEnabled", "False"); neuroPulseLogo->setProperty( "BackgroundEnabled", "False"); CEGUI::Window *play = wmgr.createWindow("TaharezLook/Button", "MainMenu/PlayButton"); play->setText("Play"); play->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.45, 0))); play->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0))); play->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &MenuState::onPlay, this)); CEGUI::Window *options = wmgr.createWindow("TaharezLook/Button", "MainMenu/OptionsButton"); options->setText("Options"); options->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.5, 0))); options->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0))); options->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &MenuState::onOptions, this)); CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "MainMenu/QuitButton"); quit->setText("Quit"); quit->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.55, 0))); quit->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0))); quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &MenuState::onQuit, this)); sheet->addChildWindow(menuBackground); sheet->addChildWindow(neuroPulseLogo); sheet->addChildWindow(play); sheet->addChildWindow(options); sheet->addChildWindow(quit); }
bool OnPlayerShopUpdateMoneyInfo(const CEGUI::EventArgs& e) { // 目前个人商店只支持金币一种货币类型@todo CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CPlayer* pPlayer = GetGame()->GetMainPlayer(); if (!pPlayer) return false; CEGUI::Window* tradeGoldsWnd = wnd->getChildRecursive("PlayerShop/backgrond/SumUp/TradeGolds"); CEGUI::Window* haveGoldsWnd = wnd->getChildRecursive("PlayerShop/backgrond/SumUp/HaveGolds"); if (!tradeGoldsWnd || !haveGoldsWnd) return false; int curShopState = GetPlayerShop().GetCurShopState(); ulonglong tradeGolds = GetPlayerShop().GetTradeGold(); char str[256]; if(curShopState==PlayerShop::SET_SHOP || curShopState==PlayerShop::OPEN_SHOP) { // 获得金币 if (tradeGolds>=2000000000) { wsprintf(str,"+ %d",2000000000); }else wsprintf(str,"+ %d",tradeGolds); tradeGoldsWnd->setText(ToCEGUIString(str)); // 持有金币 if (pPlayer->GetMoney()>=2000000000) { wsprintf(str,"%d",2000000000); }else wsprintf(str,"%d",pPlayer->GetMoney()); haveGoldsWnd->setText(ToCEGUIString(str)); } else if(curShopState==PlayerShop::SHOPPING_SHOP) { // 花费金币 if (tradeGolds>=2000000000) { wsprintf(str,"- %d",2000000000); }else wsprintf(str,"- %d",tradeGolds); tradeGoldsWnd->setText(ToCEGUIString(str)); // 持有金币 if (pPlayer->GetMoney()>=2000000000) { wsprintf(str,"%d",2000000000); }else wsprintf(str,"%d",pPlayer->GetMoney()); haveGoldsWnd->setText(ToCEGUIString(str)); } return true; }
bool IntroState::info(const CEGUI::EventArgs &e) { CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); _credits=false; _options=false; _info=true; //Sheet Creditos Window* sheetBG = WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","background_info"); sheetBG->setPosition( UVector2(cegui_reldim(0),cegui_reldim(0))); sheetBG->setSize( USize(cegui_reldim(1),cegui_reldim(1))); sheetBG->setProperty("Image","BackgroundImageControls"); 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)); sheetBG->addChild(backButton); sheet->addChild(sheetBG); return true; }
void WidgetDemo::initialiseSkinCombobox(CEGUI::Window* container) { WindowManager& winMgr = WindowManager::getSingleton(); CEGUI::Window* skinSelectionComboboxLabel = winMgr.createWindow("Vanilla/Label", "SkinSelectionComboboxLabel"); skinSelectionComboboxLabel->setText("Select a Skin and a Widget"); skinSelectionComboboxLabel->setPosition(CEGUI::UVector2(cegui_reldim(0.65f), cegui_reldim(0.12f))); skinSelectionComboboxLabel->setSize(CEGUI::USize(cegui_reldim(0.24f), cegui_reldim(0.07f))); d_skinSelectionCombobox = static_cast<CEGUI::Combobox*>(winMgr.createWindow("Vanilla/Combobox", "SkinSelectionCombobox")); d_skinSelectionCombobox->setPosition(CEGUI::UVector2(cegui_reldim(0.65f), cegui_reldim(0.2f))); d_skinSelectionCombobox->setSize(CEGUI::USize(cegui_reldim(0.24f), cegui_reldim(0.3f))); d_skinSelectionCombobox->setReadOnly(true); d_skinSelectionCombobox->setSortingEnabled(false); d_skinSelectionCombobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, Event::Subscriber(&WidgetDemo::handleSkinSelectionAccepted, this)); std::map<CEGUI::String, WidgetListType>::iterator iter = d_skinListItemsMap.begin(); while(iter != d_skinListItemsMap.end()) { d_skinSelectionCombobox->addItem(new MyListItem(iter->first)); ++iter; } container->addChild(d_skinSelectionCombobox); container->addChild(skinSelectionComboboxLabel); }
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); }
bool OnPlayerShopBuyNumChange(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CEGUI::String buyNum = wnd->getText(); char str[32] = ""; CEGUI::Window* goodsWnd = wnd->getParent(); if (goodsWnd) { CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData()); if (!goods) return false; PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods); if (pGoodsItem!=NULL) { ulong num = atoi(buyNum.c_str()); if (num>=pGoodsItem->groupNum) { sprintf(str,"%d",pGoodsItem->groupNum); } else if (num<=0) { sprintf(str,"%d",0); } sprintf(str,"%d",num); wnd->setText(ToCEGUIString(str)); pGoodsItem->readyTradeNum = num; } } return true; }
//------------------------------------------------------------------------------------- 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); }
void PromptBox::SetLabel(const CEGUI::String& text) { OC_CEGUI_TRY; { CEGUI::Window* messageText = mPromptBox->getChild(mPromptBox->getName() + "/MessageText"); CEGUI::Window* editbox = mPromptBox->getChild(mPromptBox->getName() + "/Editbox"); const float32 offset = 10; float32 buttonHeight = mPromptBox->getChild(mPromptBox->getName() + "/ButtonOK")->getPixelSize().d_height; float32 editboxHeight = editbox->getPixelSize().d_height; messageText->setText(text); float32 textWidth = StringConverter::FromString<float32>(messageText->getProperty("HorzExtent").c_str()); float32 textHeight = StringConverter::FromString<float32>(messageText->getProperty("VertExtent").c_str()); editbox->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber(&PromptBox::OnEditboxKeyDown, this)); messageText->setArea(CEGUI::UDim(0,offset), CEGUI::UDim(0,0), CEGUI::UDim(1, -2.0f*offset), CEGUI::UDim(1, -buttonHeight-editboxHeight - offset)); mPromptBox->setWidth(CEGUI::UDim(0, textWidth + 2.0f*offset + INNER_FRAME_OFFSET)); mPromptBox->setHeight(CEGUI::UDim(0, textHeight + buttonHeight + editboxHeight + offset + INNER_FRAME_OFFSET)); mPromptBox->setXPosition(CEGUI::UDim(0.5f, -0.5f*mPromptBox->getPixelSize().d_width)); mPromptBox->setYPosition(CEGUI::UDim(0.5f, -0.5f*mPromptBox->getPixelSize().d_height)); EnsureWindowIsWideEnough(); } OC_CEGUI_CATCH; }
void EndState::enter () { _root = Ogre::Root::getSingletonPtr(); _sceneMgr = _root->getSceneManager("SceneManager"); _camera = _sceneMgr->getCamera("IntroCamera"); _viewport = _root->getAutoCreatedWindow()->getViewport(0); _pSoundFXManager = SoundFXManager::getSingletonPtr(); _simpleEffect = _pSoundFXManager->load("gameover.ogg"); _simpleEffect->play(); _exitGame = _save = false; _rec = new Record(); //CEGUI CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().show(); _sheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","Menu"); //Config Window CEGUI::Window* configWin = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("end.layout"); CEGUI::Window* mark = configWin->getChild("MarkValue"); mark->setText(Ogre::StringConverter::toString(_score)); _nick = configWin->getChild("Nick"); _nick->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&EndState::clear, this)); CEGUI::Window* menuButton = configWin->getChild("MenuButton"); menuButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&EndState::save, this)); CEGUI::Window* exitButton = configWin->getChild("ExitButton"); exitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&EndState::quit, this)); //Attaching buttons _sheet->addChild(configWin); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(_sheet); }
void InitPetStrenthenWnd(CEGUI::Window* mainPage, long type) { if (!mainPage || (type<PET_QUALITYUP_ID || type>PET_FFUP_ID)) return; char tempText[256]; for (int i = PET_QUALITYUP_ID; i <= PET_FFUP_ID; i+=PET_QUALITYUP_ID) { sprintf(tempText, "PetStrengthen/%d", i); CEGUI::Window* strenthenWnd = mainPage->getChildRecursive(tempText); if (strenthenWnd) { strenthenWnd->setVisible(false); } } sprintf(tempText, "PetStrengthen/%d", type); CEGUI::Window* strenthenWnd = mainPage->getChildRecursive(tempText); if (strenthenWnd) { strenthenWnd->setVisible(true); } CEGUI::Window* explainTextWnd = mainPage->getChildRecursive("PetStrengthen/ExplainText"); if (explainTextWnd) { explainTextWnd->setText(GetInst(PetSetup).GetExplainTextByID(type).c_str()); } }
void PlayState::createGUIDefensaHumano() { if (_jugadores[0]->_num_portaviones < _jugadores[0]->NUM_MAX_PORTAVIONES) { CEGUI::Window* btnPortaviones = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/Portaviones"); btnPortaviones->setText ("Portaviones"); btnPortaviones->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); btnPortaviones->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.01, 0), CEGUI::UDim (0.01, 0))); btnPortaviones->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::colocaPortaviones, this)); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnPortaviones); } if (_jugadores[0]->_num_acorazados < _jugadores[0]->NUM_MAX_ACORAZADOS) { CEGUI::Window* btnAcorazado = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/Acorazado"); btnAcorazado->setText ("Acorazado"); btnAcorazado->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); btnAcorazado->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.20, 0), CEGUI::UDim (0.01, 0))); btnAcorazado->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::colocaAcorazado, this)); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnAcorazado); } if (_jugadores[0]->_num_lanchas < _jugadores[0]->NUM_MAX_LANCHAS) { CEGUI::Window* btnLancha = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/Lancha"); btnLancha->setText ("Lancha"); btnLancha->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); btnLancha->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.39, 0), CEGUI::UDim (0.01, 0))); btnLancha->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::colocaLancha, this)); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnLancha); } if ( _jugadores[0]->_num_acorazados + _jugadores[0]->_num_lanchas + _jugadores[0]->_num_portaviones == _jugadores[0]->NUM_MAX_ACORAZADOS + _jugadores[0]->NUM_MAX_LANCHAS + _jugadores[0]->NUM_MAX_PORTAVIONES) { addSceneAtaque(); createGUINext(); createGUIInfo(); _turnoEnCurso = true; _estado = jugando; } }
void DrawBase::DrawBlueprint(Logic::SendBlueToGui *evnt){ CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *res; Ogre::String name; Ogre::String text; int x=0,y=0,i=0; std::vector<Logic::BuildingBlueprint *>::iterator the_iterator; the_iterator = evnt->allBlue.begin(); if(wmgr.isWindowPresent( "Blueprint/sheet")){ mBlueSheet= wmgr.getWindow( "Blueprint/sheet"); ClearFromAllChild(mBlueSheet); mBlueSheet->addChildWindow(mBlueSheetClose); }else{ mBlueSheet= wmgr.createWindow("TaharezLook/StaticImage", "Blueprint/sheet"); mBlueSheet->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.5, 0))); mBlueSheet->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0), CEGUI::UDim(0, 0))); mBlueSheetClose= wmgr.createWindow("TaharezLook/Button", "Blueprint/close"); mBlueSheetClose->setPosition(CEGUI::UVector2(CEGUI::UDim(0,0), CEGUI::UDim(0, 0))); mBlueSheetClose->setSize(CEGUI::UVector2(CEGUI::UDim(0.3, 0), CEGUI::UDim(0.1, 0))); mBlueSheetClose->setText("Close"); mBlueSheetClose->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&BaseDraw::Close,(BaseDraw*) this)); mBlueSheet->addChildWindow(mBlueSheetClose); } while (the_iterator != evnt->allBlue.end()) { name= "Blueprint/BlueNum"+Logic::LogicStd::IntToString(i++); if(wmgr.isWindowPresent(name)){ res= wmgr.getWindow(name); res->setUserData((*the_iterator)); mBlueSheet->addChildWindow(res); }else{ res= wmgr.createWindow("TaharezLook/Button", name); res->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5*x,0), CEGUI::UDim(0.2*y+0.1, 0))); res->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.2, 0))); res->setUserData((*the_iterator)); mBlueSheet->addChildWindow(res); res->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&DrawBase::BuildOrder, this)); } text=(*the_iterator)->mName; text+="_"+Logic::LogicStd::IntToString((*the_iterator)->mCost); res->setText(text); if(++x>=2){ x=0; y++; } ++the_iterator; } mMainWindow->addChildWindow(mBlueSheet); }
//更新三个付费券的UI数据 bool OnShopCityUpdateMoneyEdboxes(const CEGUI::EventArgs& e) { ShopCityMsgMgr& mgr = GetInst(ShopCityMsgMgr); CEGUI::Window* pgWnd = WEArgs(e).window; CEGUI::Window* temp = pgWnd->getChildRecursive(SHOPCITY_XINGZUAN_EDBOX_NAME); if(temp) { temp->setText(CEGUI::PropertyHelper::intToString(mgr.GetPlayerXinZuan())); } temp = pgWnd->getChildRecursive(SHOPCITY_WEIMIAN_EDBOX_NAME); if(temp) temp->setText(CEGUI::PropertyHelper::intToString(mgr.GetPlayerWeiMian())); temp = pgWnd->getChildRecursive(SHOPCITY_DIANJUAN_EDBOX_NAME); if(temp) temp->setText(CEGUI::PropertyHelper::intToString(mgr.GetPlayerDianQuan())); return true; }
bool OnClearMoneyEdboxes(const CEGUI::EventArgs& e) { CEGUI::Window* pageWnd = WEArgs(e).window; //星钻 CEGUI::Window* temp = pageWnd->getChildRecursive(SHOPCITY_XINGZUAN_EDBOX_NAME); if(temp) temp->setText(""); //点券 temp = pageWnd->getChildRecursive(SHOPCITY_DIANJUAN_EDBOX_NAME); if(temp) temp->setText(""); //位面 temp = pageWnd->getChildRecursive(SHOPCITY_WEIMIAN_EDBOX_NAME); if(temp) temp->setText(""); return true; }
bool CharacterSelectState::onCharacterSelButton(const CEGUI::EventArgs &args) { const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(args); character = we.window->getName(); CEGUI::Window* w = CEGUI::WindowManager::getSingleton().getWindow("Character"); w->setText(character); return true; }
void GUISystem::PromptBox::SetText( const CEGUI::String& text ) { OC_CEGUI_TRY; { CEGUI::Window* editbox = mPromptBox->getChild(mPromptBox->getName() + "/Editbox"); editbox->setText(text); } OC_CEGUI_CATCH; }
void GUISystem::FolderSelector::Show(const CEGUI::String& windowTitle, bool showEditbox, const CEGUI::String& editboxLabel) { bool success = false; OC_CEGUI_TRY; { CEGUI::Window* root = gGUIMgr.GetGUISheet(); mWindow = gGUIMgr.LoadSystemLayout("FolderSelector.layout", root->getName() + "/"); mWindow->setAlwaysOnTop(true); mWindow->setModalState(true); root->addChildWindow(mWindow); CEGUI::Window* frame = mWindow->getChild(root->getName() + "/FolderSelector/Frame"); frame->setText(windowTitle); mButtonOK = frame->getChild(root->getName() + "/FolderSelector/ButtonOK"); mButtonCancel = frame->getChild(root->getName() + "/FolderSelector/ButtonCancel"); mPathBox = frame->getChild(root->getName() + "/FolderSelector/PathBox"); mFolderList = static_cast<CEGUI::Listbox*>(frame->getChild(root->getName() + "/FolderSelector/FolderList")); mFolderList->setWantsMultiClickEvents(true); mEditbox = frame->getChild(root->getName() + "/FolderSelector/Editbox"); mEditbox->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnEditboxKeyDown, this)); mButtonOK->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnButtonClicked, this)); mButtonCancel->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnButtonClicked, this)); mFolderList->subscribeEvent(CEGUI::Listbox::EventMouseDoubleClick, CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnFolderListDoubleClicked, this)); CEGUI::Window* buttonCreateDirectory = frame->getChild(root->getName() + "/FolderSelector/ButtonCreateDirectory"); buttonCreateDirectory->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnCreateDirectoryClicked, this)); if (!showEditbox) { mEditbox->hide(); frame->getChild(root->getName() + "/FolderSelector/EditboxLabel")->hide(); } else { frame->getChild(root->getName() + "/FolderSelector/EditboxLabel")->setText(editboxLabel); mEditbox->activate(); } UpdateFolderList(); success = true; } OC_CEGUI_CATCH; if (!success) { ocError << "Cannot show FolderSelector."; delete this; } }
void PlayState::createGUINext() { CEGUI::Window* btnNext = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/NextButton"); btnNext->setText ("NEXT"); btnNext->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0))); btnNext->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.01,0), CEGUI::UDim (0.01, 0))); btnNext->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::siguiente, this)); CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnNext); }
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 OgreCmdWindow::entryKeyDownHandler(const CEGUI::EventArgs& e) { std::stringstream ss; if(((const CEGUI::KeyEventArgs&)e).scancode == 28) { CEGUI::Window * wnd = ((const CEGUI::KeyEventArgs&)e).window; ((OgreCmdWindow*)wnd->getUserData())->readString(wnd->getText().c_str()); wnd->setText(""); } return true; }
void MenuState::createScene() { CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *window = wmgr.createWindow("DefaultWindow", "CEGUI/MenuWindow"); // title logo CEGUI::Window *si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "TitlePng"); si->setSize(CEGUI::UVector2(CEGUI::UDim(0.8, 0), CEGUI::UDim(0.25, 0))); si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1, 0), CEGUI::UDim(0.05, 0))); si->setProperty("Image","set:Title image:full_image"); si->setProperty("FrameEnabled", "False"); si->setProperty("BackgroundEnabled", "False"); window->addChildWindow(si); // new game button CEGUI::Window *new_game = wmgr.createWindow("TaharezLook/Button", "CEGUI/NewGameButton"); new_game->setText("Start Game"); new_game->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.15, 0))); new_game->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.34, 0))); window->addChildWindow(new_game); // how to play button CEGUI::Window *instructions = wmgr.createWindow("TaharezLook/Button", "CEGUI/InstructionsButton"); instructions->setText("How to Play"); instructions->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.15, 0))); instructions->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.53, 0))); window->addChildWindow(instructions); // quit button CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "CEGUI/QuitButton"); quit->setText("Exit Game"); quit->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.15, 0))); quit->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.72, 0))); window->addChildWindow(quit); CEGUI::System::getSingleton().setGUISheet(window); // event calls new_game->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::start, this)); instructions->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::instruction, this)); quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::quit, this)); }