本文整理汇总了C++中cegui::Window::setSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::setSize方法的具体用法?C++ Window::setSize怎么用?C++ Window::setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::setSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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);
}
示例2: InitPetSelectWnd
void InitPetSelectWnd(CEGUI::Window* mainPage)
{
if (!mainPage)
return;
CEGUI::Window* wnd;
char tempText[256];
for (int i = 0; i < PET_SELECT_WND_CNT; ++i)
{
sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d/DragContainer", i+1);
wnd = mainPage->getChildRecursive(tempText);
if (wnd)
{
wnd->setSize(CEGUI::UVector2(cegui_absdim(32 + 0),cegui_absdim(32 + 0)));
wnd->setPosition(CEGUI::UVector2(cegui_absdim(5),cegui_absdim(5)));
}
sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d", i+1);
wnd = mainPage->getChildRecursive(tempText);
if (wnd)
{
wnd->setSize(CEGUI::UVector2(cegui_absdim(32 + 10),cegui_absdim(32 + 10)));
}
}
}
示例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: 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);
}
示例5:
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);
}
示例6: listDir
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);
}
示例7: CEditBoxExit
CEditBoxExit(int id,
CEGUI::Window *pParent,
float fButtonSize,
const CEGUI::String &sTitle,
CExit &exit)
: CEditBoxBase(id, pParent, fButtonSize, sTitle),
m_Exit(exit),
m_BackupExit(exit) {
using namespace CEGUI;
Combobox *pComboBox = dynamic_cast<Combobox*>(m_pWindow->createChild("OgreTray/Combobox", "ExitSelect"));
m_pCombobox = pComboBox;
pComboBox->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
pComboBox->setSize(USize(UDim(1, 0), UDim(0, 3 * fButtonSize)));
pComboBox->addItem(new ListboxTextItem("Region"));
pComboBox->addItem(new ListboxTextItem("Enemy death"));
pComboBox->setAutoSizeListHeightToContent(true);
pComboBox->setReadOnly(true);
pComboBox->subscribeEvent(Combobox::EventListSelectionAccepted,
Event::Subscriber(&CEditBoxExit::onListSelectionChanged, this));
// id
m_pContentId = m_pWindow->createChild("DefaultWindow", "id");
m_pContentId->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
m_pContentId->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));
Window *pLabel = m_pContentId->createChild("OgreTray/Label", "Exitidlabel");
pLabel->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
pLabel->setSize(USize(UDim(0, fButtonSize), UDim(0, fButtonSize)));
pLabel->setText("id");
Window *pEditBox = m_pContentId->createChild("OgreTray/Editbox", "Exitid");
pEditBox->setPosition(UVector2(UDim(0, fButtonSize), UDim(0, 0)));
pEditBox->setSize(USize(UDim(1, -fButtonSize), UDim(0, fButtonSize)));
pEditBox->setText(m_Exit.getID());
m_pContentId->setVisible(m_Exit.getExitType() == EXIT_ENEMY_DEATH);
// region
m_pContentRegion = m_pWindow->createChild("DefaultWindow", "region");
m_pContentRegion->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
m_pContentRegion->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));
createVector(m_pContentRegion, "pos", m_Exit.getBoundingBox().getPosition().x, m_Exit.getBoundingBox().getPosition().y, fButtonSize, 0);
createVector(m_pContentRegion, "size", m_Exit.getBoundingBox().getSize().x, m_Exit.getBoundingBox().getSize().y, fButtonSize, fButtonSize);
m_pContentRegion->setVisible(m_Exit.getExitType() == EXIT_REGION);
// default selected exit type
m_pCombobox->setItemSelectState(m_Exit.getExitType(), true);
}
示例8: CreateCEGUIWindow
// CEGUI::UDim( scale, pos ) : scale : relative point on the screen between (0,1)
// pos : additional absolute shift in pixels
// UDim( 0.5, 100 ) -> middle point + shift 100
CEGUI::Window* GUIManager::CreateCEGUIWindow( const std::string &type, const std::string& name, const Vec4& position, const Vec4& size )
{
CEGUI::Window* pWindow = CEGUI::WindowManager::getSingleton( ).createWindow( type, name );
pWindow->setPosition( CEGUI::UVector2( CEGUI::UDim( position.x, position.y ), CEGUI::UDim( position.z, position.w ) ) );
pWindow->setSize( CEGUI::USize( CEGUI::UDim( size.x, size.y ), CEGUI::UDim( size.z, size.w ) ) );
return pWindow;
}
示例9: 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;
}
示例10: createScene
//-------------------------------------------------------------------------------------
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);
}
示例11: 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);
}
示例12: 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);
}
示例13: createGUIDefensaHumano
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;
}
}
示例14: DrawBlueprint
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);
}
示例15: spawnPlate
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;
}