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); }
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 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); }
//------------------------------------------------------------------------ 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(); }
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); }
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); }
//只改变位置不改变大小 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); } } }
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); }
void WidgetDemo::initialiseEventLights(CEGUI::Window* container) { CEGUI::WindowManager &winMgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* horizontalLayout = winMgr.createWindow("HorizontalLayoutContainer", "EventLightsContainer"); horizontalLayout->setPosition(CEGUI::UVector2(cegui_reldim(0.085f), cegui_reldim(0.93f))); container->addChild(horizontalLayout); d_windowLightUpdatedEvent = winMgr.createWindow("SampleBrowserSkin/Light"); horizontalLayout->addChild(d_windowLightUpdatedEvent); d_windowLightUpdatedEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f))); d_windowLightUpdatedEvent->setAspectMode(CEGUI::AM_EXPAND); d_windowLightUpdatedEvent->setProperty("LightColour", "FF66FF66"); CEGUI::Window* updateEventLabel = winMgr.createWindow("Vanilla/Label"); horizontalLayout->addChild(updateEventLabel); updateEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f))); updateEventLabel->setText("EventUpdated"); updateEventLabel->setFont("DejaVuSans-12-NoScale"); updateEventLabel->setProperty("HorzFormatting", "LeftAligned"); d_windowLightMouseMoveEvent = winMgr.createWindow("SampleBrowserSkin/Light"); horizontalLayout->addChild(d_windowLightMouseMoveEvent); d_windowLightMouseMoveEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f))); d_windowLightMouseMoveEvent->setAspectMode(CEGUI::AM_EXPAND); d_windowLightMouseMoveEvent->setProperty("LightColour", "FF77BBFF"); CEGUI::Window* mouseMoveEventLabel = winMgr.createWindow("Vanilla/Label"); horizontalLayout->addChild(mouseMoveEventLabel); mouseMoveEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f))); mouseMoveEventLabel->setText("EventMouseMove"); mouseMoveEventLabel->setFont("DejaVuSans-12-NoScale"); mouseMoveEventLabel->setProperty("HorzFormatting", "LeftAligned"); }
void 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 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))); } } }
// 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; }
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; }
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); }
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); }
void DynamicEditor::VariableFactory::createNameDisplay(float _top, float _height, CEGUI::Window* _root)//(CEGUI::Window* _rootWindow, TypeTable* _params, const std::string& _factoryName, float* _uiElementTop) { static int uniqueName = 0; CEGUI::Window* variableNameDisplay = CEGUI::WindowManager::getSingletonPtr()->loadWindowLayout("ComponentSelectionDisplay.layout", _root->getName() + "Show" + uniqueName++); variableNameDisplay->setPosition(CEGUI::UVector2({{0.0f, 0.0f}, {0.0f,_top}})); variableNameDisplay->setHeight({0.0f, _height}); variableNameDisplay->setProperty("Text", name); _root->addChildWindow(variableNameDisplay); }
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::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)); }
CEGUI::Window * Score::_createText(const std::string &text, const float &xRel, const float &yRel, const std::string &font) { CEGUI::Window *result = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText"); result->setProperty("Text", CEGUI::String("[colour='") + _configValue<std::string>("font_color") + "']" + text); result->setProperty("Font", font); result->setPosition(CEGUI::UVector2(CEGUI::UDim(0, xRel), CEGUI::UDim(0, yRel))); result->setProperty("FrameEnabled", "False"); result->setProperty("VertFormatting", "LeftAligned"); result->setProperty("HorzFormatting", "LeftAligned"); return result; }
void McsHudGui::init() { CEGUI::MouseCursor::getSingleton().hide(); CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "MCSHudDefault/DefaultHud"); CEGUI::Window *crosshair = wmgr.createWindow("Vanilla/StaticImage", "MCSHud/Crosshair"); crosshair->setProperty("Image", "set:HudImages image:cross"); crosshair->setSize(CEGUI::UVector2(CEGUI::UDim(0, 32), CEGUI::UDim(0, 32))); crosshair->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, -16), CEGUI::UDim(0.5f, -16))); crosshair->setProperty("BackgroundEnabled", "False"); crosshair->setProperty("FrameEnabled", "False"); mFpsText = wmgr.createWindow("Vanilla/StaticText", "MCSHud/FpsText"); mFpsText->setAlpha(0.6f); mFpsText->setText(""); mFpsText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 5), CEGUI::UDim(0.0f, 5))); mFpsText->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.04f, 0))); mFpsText->setProperty("BackgroundEnabled", "False"); mFpsText->setProperty("FrameEnabled", "False"); mPosText = wmgr.createWindow("Vanilla/StaticText", "MCSHud/PosText"); mPosText->setAlpha(0.6f); mPosText->setText(""); mPosText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 5), CEGUI::UDim(0.04f, 5))); mPosText->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.04f, 0))); mPosText->setProperty("BackgroundEnabled", "False"); mPosText->setProperty("FrameEnabled", "False"); mHitPosText = wmgr.createWindow("Vanilla/StaticText", "MCSHud/HitPosText"); mHitPosText->setAlpha(0.6f); mHitPosText->setText(""); mHitPosText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 5), CEGUI::UDim(0.08f, 5))); mHitPosText->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, -5), CEGUI::UDim(0.04f, 0))); mHitPosText->setProperty("BackgroundEnabled", "False"); mHitPosText->setProperty("FrameEnabled", "False"); addFrameGraph(sheet); sheet->addChildWindow(crosshair); sheet->addChildWindow(mFpsText); sheet->addChildWindow(mPosText); sheet->addChildWindow(mHitPosText); CEGUI::System::getSingleton().setGUISheet(sheet); }
CGUIHeartsDisplay::CGUIHeartsDisplay(CEntity *pParentEntity, CEGUI::Window *pParentWindow, const CEGUI::UVector2 &vPosition) : CGUIOverlay("gui_hearts_display", pParentEntity, pParentWindow, pParentWindow->createChild("DefaultWindow")), m_MaximalHitpoints(0), m_CurrentHitpoints(0) { m_pRoot->setPosition(vPosition); m_pRoot->setSize(USize(UDim(0, 10 * GUI_HEART_IMG_WITH_BORDER_SIZE), UDim(0, 2 * GUI_HEART_IMG_WITH_BORDER_SIZE))); for (Ogre::uint16 i = 0; i < m_uiMaxHeartCount; i++) { CEGUI::Window *pWindow = m_pRoot->createChild("OgreTray/StaticImage", "heart_" + CEGUI::PropertyHelper<int>::toString(i) ); pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, (i % (m_uiMaxHeartCount / 2)) * GUI_HEART_IMG_WITH_BORDER_SIZE),CEGUI::UDim(0, (i / (m_uiMaxHeartCount / 2))* GUI_HEART_IMG_WITH_BORDER_SIZE))); pWindow->setSize(CEGUI::USize(CEGUI::UDim(0, GUI_HEART_IMG_SIZE),CEGUI::UDim(0, GUI_HEART_IMG_SIZE))); pWindow->setProperty("Image","hud/0/4"); pWindow->setProperty("FrameEnabled","False"); pWindow->setProperty("BackgroundEnabled","False"); pWindow->setVisible(false); } }
void GUIManager::LoadMainMenu() { CEGUI::ImagesetManager::getSingletonPtr()->createFromImageFile("mainMenuBG","background.tga"); //add background CEGUI::Window *mainMenu = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "mainMenu"); sheet->addChildWindow(mainMenu); mainMenu->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0))); mainMenu->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0))); mainMenu->setProperty("Image", "set:mainMenuBG image:full_image" ); mainMenu->setAlpha(1.0); CEGUI::PushButton* login = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/Button"); mainMenu->addChildWindow(login); login->setArea(CEGUI::URect(CEGUI::UDim(0.2f,0), CEGUI::UDim(0.65f,0), CEGUI::UDim(0.3f,0), CEGUI::UDim(0.7f,0))); login->subscribeEvent(CEGUI::PushButton::EventActivated, CEGUI::Event::Subscriber(&GUIManager::HandleGameLoginClicked, this)); }
void GUI::initialize() { // Bootstrap the system. CEGUI::OpenGLRenderer::bootstrapSystem(); // Load the resource groups. initializeResourceGroups(); // Load information. CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme"); CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow"); // Create and set the root window. CEGUI::Window* root = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "_RootWindow"); root->setSize(CEGUI::UVector2(CEGUI::UDim(1.f, 0), CEGUI::UDim(1.f, 0))); root->setPosition(CEGUI::UVector2(CEGUI::UDim(0.f, 0), CEGUI::UDim(0.f, 0))); CEGUI::System::getSingleton().setGUISheet(root); }
/************************************************************************* Creates a label that contains a description of what is seen in the sample *************************************************************************/ void CustomShapesDrawingSample::createDescriptionLabel() { WindowManager& winMgr = WindowManager::getSingleton(); // We create a button and subscribe to its click events CEGUI::Window* descriptionLabel = winMgr.createWindow("Generic/Label"); descriptionLabel->setSize(CEGUI::USize(cegui_reldim(0.8f), cegui_reldim(0.25f))); descriptionLabel->setHorizontalAlignment(HA_CENTRE); descriptionLabel->setProperty("HorzFormatting", "WordWrapCentreAligned"); descriptionLabel->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_absdim(400.0f))); d_root->addChild(descriptionLabel); descriptionLabel->setText("The left graph is rendered directly into a GeometryBuffer and rendered as overlay." "The right graph is created using an SVGImage with modified SVGData and is then used in the same way as a regular CEGUI image" " - it is set as a property for a window that renders the image. \n\n" "The benefit of creating custom geometry by using an SVGImage and its SVGData is that it can be conveniently added to a CEGUI Window " "and that defining primitive objects, such as lines, rectangles etc., is easier. Additionally, the internal CEGUI SVG classes which " "create the geometry offer an anti-aliasing option that delivers anti-aliasing at almost no extra performance cost for the GPU."); }
CEGUI::Window* HUDDemo::spawnPlate() { CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* plateRoot = winMgr.createWindow("DefaultWindow"); plateRoot->setSize(CEGUI::USize(cegui_absdim(0.0f), cegui_reldim(0.16f))); plateRoot->setAspectMode(CEGUI::AM_EXPAND); plateRoot->setAspectRatio(1.0f); plateRoot->setRiseOnClickEnabled(false); plateRoot->setPixelAligned(false); plateRoot->subscribeEvent(CEGUI::Window::EventMouseButtonDown, Event::Subscriber(&HUDDemo::handlePlateWindowClicked, this)); d_rootIngame->addChild(plateRoot); CEGUI::Window* plateImgWnd = winMgr.createWindow("Generic/Image", "ImageWindowPlate"); plateImgWnd->setProperty("Image", s_imageNamePlate); plateImgWnd->setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_absdim(0.0f))); plateImgWnd->setAspectRatio(3.308f); plateImgWnd->setAspectMode(CEGUI::AM_EXPAND); plateImgWnd->setVerticalAlignment(CEGUI::VA_BOTTOM); plateImgWnd->setMousePassThroughEnabled(true); plateImgWnd->setPixelAligned(false); plateRoot->addChild(plateImgWnd); CEGUI::String image = getRandomGameImage(); CEGUI::Window* plateTopping = winMgr.createWindow("Generic/Image", "ImageWindowObject"); plateTopping->setProperty("Image", image); plateTopping->setSize(CEGUI::USize(cegui_reldim(0.88f), cegui_absdim(0.0f))); plateTopping->setAspectRatio(1.0f); plateTopping->setAspectMode(CEGUI::AM_EXPAND); plateTopping->setHorizontalAlignment(CEGUI::HA_CENTRE); plateTopping->setMousePassThroughEnabled(true); plateTopping->setPixelAligned(false); plateRoot->addChild(plateTopping); int randumNumber = rand() % 10000; float posY = randumNumber / 10000.0f; plateRoot->setPosition(CEGUI::UVector2(cegui_absdim(0.0f), cegui_reldim(0.1f + 0.6f * posY))); return plateRoot; }
void McsHudGui::addFrameGraph(CEGUI::Window* sheet) { Ogre::TexturePtr tex = mOgreRoot->getTextureManager()->createManual( "FrameGraph", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, TimeGraphMaxFrames, TimeGraphMaxResolution, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET); Ogre::SceneManager* debugSceneMgr = mOgreRoot->createSceneManager(Ogre::ST_GENERIC); debugSceneMgr->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f)); Ogre::MaterialPtr frameLinesMaterial = Ogre::MaterialManager::getSingleton().create("frameLinesMaterial","Game"); frameLinesMaterial->setReceiveShadows(false); frameLinesMaterial->getTechnique(0)->setLightingEnabled(false); frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false); frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); mFrameLines = new FrameGraphRenderable(TimeGraphMaxFrames, TimeGraphMaxResolution); mFrameLines->setMaterial("frameLinesMaterial"); Ogre::SceneNode* frameLinesNode = debugSceneMgr->getRootSceneNode()->createChildSceneNode("frameGraph_node"); frameLinesNode->attachObject(mFrameLines); Ogre::Camera* dbg_camera = debugSceneMgr->createCamera("item_camera"); dbg_camera->setAspectRatio(static_cast<Ogre::Real>(TimeGraphMaxFrames) / static_cast<Ogre::Real>(TimeGraphMaxResolution)); Ogre::Viewport *v = tex->getBuffer()->getRenderTarget()->addViewport(dbg_camera); v->setClearEveryFrame( true ); v->setBackgroundColour( Ogre::ColourValue::Black ); CEGUI::Texture& guiTex = mCeRenderer->createTexture(tex); CEGUI::Imageset& imageSet = CEGUI::ImagesetManager::getSingleton().create("FrameGraphImageset", guiTex); imageSet.defineImage("FrameGraphImage", CEGUI::Point(0.0f, 0.0f), CEGUI::Size(guiTex.getSize()), CEGUI::Point(0.0f, 0.0f)); CEGUI::Window* si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "FrameGraphWindow"); si->setSize(CEGUI::UVector2(CEGUI::UDim(0.0f, TimeGraphMaxFrames), CEGUI::UDim(0.0f, TimeGraphMaxResolution))); si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(1.0f, -TimeGraphMaxResolution))); si->setProperty("Image", CEGUI::PropertyHelper::imageToString(&imageSet.getImage("FrameGraphImage"))); si->setAlpha(0.6f); si->setProperty("BackgroundEnabled", "False"); si->setProperty("FrameEnabled", "False"); sheet->addChildWindow(si); }
void Gui::cargarImagen(const string &imagen, const string &nombre) { CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingleton().createWindow("Menu/StaticImage", nombre); wMgrPtr->getWindow("Root")->addChildWindow(myImageWindow); myImageWindow->setPosition(CEGUI::UVector2( CEGUI::UDim( 0, 0 ), CEGUI::UDim( 0, 0 ) ) ); cout<<"h " << h << endl; float proporcion = (float)h / 1920; cout<<"proporcion " << proporcion << endl; int ancho = 944*proporcion; cout<<"ancho " << ancho << endl; myImageWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0,ancho),CEGUI::UDim(1,0))); myImageWindow->setProperty("Image",imagen); myImageWindow->setProperty("BackgroundEnabled", "true"); myImageWindow->setProperty("FrameEnabled", "False"); myImageWindow->setText("Prueba de texto dentro de la ventana"); myImageWindow->setTooltipText("Texto de la imagen"); myImageWindow->setAlpha(1.0); }
CEGUI::Window* TestAARHUD::CreateText(const std::string& name, CEGUI::Window* parent, const std::string& text, float x, float y, float width, float height) { CEGUI::WindowManager* wm = CEGUI::WindowManager::getSingletonPtr(); // create base window and set our default attribs CEGUI::Window* result = wm->createWindow("WindowsLook/StaticText", name); parent->addChildWindow(result); result->setText(text); result->setPosition(CEGUI::UVector2(cegui_absdim(x), cegui_absdim(y))); result->setSize(CEGUI::UVector2(cegui_absdim(width), cegui_absdim(height))); result->setProperty("FrameEnabled", "false"); result->setProperty("BackgroundEnabled", "false"); result->setHorizontalAlignment(CEGUI::HA_LEFT); result->setVerticalAlignment(CEGUI::VA_TOP); // set default color to white result->setProperty("TextColours", CEGUI::PropertyHelper::colourToString(CEGUI::colour(1.0f, 1.0f, 1.0f))); result->show(); return result; }
CEGUI::Window * Records::_createRecordEntry(const std::string name, const int &points, const int &number) { CEGUI::Window *container = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow"); std::ostringstream tempStream; std::string pointsString = Ogre::StringConverter::toString(points); CEGUI::Window *nameText = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText"); nameText->setProperty("Text", "[colour='" + _configValue<std::string>("font_color_record") + "']" + name); nameText->setProperty("Font", _configValue<std::string>("font_record")); nameText->setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}"); CEGUI::Window *pointsText = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText"); pointsText->setProperty("Text", "[colour='" + _configValue<std::string>("font_color_record") + "']" + pointsString); pointsText->setProperty("Font", _configValue<std::string>("font_record")); pointsText->setProperty("UnifiedAreaRect", "{{0, 370},{0,0},{1,0},{1,0}}"); container->addChildWindow(nameText); container->addChildWindow(pointsText); container->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 275), CEGUI::UDim(0, -300 + number * 60))); return container; }