本文整理汇总了C++中cegui::Window::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::setText方法的具体用法?C++ Window::setText怎么用?C++ Window::setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateSaleUIDate
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;
}
示例2: createScorePopup
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);
}
示例3: initialiseEventLights
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");
}
示例4:
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);
}
示例5: initialiseWidgetInspector
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);
}
示例6: UpdateAgentBuyUIDate
//更新委托求购界面提示
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;
}
示例7: createGUIInfo
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);
}
示例8: UpdateAgentSaleUIDate
//更新寄售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;
}
示例9: OnPlayerShopShowGoodsInfo
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;
}
示例10:
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);
}
示例11: OnPlayerShopUpdateMoneyInfo
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;
}
示例12: USize
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;
}
示例13: initialiseSkinCombobox
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);
}
示例14: createGUI
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);
}
示例15: OnPlayerShopBuyNumChange
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;
}