本文整理汇总了C++中cegui::Window::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::setPosition方法的具体用法?C++ Window::setPosition怎么用?C++ Window::setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::setPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2:
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);
}
示例3: 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);
}
示例4: AlignSelection
//------------------------------------------------------------------------
void SelectionMover::AlignSelection(const Alignment alignment)
{
// Validations
wxASSERT_MSG(m_selection != NULL, wxT("Selection member is NULL"));
if(m_selection->Size() <= 1)
{
// Should not happen because of the disabled menu/toolbar item in this case
LogWarning(wxT("You must select more than one window to align!"));
return;
}
// The first selected window is the one to match. This is for example how Visual Studio's
// dialog editor works as well.
Selection::Boxes::iterator boxIt = m_selection->GetMoveableBoxes().begin();
CEGUI::Window *current = boxIt->GetWindow();
const CEGUI::URect rect = current->getArea();
++boxIt;
for(; boxIt != m_selection->GetMoveableBoxes().end(); ++boxIt) {
// Deny when it is blocked
if (boxIt->IsLocked())
continue;
current = boxIt->GetWindow();
switch(alignment)
{
case AlignLeft:
current->setPosition(CEGUI::UVector2(rect.d_min.d_x, current->getPosition().d_y));
break;
case AlignRight:
current->setPosition(CEGUI::UVector2(rect.d_max.d_x - current->getWidth(), current->getPosition().d_y));
break;
case AlignTop:
current->setPosition(CEGUI::UVector2(current->getPosition().d_x, rect.d_min.d_y));
break;
case AlignBottom:
current->setPosition(CEGUI::UVector2(current->getPosition().d_x, rect.d_max.d_y - current->getHeight()));
break;
case AlignWidth:
// The svn diff for this block will be big; no clue what the previous code
// was doing there..
current->setWidth(rect.getWidth());
break;
case AlignHeight:
// The svn diff for this block will be big; no clue what the previous code
// was doing there..
current->setHeight(rect.getHeight());
break;
default:
LogError(wxT("SelectionMover::AlignSelection - Unrecognized align option (%d)"), alignment);
return;
}
}
// Request for a repaint
wxGetApp().GetMainFrame()->Refresh();
}
示例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: moveWindow
//只改变位置不改变大小
void CUIEditorView::moveWindow(CPoint point,CPoint step,CEGUI::Window* pWin/* = NULL*/)
{
CEGUI::Window* pWindow = pWin ? pWin : m_pSelectedWindow;
if (pWindow)
{
//方向键操作
if ( step.x != 0 || step.y != 0 )
{
CEGUI::Point pos = pWindow->getAbsolutePosition();
pos.d_x += step.x;
pos.d_y += step.y;
pWindow->setPosition(CEGUI::Absolute, pos);
}
//鼠标操作
else
{
CEGUI::Window* pParent = pWindow;
CEGUI::Point pt = CEGUI::Point(point.x, point.y);
if (pWindow->getParent() == CEGUI::System::getSingleton().getGUISheet())
{
pParent = pWindow->getParent();
CEGUI::Point pointWindow = pWindow->getPixelRect().getPosition();
//初始化位置
if(m_ptMouseMovePos.x == 0 && m_ptMouseMovePos.y == 0)
{
m_ptMouseMovePos.x = point.x - pointWindow.d_x;
m_ptMouseMovePos.y = point.y - pointWindow.d_y;
}
pt.d_x -= m_ptMouseMovePos.x;
pt.d_y -= m_ptMouseMovePos.y;
}
else
{
while (pParent && pParent->getParent() != CEGUI::System::getSingleton().getGUISheet())
{
pParent = pParent->getParent();
}
CEGUI::Point pointParent = pParent->getPixelRect().getPosition();
CEGUI::Point pointWindow = pWindow->getPixelRect().getPosition();
//初始化位置
if(m_ptMouseMovePos.x == 0 && m_ptMouseMovePos.y == 0)
{
m_ptMouseMovePos.x = point.x - pointWindow.d_x;
m_ptMouseMovePos.y = point.y - pointWindow.d_y;
}
pt = CEGUI::Point(point.x-pointParent.d_x /*+pointWindow.d_x*/ - m_ptMouseMovePos.x,
point.y - pointParent.d_y/* +pointWindow.d_y*/ - m_ptMouseMovePos.y);
}
pWindow->setClippedByParent(true);
pWindow->setPosition(CEGUI::Absolute, pt);
}
}
}
示例8: 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);
}
示例9: 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");
}
示例10: 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);
}
示例11: 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)));
}
}
}
示例12: 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;
}
示例13: SetButtons
void MessageBox::SetButtons(const MessageBoxButtons& buttons)
{
float32 sumWidth = 0;
for (MessageBoxButtons::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
{
CEGUI::Window* button = GetButton(*it);
OC_DASSERT(button != 0);
float32 width = button->getWidth().d_offset;
sumWidth += width;
}
float32 totalWidth = sumWidth + BUTTON_MARGIN * (buttons.size() - 1);
float32 left = 0;
for (MessageBoxButtons::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
{
CEGUI::Window* button = GetButton(*it);
OC_DASSERT(button != 0);
float32 width = button->getWidth().d_offset;
button->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, -0.5f * totalWidth + left), button->getPosition().d_y));
button->setWidth(CEGUI::UDim(0, width));
button->setVisible(true);
button->setID((CEGUI::uint)*it);
button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::MessageBox::OnButtonClicked, this));
left += width + BUTTON_MARGIN;
}
mMinWidth = totalWidth + 2.0f * BUTTON_MARGIN;
}
示例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: 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;
}
}