本文整理汇总了C++中cegui::Window::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::setProperty方法的具体用法?C++ Window::setProperty怎么用?C++ Window::setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::setProperty方法的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: tick
void CCreditosState::tick(unsigned int msecs)
{
CApplicationState::tick(msecs);
CEGUI::Window* creditos = CEGUI::System::getSingletonPtr()->getDefaultGUIContext().getRootWindow()->getChild("texto");
float y = creditos->getArea().getPosition().d_y.d_scale;
float alt = y + creditos->getArea().getHeight().d_scale;
float x = creditos->getArea().getPosition().d_x.d_scale;
float ancho = x + creditos->getArea().getWidth().d_scale;
creditos->setProperty("Area","{{"+std::to_string(x)+
",0},{"+std::to_string(y-0.0008)+",0},{"+std::to_string(ancho)+",0},{"
+std::to_string(alt-0.0008)+",0}}");
creditos = CEGUI::System::getSingletonPtr()->getDefaultGUIContext().getRootWindow()->getChild("sai");
y = creditos->getArea().getPosition().d_y.d_scale;
alt = y + creditos->getArea().getHeight().d_scale;
x = creditos->getArea().getPosition().d_x.d_scale;
ancho = x + creditos->getArea().getWidth().d_scale;
creditos->setProperty("Area","{{"+std::to_string(x)+
",0},{"+std::to_string(y-0.0008)+",0},{"+std::to_string(ancho)+",0},{"
+std::to_string(alt-0.0008)+",0}}");
} // tick
示例3: initialiseEventLights
void WidgetDemo::initialiseEventLights(CEGUI::Window* container)
{
CEGUI::WindowManager &winMgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* horizontalLayout = winMgr.createWindow("HorizontalLayoutContainer", "EventLightsContainer");
horizontalLayout->setPosition(CEGUI::UVector2(cegui_reldim(0.085f), cegui_reldim(0.93f)));
container->addChild(horizontalLayout);
d_windowLightUpdatedEvent = winMgr.createWindow("SampleBrowserSkin/Light");
horizontalLayout->addChild(d_windowLightUpdatedEvent);
d_windowLightUpdatedEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f)));
d_windowLightUpdatedEvent->setAspectMode(CEGUI::AM_EXPAND);
d_windowLightUpdatedEvent->setProperty("LightColour", "FF66FF66");
CEGUI::Window* updateEventLabel = winMgr.createWindow("Vanilla/Label");
horizontalLayout->addChild(updateEventLabel);
updateEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f)));
updateEventLabel->setText("EventUpdated");
updateEventLabel->setFont("DejaVuSans-12-NoScale");
updateEventLabel->setProperty("HorzFormatting", "LeftAligned");
d_windowLightMouseMoveEvent = winMgr.createWindow("SampleBrowserSkin/Light");
horizontalLayout->addChild(d_windowLightMouseMoveEvent);
d_windowLightMouseMoveEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f)));
d_windowLightMouseMoveEvent->setAspectMode(CEGUI::AM_EXPAND);
d_windowLightMouseMoveEvent->setProperty("LightColour", "FF77BBFF");
CEGUI::Window* mouseMoveEventLabel = winMgr.createWindow("Vanilla/Label");
horizontalLayout->addChild(mouseMoveEventLabel);
mouseMoveEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f)));
mouseMoveEventLabel->setText("EventMouseMove");
mouseMoveEventLabel->setFont("DejaVuSans-12-NoScale");
mouseMoveEventLabel->setProperty("HorzFormatting", "LeftAligned");
}
示例4:
// GUIText
_MEMBER_FUNCTION_IMPL(GUIText, constructor)
{
// Get our GUI
CGUI * pGUI = g_pClient->GetGUI();
CEGUI::Window * pWindow = pGUI->CreateGUIStaticText();
if(!pWindow || SQ_FAILED(sq_setinstance(pVM, pWindow)))
{
CLogFile::Printf("Can't create GUIText.");
sq_pushbool(pVM, false);
return 1;
}
//_SET_RELEASE_HOOK(GUIElement);
CClientScriptManager * pClientScriptManager = g_pClient->GetClientScriptManager();
pClientScriptManager->GetGUIManager()->Add(pWindow, pClientScriptManager->GetScriptingManager()->Get(pVM));
pWindow->setVisible(true);
pWindow->setProperty("FrameEnabled", "false");
pWindow->setProperty("BackgroundEnabled", "false");
pWindow->setFont(pGUI->GetFont("tahoma-bold"));
pWindow->setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
SubscribeGuiEvents(pWindow);
sq_pushbool(pVM, true);
return 1;
}
示例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:
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;
}
示例8: setupGUI
void
setupGUI(){
CEGUI::WindowFactoryManager::addFactory<CEGUI::TplWindowFactory<AlphaHitWindow> >();
CEGUI::OgreRenderer::bootstrapSystem();
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
myRoot->setProperty("MousePassThroughEnabled", "True");
CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( myRoot );
CEGUI::SchemeManager::getSingleton().createFromFile("Thrive.scheme");
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("ThriveGeneric/MouseArrow");
//For demos:
CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("SampleBrowser.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("OgreTray.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("GameMenu.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("AlfiskoSkin.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("VanillaSkin.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("Generic.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("VanillaCommonDialogs.scheme");
CEGUI::ImageManager::getSingleton().loadImageset("DriveIcons.imageset");
CEGUI::ImageManager::getSingleton().loadImageset("GameMenu.imageset");
CEGUI::ImageManager::getSingleton().loadImageset("HUDDemo.imageset");
}
示例9: init
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);
}
示例10: CGUIOverlay
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);
}
}
示例11:
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);
}
示例12: spawnPlate
CEGUI::Window* HUDDemo::spawnPlate()
{
CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* plateRoot = winMgr.createWindow("DefaultWindow");
plateRoot->setSize(CEGUI::USize(cegui_absdim(0.0f), cegui_reldim(0.16f)));
plateRoot->setAspectMode(CEGUI::AM_EXPAND);
plateRoot->setAspectRatio(1.0f);
plateRoot->setRiseOnClickEnabled(false);
plateRoot->setPixelAligned(false);
plateRoot->subscribeEvent(CEGUI::Window::EventMouseButtonDown, Event::Subscriber(&HUDDemo::handlePlateWindowClicked, this));
d_rootIngame->addChild(plateRoot);
CEGUI::Window* plateImgWnd = winMgr.createWindow("Generic/Image", "ImageWindowPlate");
plateImgWnd->setProperty("Image", s_imageNamePlate);
plateImgWnd->setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_absdim(0.0f)));
plateImgWnd->setAspectRatio(3.308f);
plateImgWnd->setAspectMode(CEGUI::AM_EXPAND);
plateImgWnd->setVerticalAlignment(CEGUI::VA_BOTTOM);
plateImgWnd->setMousePassThroughEnabled(true);
plateImgWnd->setPixelAligned(false);
plateRoot->addChild(plateImgWnd);
CEGUI::String image = getRandomGameImage();
CEGUI::Window* plateTopping = winMgr.createWindow("Generic/Image", "ImageWindowObject");
plateTopping->setProperty("Image", image);
plateTopping->setSize(CEGUI::USize(cegui_reldim(0.88f), cegui_absdim(0.0f)));
plateTopping->setAspectRatio(1.0f);
plateTopping->setAspectMode(CEGUI::AM_EXPAND);
plateTopping->setHorizontalAlignment(CEGUI::HA_CENTRE);
plateTopping->setMousePassThroughEnabled(true);
plateTopping->setPixelAligned(false);
plateRoot->addChild(plateTopping);
int randumNumber = rand() % 10000;
float posY = randumNumber / 10000.0f;
plateRoot->setPosition(CEGUI::UVector2(cegui_absdim(0.0f), cegui_reldim(0.1f + 0.6f * posY)));
return plateRoot;
}
示例13: addFrameGraph
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);
}
示例14: createScene
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));
}
示例15: cargarImagen
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);
}