CWorldManager::CWorldManager(SDL_Surface *screen, CInjectHandler *receiver) : in_battle(false), in_menu(false), exit(false), receiver(receiver), screen(screen) { //initializer list //temporary crap goes here player = new CPlayer("Player", 400,300); person_manager.push_back(player); player->addMonster(monsters().PLASTIC_RAT); CPerson *man = new CPerson("Hillbilly", 40,40); man->addMonster(monsters().PLASTIC_RAT); person_manager.push_back(man); //generate terrain test = new CImage(SDL_LoadBMP("res/2d/bkg/town_log.bmp"),0,0); root = (FrameWindow*)WindowManager::getSingleton().createWindow("DefaultWindow", "r" ); root->setPosition( UVector2( CEGUI::UDim(0,0), CEGUI::UDim(0,0) ) ) ; root->setSize( UVector2( cegui_reldim(1), cegui_reldim(1) ) ) ; // Disables the frame and standard background: //root->setProperty( "FrameEnabled", "false" ) ; //root->setProperty( "BackgroundEnabled", "false" ); System::getSingleton().setGUISheet( root ); game_menu = new CGameMenu(root); }
//----------------------------------------------------------------------------// void HorizontalLayoutContainer::layout() { // used to compare UDims const float absHeight = getChildWindowContentArea().getHeight(); // this is where we store the left offset // we continually increase this number as we go through the windows UDim leftOffset(0, 0); UDim layoutHeight(0, 0); for (ChildList::iterator it = d_children.begin(); it != d_children.end(); ++it) { Window* window = *it; const UVector2 offset = getOffsetForWindow(window); const UVector2 boundingSize = getBoundingSizeForWindow(window); // full child window width, including margins const UDim& childHeight = boundingSize.d_y; if (layoutHeight.asAbsolute(absHeight) < childHeight.asAbsolute(absHeight)) { layoutHeight = childHeight; } window->setPosition(offset + UVector2(leftOffset, UDim(0, 0))); leftOffset += boundingSize.d_x; } setSize(UVector2(leftOffset, layoutHeight)); }
PropertyHelper<URect>::return_type PropertyHelper<URect>::fromString(const String& str) { URect ur(UVector2(UDim(0.0f, 0.0f), UDim(0.0f, 0.0f)), UVector2(UDim(0.0f, 0.0f), UDim(0.0f, 0.0f))); if (str.empty()) return ur; std::stringstream& sstream = SharedStringstream::GetPreparedStream(str); sstream >> ur; if (sstream.fail()) throwParsingException(getDataTypeName(), str); return ur; }
//----------------------------------------------------------------------------// void VerticalLayoutContainer::layout() { // used to compare UDims const float absWidth = getChildContentArea().get().getWidth(); // this is where we store the top offset // we continually increase this number as we go through the windows UDim topOffset(0, 0); UDim layoutWidth(0, 0); for (ChildList::iterator it = d_children.begin(); it != d_children.end(); ++it) { Window* window = static_cast<Window*>(*it); const UVector2 offset = getOffsetForWindow(window); const UVector2 boundingSize = getBoundingSizeForWindow(window); // full child window width, including margins const UDim& childWidth = boundingSize.d_x; if (CoordConverter::asAbsolute(layoutWidth, absWidth) < CoordConverter::asAbsolute(childWidth, absWidth)) { layoutWidth = childWidth; } window->setPosition(offset + UVector2(UDim(0, 0), topOffset)); topOffset += boundingSize.d_y; } setSize(USize(layoutWidth, topOffset)); }
ItemDragContainer* ContainerContentWindow::createItemWindow(Item* item) { ItemDragContainer* itemhandler = getItemWindow(item); if( itemhandler ) return itemhandler; CeGuiString dragContainerName = mWindow->getName() + "/item/" + Ogre::StringConverter::toString(item->getId())+"_DragContainer"; itemhandler = dynamic_cast<ItemIconDragContainer*>( AbstractWindow::loadWindow("itemicondragcontainer.xml", dragContainerName)); //CEGUI::WindowManager::getSingleton().createWindow("ItemIconDragContainer", dragContainerName)); itemhandler->setItem(item); //itemhandler = new ItemIconDragContainer(item, dragContainerName); itemhandler->setDestroyListener(this); mItemDragContainerMap.insert(std::make_pair(item, itemhandler)); itemhandler->setItemParent(mContainer); itemhandler->setPosition(UVector2(cegui_reldim(0), cegui_reldim(0))); if( mInventoryWindow ) { itemhandler->subscribeEvent(DragContainer::EventDragStarted, boost::bind(&rl::InventoryWindow::showPossibleSlots, mInventoryWindow, item)); itemhandler->subscribeEvent(DragContainer::EventDragEnded, boost::bind(&InventoryWindow::showPossibleSlots, mInventoryWindow, (Item*)NULL)); } return itemhandler; }
/************************************************************************* Sets up sizes and positions for attached ItemEntry children. *************************************************************************/ void PopupMenu::layoutItemWidgets() { // get render area Rect render_rect = getItemRenderArea(); // get starting position const float x0 = PixelAligned(render_rect.d_left); float y0 = PixelAligned(render_rect.d_top); URect rect; UVector2 sz(cegui_absdim(PixelAligned(render_rect.getWidth())), cegui_absdim(0)); // set item width // iterate through all items attached to this window ItemEntryList::iterator item = d_listItems.begin(); while ( item != d_listItems.end() ) { // get the "optimal" height of the item and use that! sz.d_y.d_offset = PixelAligned((*item)->getItemPixelSize().d_height); // rounding errors ? // set destination rect rect.setPosition(UVector2(cegui_absdim(x0), cegui_absdim(y0)) ); rect.setSize( sz ); (*item)->setArea(rect); // next position y0 += PixelAligned(sz.d_y.d_offset + d_itemSpacing); item++; // next item } }
void ContainerContentWindow::initializeContent() { ItemSet items = mContainer->getItems(); for (ItemSet::const_iterator it = items.begin(); it != items.end(); it++) { Item* item = *it; Window* itemWindow = createItemWindow(item); std::pair<unsigned int, unsigned int> pos = mContainer->getItemPosition(item); itemWindow->setPosition( UVector2( cegui_absdim(pos.first*30), cegui_absdim(pos.second*30))); itemWindow->subscribeEvent( Window::EventMouseClick, boost::bind(&ContainerContentWindow::handleItemMouseClick, this, _1, item)); itemWindow->subscribeEvent( Window::EventMouseDoubleClick, boost::bind(&ContainerContentWindow::handleItemDoubleClick, this, _1, item)); mContentWindow->addChildWindow(itemWindow); } }
ContainerContentWindow::ContainerContentWindow(Container* container, InventoryWindow* parent) : AbstractWindow("containercontentwindow.xml", WIT_MOUSE_INPUT), mContainer(container), mInventoryWindow(parent) { mContentWindow = getWindow("ContainerContentWindow/Content"); mContentWindow->setUserData(container); mContentWindow->subscribeEvent( Window::EventDragDropItemDropped, boost::bind(&ContainerContentWindow::handleItemDroppedOnContainer, this, _1)); mContentWindow->subscribeEvent( Window::EventDragDropItemEnters, boost::bind(&ContainerContentWindow::handleItemEntersContainer, this, _1)); mContentWindow->subscribeEvent( Window::EventDragDropItemLeaves, boost::bind(&ContainerContentWindow::handleItemLeavesContainer, this, _1)); UVector2 size = UVector2( cegui_absdim(container->getVolume().first*30), cegui_absdim(container->getVolume().second*30)); mContentWindow->setSize(size); size.d_x += cegui_absdim(40); size.d_y += cegui_absdim(50); mContentWindow->getParent()->setMaxSize(size); mContentWindow->getParent()->setMinSize(size); initializeContent(); bindDestroyWindowToXButton(); }
//------------------------------------------------------------------------------// bool InventoryReceiver::addItemAtLocation(InventoryItem& item, int x, int y) { if (itemWillFitAtLocation(item, x, y)) { InventoryReceiver* old_receiver = dynamic_cast<InventoryReceiver*>(item.getParent()); if (old_receiver) old_receiver->removeItem(item); item.setLocationOnReceiver(x, y); writeItemToContentMap(item); addChild(&item); // set position and size. This ensures the items visually match the // logical content map. item.setPosition(UVector2(UDim(static_cast<float>(x) / contentWidth(), 0), UDim(static_cast<float>(y) / contentHeight(), 0))); item.setSize(USize( UDim(static_cast<float>(item.contentWidth()) / contentWidth(), 0), UDim(static_cast<float>(item.contentHeight()) / contentHeight(), 0))); return true; } return false; }
int wmain() { Graphics::Init(); Graphics::NewWindow(UVector2(1600u, 900u), UVector2(1600u, 900u), false, "Graphics Engine"); Graphics::NewCamera(); GameLoop gameLoop; gameLoop.Run(); Graphics::Quit(); return 0; }
bool CharacterSelectionWindow::update() { Party party = PartyManager::getSingleton().getCharacters(); while (party.size() > mCharacterWindows.size()) { Element* elem = new Element(this); mCharacterWindow->addChildWindow(elem->getWindow()); CEGUI::Size size = elem->getWindow()->getPixelSize(); size_t windowNum = mCharacterWindows.size(); elem->getWindow()->setPosition(UVector2(UDim(0, 0), UDim(0, windowNum * size.d_height))); elem->setVisible(true); elem->getWindow()->subscribeEvent( Window::EventMouseClick, boost::bind(&CharacterSelectionWindow::handleClickOnCharacter, this, windowNum)); mCharacterWindows.push_back(elem); } while (party.size() < mCharacterWindows.size()) { Element* elem = mCharacterWindows.back(); mCharacterWindows.pop_back(); mCharacterWindow->removeChildWindow(elem->getWindow()); delete elem; } for (unsigned int i = 0; i < party.size(); ++i) { mCharacterWindows[i]->setCreature(party[i]); } return true; }
void Tooltip::sizeSelf(void) { Size textSize(getTextSize()); setSize( UVector2(cegui_absdim(textSize.d_width), cegui_absdim(textSize.d_height))); }
//----------------------------------------------------------------------------// UVector2 LayoutContainer::getOffsetForWindow(Window* window) const { const UBox& margin = window->getMargin(); return UVector2( margin.d_left, margin.d_top ); }
HRESULT MainElement::Initialize(UVector2 Size) { setName("MainElement"); setLayer(0); m_elementPos = UVector2(0, 0); m_elementSize = Size; return S_OK; }
void IconBar::repositionIcons() { float accumulatedWidth(0); float maxHeight(0); for(IconBaseStore::iterator I(mIconBases.begin()); I != mIconBases.end(); ++I) { IconBase* icon = (*I); const UVector2& size = icon->getContainer()->getSize(); float absHeight = size.d_y.asAbsolute(0); float absWidth = size.d_x.asAbsolute(0); maxHeight = std::max<float>(maxHeight, absHeight); icon->getContainer()->setPosition(UVector2(UDim(0, accumulatedWidth), UDim(0,0))); accumulatedWidth += absWidth + mIconPadding; } accumulatedWidth -= mIconPadding; mWindow->setSize(UVector2(UDim(0, accumulatedWidth), UDim(0,maxHeight))); //We need to call this to guarantee that cegui correctly renders any newly added icons. mWindow->notifyScreenAreaChanged(); }
bool GuiConfig::handleConfigControlsBut(const CEGUI::EventArgs& e) { WindowEventArgs* evt = (WindowEventArgs*)&e; FrameWindow* wnd = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "BinderPopup"); wnd->setTitleBarEnabled(false); wnd->setCloseButtonEnabled(false); root->addChildWindow(wnd); wnd->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0.30f))); wnd->setSize(UVector2(cegui_reldim(1.1f), cegui_reldim( 0.15f))); wnd->setAlpha(0.88f); wnd->setMaxSize(UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f))); wnd->setMinSize(UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f))); Window* label2 = winMgr.createWindow("TaharezLook/StaticText", "BinderPopupLabel"); wnd->addChildWindow(label2); label2->setProperty("FrameEnabled", "false"); label2->setProperty("BackgroundEnabled", "false"); label2->setPosition(UVector2(cegui_reldim(0.10f), cegui_reldim( 0.1f))); label2->setSize(UVector2(cegui_reldim(0.8f), cegui_reldim( 0.8f))); label2->setText(GLoc->GetString("AskForInput").c_str()); winMgr.getWindow("Config Window")->setVisible(false); // mCurrentState = GUI_GETCONTROLBIND; mbControlBinding = true; mBindingButtonIndex = evt->window->getID(); return true; }
//----------------------------------------------------------------------------// LayoutContainer::LayoutContainer(const String& type, const String& name): Window(type, name), d_needsLayouting(false) { // layout should take the whole window by default I think setSize(UVector2(cegui_reldim(1), cegui_reldim(1))); subscribeEvent(Window::EventChildAdded, Event::Subscriber(&LayoutContainer::handleChildAdded, this)); subscribeEvent(Window::EventChildRemoved, Event::Subscriber(&LayoutContainer::handleChildRemoved, this)); }
/************************************************************************ Resize to fit content ************************************************************************/ void ItemListBase::sizeToContent_impl(void) { Rect renderArea(getItemRenderArea()); Rect wndArea(getArea().asAbsolute(getParentPixelSize())); // get size of content Size sz(getContentSize()); // calculate the full size with the frame accounted for and resize the window to this sz.d_width += wndArea.getWidth() - renderArea.getWidth(); sz.d_height += wndArea.getHeight() - renderArea.getHeight(); setSize(UVector2(cegui_absdim(sz.d_width), cegui_absdim(sz.d_height))); }
Window *DFMenuBase::getItem(const string &parentId) { createMyId(parentId); WindowManager &wmgr = WindowManager::getSingleton(); auto button = static_cast<PushButton *>(wmgr.createWindow( InterfaceConfig::schemeButtonMenus + "/Button", id)); button->setText(label); Font &font = FontManager::getSingleton().get(InterfaceConfig::menuButtonFont); button->setFont(&font); button->setSize(UVector2(UDim(0, InterfaceConfig::menuButtonWidth), UDim(0, InterfaceConfig::menuButtonHeight))); button->setMargin(UBox(UDim(0, InterfaceConfig::menuButtonMargin))); return button; }
/************************************************************************* Sets up sizes and positions for attached ItemEntry children. *************************************************************************/ void Menubar::layoutItemWidgets() { Rect render_rect = getItemRenderArea(); float x0 = PixelAligned(render_rect.d_left); URect rect; ItemEntryList::iterator item = d_listItems.begin(); while ( item != d_listItems.end() ) { const Size optimal = (*item)->getItemPixelSize(); (*item)->setVerticalAlignment(VA_CENTRE); rect.setPosition(UVector2(cegui_absdim(x0), cegui_absdim(0)) ); rect.setSize( UVector2( cegui_absdim(PixelAligned(optimal.d_width)), cegui_absdim(PixelAligned(optimal.d_height)))); (*item)->setArea(rect); x0 += optimal.d_width + d_itemSpacing; ++item; } }
//----------------------------------------------------------------------------// UVector2 LayoutContainer::getBoundingSizeForWindow(Window* window) const { const Sizef& pixelSize = window->getPixelSize(); // we rely on pixelSize rather than mixed absolute and relative getSize // this seems to solve problems when windows overlap because their size // is constrained by min size const UVector2 size(UDim(0, pixelSize.d_width), UDim(0, pixelSize.d_height)); // todo: we still do mixed absolute/relative margin, should we convert the // value to absolute? const UBox& margin = window->getMargin(); return UVector2( margin.d_left + size.d_x + margin.d_right, margin.d_top + size.d_y + margin.d_bottom ); }
void PushButton::resizeWithText() { Size size = getRenderSize(); setSize( Absolute, size ); Point newPos; newPos.d_x = m_ptHookPosition.d_x; newPos.d_y = m_ptHookPosition.d_y; switch( m_HookMode ) { case Hook_Left: newPos.d_y -= d_pixelSize.d_height / 2; break; case Hook_Right: newPos.d_x -= d_pixelSize.d_width; newPos.d_y -= d_pixelSize.d_height / 2; break; case Hook_Top: newPos.d_x -= d_pixelSize.d_width / 2; break; case Hook_Bottom: newPos.d_x -= d_pixelSize.d_width / 2; newPos.d_y -= d_pixelSize.d_height; break; case Hook_LeftTop: break; case Hook_LeftBottom: newPos.d_y -= d_pixelSize.d_height; break; case Hook_RightTop: newPos.d_x -= d_pixelSize.d_width; break; case Hook_RightBottom: newPos.d_x -= d_pixelSize.d_width; newPos.d_y -= d_pixelSize.d_height; break; case Hook_Center: newPos.d_x -= d_pixelSize.d_width / 2; newPos.d_y -= d_pixelSize.d_height / 2; break; default: break; } UVector2 relativePos; d_area.setPosition( UVector2(cegui_absdim(PixelAligned(newPos.d_x)), cegui_absdim(PixelAligned( newPos.d_y) ) ) ); }
bool ContainerContentWindow::handleItemDroppedOnContainer(const EventArgs& evt) { const DragDropEventArgs& evtArgs = static_cast<const DragDropEventArgs&>(evt); if (evtArgs.dragDropItem->testClassName("ItemDragContainer")) { ItemDragContainer* dragcont = dynamic_cast<ItemDragContainer*>( evtArgs.dragDropItem); Item* item = dragcont->getItem(); CEGUI::Vector2 relPos = evtArgs.dragDropItem->getPosition().asAbsolute(evtArgs.dragDropItem->getParentPixelSize()) - mContentWindow->getPosition().asAbsolute(mContentWindow->getParentPixelSize()); int x = relPos.d_x, y = relPos.d_y; // übergangspixel x += 14; y += 14; x = x / 30; y = y / 30; if( mContainer->addItem(item,IntPair(x,y)) ) { if( dragcont != getItemWindow(item) ) { CEGUI::WindowManager::getSingleton().destroyWindow(dragcont); //dragcont->destroyWindow(); dragcont = createItemWindow(item); mContentWindow->addChildWindow(dragcont); } std::pair<unsigned int, unsigned int> pos = mContainer->getItemPosition(item); dragcont->setPosition( UVector2( cegui_absdim(pos.first*30), cegui_absdim(pos.second*30))); dragcont->setItemParent(mContainer); handleItemLeavesContainer(evt); return true; } } handleItemLeavesContainer(evt); return false; }
/************************************************************************ Initialise ************************************************************************/ void ScrolledItemListBase::initialiseComponents() { // Only process the content pane if it hasn't been done in the past // NOTE: This ensures that a duplicate content pane is not created. An example where // this would be possible would be when changing the Look'N'Feel of the widget // (for instance an ItemListBox), an operation which would reconstruct the child components // of the widget by destroying the previous ones and creating new ones with the // new Look'N'Feel. However, since the content pane is not defined in the // look and feel file and thus not associated with the look'N'Feel itself // but instead created here manually, the destruction would not contemplate the content // pane itself, so when the children would be rebuilt, a duplicate content pane // would be attempted (and an exception would be issued). if(!d_pane) { // IMPORTANT: // we must do this before the base class handling or we'll lose the onChildRemoved subscriber!!! d_pane = WindowManager::getSingletonPtr()->createWindow("ClippedContainer", d_name+ContentPaneNameSuffix); // set up clipping static_cast<ClippedContainer*>(d_pane)->setClipperWindow(this); addChildWindow(d_pane); } // base class handling ItemListBase::initialiseComponents(); // set default pane position Rect r = getItemRenderArea(); d_pane->setPosition(UVector2(cegui_absdim(r.d_left),cegui_absdim(r.d_top))); // init scrollbars Scrollbar* v = getVertScrollbar(); Scrollbar* h = getHorzScrollbar(); v->setAlwaysOnTop(true); h->setAlwaysOnTop(true); v->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(&ScrolledItemListBase::handle_VScroll,this)); h->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(&ScrolledItemListBase::handle_HScroll,this)); v->hide(); h->hide(); }
//----------------------------------------------------------------------------// void ScrollablePane::initialiseComponents(void) { // get horizontal scrollbar Scrollbar* horzScrollbar = getHorzScrollbar(); // get vertical scrollbar Scrollbar* vertScrollbar = getVertScrollbar(); // get scrolled container widget ScrolledContainer* container = getScrolledContainer(); // do a bit of initialisation horzScrollbar->setAlwaysOnTop(true); vertScrollbar->setAlwaysOnTop(true); // container pane is always same size as this parent pane, // scrolling is actually implemented via positioning and clipping tricks. container->setSize(UVector2(cegui_reldim(1.0f), cegui_reldim(1.0f))); // subscribe to events we need to hear about vertScrollbar->subscribeEvent( Scrollbar::EventScrollPositionChanged, Event::Subscriber(&ScrollablePane::handleScrollChange, this)); horzScrollbar->subscribeEvent( Scrollbar::EventScrollPositionChanged, Event::Subscriber(&ScrollablePane::handleScrollChange, this)); d_contentChangedConn = container->subscribeEvent( ScrolledContainer::EventContentChanged, Event::Subscriber(&ScrollablePane::handleContentAreaChange, this)); d_autoSizeChangedConn = container->subscribeEvent( ScrolledContainer::EventAutoSizeSettingChanged, Event::Subscriber(&ScrollablePane::handleAutoSizePaneChanged, this)); // finalise setup configureScrollbars(); }
void Tooltip::positionSelf(void) { MouseCursor& cursor = MouseCursor::getSingleton(); Rect screen(Vector2(0, 0), System::getSingleton().getRenderer()->getDisplaySize()); Rect tipRect(getUnclippedOuterRect()); const Image* mouseImage = cursor.getImage(); Point mousePos(cursor.getPosition()); Size mouseSz(0,0); if (mouseImage) { mouseSz = mouseImage->getSize(); } Point tmpPos(mousePos.d_x + mouseSz.d_width, mousePos.d_y + mouseSz.d_height); tipRect.setPosition(tmpPos); // if tooltip would be off the right of the screen, // reposition to the other side of the mouse cursor. if (screen.d_right < tipRect.d_right) { tmpPos.d_x = mousePos.d_x - tipRect.getWidth() - 5; } // if tooltip would be off the bottom of the screen, // reposition to the other side of the mouse cursor. if (screen.d_bottom < tipRect.d_bottom) { tmpPos.d_y = mousePos.d_y - tipRect.getHeight() - 5; } // set final position of tooltip window. setPosition( UVector2(cegui_absdim(tmpPos.d_x), cegui_absdim(tmpPos.d_y))); }
HRESULT MainMenu::initialize() { setDimensions(UVector2(225, 100), UVector2(350, 470)); setName("MainMenu"); Font standardFont; Texture fontTexture; Surface()->loadTexture(fontTexture, "ui\\standardFont.png"); if(FAILED(standardFont.initialize("..\\data\\userinterface\\standardfont.ini", fontTexture, 20))) return E_FAIL; //Initialize buttons (children) m_pStartSPButton.initialize(this, "btnStartSP", "ui\\standardButton.png"); m_pStartSPButton.setDimensions(UVector2(40, 130), UVector2(250, 50)); m_pStartSPButton.setText("Singleplayer", standardFont); m_pStartMPButton.initialize(this, "btnStartMP", "ui\\standardButton.png"); m_pStartMPButton.setDimensions(UVector2(40, 130 + 55), UVector2(250, 50)); m_pStartMPButton.setText("Multiplayer", standardFont); m_pEditorButton.initialize(this, "btnEditor", "ui\\standardButton.png"); m_pEditorButton.setDimensions(UVector2(40, 130 + 110), UVector2(250, 50)); m_pEditorButton.setText("Editor", standardFont); m_pOptionsButton.initialize(this, "btnOptions", "ui\\standardButton.png"); m_pOptionsButton.setDimensions(UVector2(40, 130 + 165), UVector2(250, 50)); m_pOptionsButton.setText("Options", standardFont); m_pQuitButton.initialize(this, "btnQuit", "ui\\standardButton.png"); m_pQuitButton.setDimensions(UVector2(40, 130 + 220), UVector2(250, 50)); m_pQuitButton.setText("Quit", standardFont); //Initialize background m_sprite.pos = m_elementPos; m_sprite.size = m_elementSize; m_sprite.uLayer = m_elementLayer; m_sprite.texCoord = glm::vec2(0.0f, 0.0f); m_sprite.texSize = glm::vec2(1.0f, 1.0f); m_sprite.color = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f); Surface()->loadTexture(m_sprite.texture, "ui\\mainMenu.png"); return S_OK; }
void GuiProgress::Build(ZProtoGUI *pGUI) { #if CEGUI_VERSION_MINOR <= 6 ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim00", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0000.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim01", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0001.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim02", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0002.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim03", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0003.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim04", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0004.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim05", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0005.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim06", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0006.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim07", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0007.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim08", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0008.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim09", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0009.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim10", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0010.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim11", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0011.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim12", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0012.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim13", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0013.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim14", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0014.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("LoadingAnim15", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0015.tga"); ImagesetManager::getSingleton().createImagesetFromImageFile("BackUniform", "./Prototype/Common/Menu/backuniform.tga"); #else ImagesetManager::getSingleton().createFromImageFile("LoadingAnim00", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0000.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim01", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0001.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim02", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0002.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim03", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0003.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim04", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0004.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim05", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0005.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim06", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0006.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim07", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0007.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim08", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0008.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim09", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0009.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim10", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0010.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim11", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0011.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim12", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0012.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim13", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0013.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim14", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0014.tga"); ImagesetManager::getSingleton().createFromImageFile("LoadingAnim15", "./Prototype/Common/Menu/LoadingAnim/LoadingAnim0015.tga"); ImagesetManager::getSingleton().createFromImageFile("BackUniform", "./Prototype/Common/Menu/backuniform.tga"); #endif mGUI = (ZProtoGUI*)pGUI; root = mGUI->root; mFontArial8 = mGUI->mFontArial8; mFontArial24 = mGUI->mFontArial24; mLoadingfrm = winMgr.createWindow("TaharezLook/FrameWindow", "LOADING_wnd"); root->addChildWindow(mLoadingfrm); mLoadingfrm->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0.72f))); mLoadingfrm->setSize(UVector2(cegui_reldim(1.1f), cegui_reldim( 0.18f))); ((FrameWindow*)mLoadingfrm)->setTitleBarEnabled(false); ((FrameWindow*)mLoadingfrm)->setCloseButtonEnabled(false); mLoadingfrm->setAlpha(0.88f); backuniform = winMgr.createWindow("TaharezLook/StaticImage", "backuniform"); backuniform->setPosition(UVector2(cegui_reldim(0.f), cegui_reldim( 0.0f))); backuniform->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f))); backuniform->setProperty("FrameEnabled", "false"); backuniform->setProperty("BackgroundEnabled", "false"); backuniform->setAlpha(0.25f); backuniform->setProperty("Image", "set:BackUniform image:full_image"); root->addChildWindow(backuniform); Window *loadingAnim = winMgr.createWindow("TaharezLook/StaticImage", "loadingAnimWnd"); loadingAnim->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.0f))); loadingAnim->setSize(UVector2(cegui_reldim(0.08f), cegui_reldim( 1.f))); loadingAnim->setProperty("FrameEnabled", "false"); loadingAnim->setProperty("BackgroundEnabled", "false"); loadingAnim->setAlpha(1.f); loadingAnim->setProperty("Image", "set:LoadingAnim00 image:full_image"); mLoadingfrm->addChildWindow(loadingAnim); Window* label2 = winMgr.createWindow("TaharezLook/StaticText", "LOADING/Loading"); mLoadingfrm->addChildWindow(label2); label2->setProperty("FrameEnabled", "false"); label2->setProperty("BackgroundEnabled", "false"); label2->setPosition(UVector2(cegui_reldim(0.14f), cegui_reldim( 0.05f))); label2->setSize(UVector2(cegui_reldim(0.8f), cegui_reldim( 0.5f))); label2->setText(GLoc->GetString("NINENINELOADING").c_str()); label2->setFont(mFontArial24); label2->setProperty("TextColours","tl:FF161616 tr:FF161616 bl:FF161616 br:FF161616"); //((Text*)label2)->setColor(); trckNfo = winMgr.createWindow("TaharezLook/StaticText", "LOADING/mapname"); mLoadingfrm->addChildWindow(trckNfo); trckNfo->setProperty("FrameEnabled", "false"); trckNfo->setProperty("BackgroundEnabled", "false"); trckNfo->setPosition(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.5f))); trckNfo->setSize(UVector2(cegui_reldim(0.8f), cegui_reldim( 0.5f))); trckNfo->setFont(mFontArial8); trckNfo->setHorizontalAlignment(HA_RIGHT); trckNfo->setProperty("TextColours","tl:FF161616 tr:FF161616 bl:FF161616 br:FF161616"); mLoadingfrm->hide(); }
void GuiConfig::Build(ZProtoGUI *pGUI) { mGUI = (ZProtoGUI*)pGUI; root = mGUI->root; mFontArial8 = mGUI->mFontArial8; mFontArial24 = mGUI->mFontArial24; // Create a FrameWindow in the TaharezLook style, and name it 'Demo Window' mCondigWindow = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Config Window"); mCondigWindow->setTitleBarEnabled(false); mCondigWindow->setCloseButtonEnabled(false); mCondigWindow->setSizingEnabled(false); root->addChildWindow(mCondigWindow); mCondigWindow->setAlpha(0.6f); mCondigWindow ->hide(); mCondigWindow->setSizingEnabled(false); FrameWindow* wnd1 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage0"); wnd1->setTitleBarEnabled(false); wnd1->setFrameEnabled(false);//>setTitleBarEnabled(false); wnd1->setCloseButtonEnabled(false); wnd1->setText(GLoc->GetString("PLAYER").c_str()); FrameWindow* wnd2 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage1"); wnd2->setTitleBarEnabled(false); wnd2->setFrameEnabled(false);//>setTitleBarEnabled(false); wnd2->setCloseButtonEnabled(false); wnd2->setText(GLoc->GetString("Controls").c_str()); FrameWindow* wnd3 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage2"); wnd3->setTitleBarEnabled(false); wnd3->setCloseButtonEnabled(false); wnd3->setText(GLoc->GetString("Graphics").c_str()); wnd3->setFrameEnabled(false);// FrameWindow* wnd4 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage3"); wnd4->setTitleBarEnabled(false); wnd4->setFrameEnabled(false);//>setTitleBarEnabled(false); wnd4->setCloseButtonEnabled(false); wnd4->setText(GLoc->GetString("SOUND").c_str()); //wnd->addChildWindow (winMgr.loadWindowLayout ("TabControlDemo.layout", "TabControlDemo/")); TabControl *tc = (TabControl *)winMgr.createWindow("TaharezLook/TabControl", "Config/Tabs"); mCondigWindow->setPosition(UVector2(cegui_reldim(0.f), cegui_reldim( 0.f))); mCondigWindow->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 0.9f))); tc->setArea(UVector2(cegui_reldim(0.1f), cegui_reldim( 0.05f)), UVector2(cegui_reldim(0.9f), cegui_reldim( 0.85f)) ); // Add some pages to tab control tc->addTab (wnd1); tc->addTab (wnd2); tc->addTab (wnd3); tc->addTab (wnd4); tc->setTabHeight(UDim (0.06f, 0.13f)); tc->setTabTextPadding(UDim (0.06f, 0.1f)); mCondigWindow->addChildWindow(tc); mCondigWindow->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0.15f))); mCondigWindow->setSize(UVector2(cegui_reldim(1.1f), cegui_reldim( 0.70f))); mCondigWindow->setAlpha(0.88f); wnd1->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f))); wnd1->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f))); wnd2->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f))); wnd2->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f))); wnd3->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f))); wnd3->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f))); wnd4->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f))); wnd4->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f))); // controls for (int allCtrl = 0;allCtrl<sizeof(aCtrlList)/sizeof(CTRLEntry); allCtrl++) { static const float interligne = 0.06f*1.6f; static const float intersize = 0.05f*1.4f; tstring numb; numb.Printf("%d", allCtrl); Window* txtlib = winMgr.createWindow("TaharezLook/StaticText", String(aCtrlList[allCtrl].mName)+String("CtrlLib")+String(numb.c_str())); txtlib->setText(GLoc->GetString(aCtrlList[allCtrl].mName).c_str()); txtlib->setProperty("FrameEnabled", "false"); txtlib->setProperty("BackgroundEnabled", "false"); //txtlib->setHorizontalAlignment(HA_CENTRE); txtlib->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.01f + interligne*allCtrl))); txtlib->setSize(UVector2(cegui_reldim(0.19f), cegui_reldim( intersize ))); wnd2->addChildWindow(txtlib); PushButton* txtBut = (PushButton*)winMgr.createWindow("TaharezLook/Button", String(aCtrlList[allCtrl].mName)+String("CtrlBut")+String(numb.c_str())); txtBut->setPosition(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.01f + interligne*allCtrl))); txtBut->setSize(UVector2(cegui_reldim(0.50f), cegui_reldim( intersize ))); SetBindedControlString(allCtrl, txtBut); //txtBut->setText("A or PAD Button 1"); txtBut->setHorizontalAlignment(HA_CENTRE); wnd2->addChildWindow(txtBut); txtBut->subscribeEvent ( PushButton::EventClicked, Event::Subscriber (&GuiConfig::handleConfigControlsBut, this)); txtBut->setID(allCtrl); aCtrlList[allCtrl].mWindow = (Window*)txtBut; } // -- PLAYER Editbox* playerName = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "CONFIGPLAYERNAME")); wnd1->addChildWindow(playerName); playerName->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f))); playerName->setSize(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.08f))); //playerName->setValidationString("*"); playerName->setText(GConfig->GetPlayerName()); Window* txtlib = winMgr.createWindow("TaharezLook/StaticText", "CONFIGPLAYERNAMESTATIC"); txtlib->setText(GLoc->GetString("PLAYERNAME").c_str()); txtlib->setProperty("FrameEnabled", "false"); txtlib->setProperty("BackgroundEnabled", "false"); txtlib->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f))); txtlib->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd1->addChildWindow(txtlib); // -- // -- SOUND Scrollbar* sfxslider = static_cast<Scrollbar*>(winMgr.createWindow("TaharezLook/HorizontalScrollbar", "SFXVOLUME")); sfxslider->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f))); sfxslider->setSize(UVector2(cegui_reldim(0.6f), cegui_reldim( 0.08f))); sfxslider->setDocumentSize (100); sfxslider->subscribeEvent ( Scrollbar::EventScrollPositionChanged, Event::Subscriber (&GuiConfig::handleSFXVolChanged, this)); sfxslider->setScrollPosition(float(GConfig->GetQuality("SFXVOLUME"))); wnd4->addChildWindow(sfxslider); Window* txtlibsfx = winMgr.createWindow("TaharezLook/StaticText", "SFXVOLUMESTATIC"); txtlibsfx->setText(GLoc->GetString("SFXVOLUME").c_str()); txtlibsfx->setProperty("FrameEnabled", "false"); txtlibsfx->setProperty("BackgroundEnabled", "false"); txtlibsfx->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f))); txtlibsfx->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd4->addChildWindow(txtlibsfx); Scrollbar* musicslider = static_cast<Scrollbar*>(winMgr.createWindow("TaharezLook/HorizontalScrollbar", "MUSICVOLUME")); musicslider->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.15f))); musicslider->setSize(UVector2(cegui_reldim(0.6f), cegui_reldim( 0.08f))); musicslider->setDocumentSize (100); musicslider->subscribeEvent ( Scrollbar::EventScrollPositionChanged, Event::Subscriber (&GuiConfig::handleMusicVolChanged, this)); musicslider->setScrollPosition(float(GConfig->GetQuality("MUSICVOLUME"))); wnd4->addChildWindow(musicslider); Window* txtlibmusic = winMgr.createWindow("TaharezLook/StaticText", "MUSICVOLUMESTATIC"); txtlibmusic->setText(GLoc->GetString("MUSICVOLUME").c_str()); txtlibmusic->setProperty("FrameEnabled", "false"); txtlibmusic->setProperty("BackgroundEnabled", "false"); txtlibmusic->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.15f))); txtlibmusic->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd4->addChildWindow(txtlibmusic); Checkbox* checkMusic = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKMUSIC")); wnd4->addChildWindow(checkMusic); checkMusic->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.25f))); checkMusic->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); checkMusic->setText(GLoc->GetString("CHKMUSIC").c_str()); checkMusic->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleChkMusicChanged, this)); checkMusic->setSelected (GConfig->IsEnable("CHKMUSIC")); // -- // -- VIDEO Combobox* cbresolution = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "RESOLUTION")); wnd3->addChildWindow(cbresolution); cbresolution->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f))); cbresolution->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.75f))); cbresolution->setReadOnly(true); Window* txtres = winMgr.createWindow("TaharezLook/StaticText", "RESOLUTIONTXT"); txtres->setText(GLoc->GetString("RESOLUTION").c_str()); txtres->setProperty("FrameEnabled", "false"); txtres->setProperty("BackgroundEnabled", "false"); txtres->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f))); txtres->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd3->addChildWindow(txtres); int optWidth = GConfig->GetQuality("Width"); int optHeight = GConfig->GetQuality("Height"); int awidth = -1, aheight = -1; int avresolutions = 0; for (unsigned int rs = 0;rs<GDD->GetNbPossibleResolutions(); rs++) { char tmps[512]; int width, height; GDD->GetResolution(rs, width, height); if ((awidth != width) || (aheight != height)) { awidth = width; aheight = height; mResolutions.push_back(resval_t(width, height)); snprintf(tmps, 512, "%d x %d", width, height); cbresolution->addItem (new ListboxTextItem(tmps)); if ((width == optWidth)&&(height == optHeight)) CEGUICBSel(cbresolution, avresolutions); avresolutions++; } } // -- Checkbox* checkFS = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKBFS")); wnd3->addChildWindow(checkFS); checkFS->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.15f))); checkFS->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); checkFS->setText(GLoc->GetString("FULLSCREEN").c_str()); //checkFS->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleFSChanged, this)); checkFS->setSelected (GConfig->IsEnable("CHKBFS")); Checkbox* checkVSync = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKBVSYNC")); wnd3->addChildWindow(checkVSync); checkVSync->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.75f))); checkVSync->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); checkVSync->setText(GLoc->GetString("VSYNC").c_str()); //checkVSync->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleVSYNCChanged, this)); checkVSync->setSelected (GConfig->IsEnable("CHKBVSYNC")); // -- Combobox* cbshad = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "SHADOWQUALITY")); wnd3->addChildWindow(cbshad); cbshad->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.25f))); cbshad->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f))); cbshad->setReadOnly(true); Window* txtshad = winMgr.createWindow("TaharezLook/StaticText", "SHADOWQUALITYTXT"); txtshad->setText(GLoc->GetString("SHADOWQUALITY").c_str()); txtshad->setProperty("FrameEnabled", "false"); txtshad->setProperty("BackgroundEnabled", "false"); txtshad->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.25f))); txtshad->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd3->addChildWindow(txtshad); cbshad->addItem (new ListboxTextItem(GLoc->GetString("DISABLED").c_str())); cbshad->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str())); cbshad->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str())); cbshad->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str())); cbshad->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleShadowQualityChanged, this)); CEGUICBSel(cbshad, GConfig->GetQuality("SHADOWQUALITY")); // -- Combobox* cbrefl = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "REFLECTIONQUALITY")); wnd3->addChildWindow(cbrefl); cbrefl->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.35f))); cbrefl->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f))); cbrefl->setReadOnly(true); Window* txtrefl = winMgr.createWindow("TaharezLook/StaticText", "REFLECTIONQUALITYTXT"); txtrefl->setText(GLoc->GetString("REFLECTIONQUALITY").c_str()); txtrefl->setProperty("FrameEnabled", "false"); txtrefl->setProperty("BackgroundEnabled", "false"); txtrefl->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.35f))); txtrefl->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd3->addChildWindow(txtrefl); cbrefl->addItem (new ListboxTextItem(GLoc->GetString("DISABLED").c_str())); cbrefl->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str())); cbrefl->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str())); cbrefl->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str())); cbrefl->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleReflectionQualityChanged, this)); CEGUICBSel(cbrefl, GConfig->GetQuality("REFLECTIONQUALITY")); // -- Combobox* cbwater = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "WATERQUALITY")); wnd3->addChildWindow(cbwater); cbwater->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.45f))); cbwater->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f))); cbwater->setReadOnly(true); Window* txtwater = winMgr.createWindow("TaharezLook/StaticText", "WATERQUALITYTXT"); txtwater->setText(GLoc->GetString("WATERQUALITY").c_str()); txtwater->setProperty("FrameEnabled", "false"); txtwater->setProperty("BackgroundEnabled", "false"); txtwater->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.45f))); txtwater->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); wnd3->addChildWindow(txtwater); cbwater->addItem (new ListboxTextItem(GLoc->GetString("LOW").c_str())); cbwater->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str())); cbwater->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str())); cbwater->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str())); cbwater->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleWaterQualityChanged, this)); CEGUICBSel(cbwater, GConfig->GetQuality("WATERQUALITY")); // -- Checkbox* checkDOF = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKDOF")); wnd3->addChildWindow(checkDOF); checkDOF->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.55f))); checkDOF->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); checkDOF->setText(GLoc->GetString("DEPTHOFFIELD").c_str()); checkDOF->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleDOFChanged, this)); checkDOF->setSelected (GConfig->IsEnable("CHKDOF")); Checkbox* checkMBLUR = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKMBLUR")); wnd3->addChildWindow(checkMBLUR); checkMBLUR->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.65f))); checkMBLUR->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f ))); checkMBLUR->setText(GLoc->GetString("MOTIONBLUR").c_str()); checkMBLUR->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleMBLURChanged, this)); checkMBLUR->setSelected (GConfig->IsEnable("CHKMBLUR")); /* Resolution Enable FullScreen shadows quality (disabled, medium, high, ultrahigh) 0, 1024, 2048, 4096 reflection quality (disabled, low, medium, high) 0, 256, 512, 1024 water quality (low, medium, high, ultra high) enable Depth of field enable motion blur */ // -- PushButton* btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "configOK")); mCondigWindow->addChildWindow(btn); btn->setPosition(UVector2(cegui_reldim(0.77f), cegui_reldim( 0.90f))); btn->setSize(UVector2(cegui_reldim(0.20f), cegui_reldim( 0.065f))); btn->setText("OK"); btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GuiConfig::HandleConfigOK, this)); }
//----------------------------------------------------------------------------// void Element::addElementProperties() { const String propertyOrigin("Element"); CEGUI_DEFINE_PROPERTY(Element, URect, "Area", "Property to get/set the unified area rectangle. Value is a \"URect\".", &Element::setArea, &Element::getArea, URect(UDim(0, 0), UDim(0, 0), UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY_NO_XML(Element, UVector2, "Position", "Property to get/set the unified position. Value is a \"UVector2\".", &Element::setPosition, &Element::getPosition, UVector2(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, VerticalAlignment, "VerticalAlignment", "Property to get/set the vertical alignment. Value is one of \"Top\", \"Centre\" or \"Bottom\".", &Element::setVerticalAlignment, &Element::getVerticalAlignment, VA_TOP ); CEGUI_DEFINE_PROPERTY(Element, HorizontalAlignment, "HorizontalAlignment", "Property to get/set the horizontal alignment. Value is one of \"Left\", \"Centre\" or \"Right\".", &Element::setHorizontalAlignment, &Element::getHorizontalAlignment, HA_LEFT ); CEGUI_DEFINE_PROPERTY_NO_XML(Element, USize, "Size", "Property to get/set the unified size. Value is a \"USize\".", &Element::setSize, &Element::getSize, USize(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, USize, "MinSize", "Property to get/set the unified minimum size. Value is a \"USize\".", &Element::setMinSize, &Element::getMinSize, USize(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, USize, "MaxSize", "Property to get/set the unified maximum size. Value is a \"USize\". " "Note that zero means no maximum size.", &Element::setMaxSize, &Element::getMaxSize, USize(UDim(0, 0), UDim(0, 0)) ); CEGUI_DEFINE_PROPERTY(Element, AspectMode, "AspectMode", "Property to get/set the 'aspect mode' setting. Value is either \"Ignore\", \"Shrink\" or \"Expand\".", &Element::setAspectMode, &Element::getAspectMode, AM_IGNORE ); CEGUI_DEFINE_PROPERTY(Element, float, "AspectRatio", "Property to get/set the aspect ratio. Only applies when aspect mode is not \"Ignore\".", &Element::setAspectRatio, &Element::getAspectRatio, 1.0 / 1.0 ); CEGUI_DEFINE_PROPERTY(Element, bool, "PixelAligned", "Property to get/set whether the Element's size and position should be pixel aligned. " "Value is either \"True\" or \"False\".", &Element::setPixelAligned, &Element::isPixelAligned, true ); CEGUI_DEFINE_PROPERTY(Element, Quaternion, "Rotation", "Property to get/set the Element's rotation. Value is a quaternion: " "\"w:[w_float] x:[x_float] y:[y_float] z:[z_float]\"" "or \"x:[x_float] y:[y_float] z:[z_float]\" to convert from Euler angles (in degrees).", &Element::setRotation, &Element::getRotation, Quaternion(1.0,0.0,0.0,0.0) ); CEGUI_DEFINE_PROPERTY(Element, bool, "NonClient", "Property to get/set whether the Element is 'non-client'. " "Value is either \"True\" or \"False\".", &Element::setNonClient, &Element::isNonClient, false ); }