本文整理汇总了C++中cegui::Window::setHorizontalAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::setHorizontalAlignment方法的具体用法?C++ Window::setHorizontalAlignment怎么用?C++ Window::setHorizontalAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::setHorizontalAlignment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createDescriptionLabel
/*************************************************************************
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.");
}
示例2: 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;
}
示例3: CreateText
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;
}