本文整理汇总了C++中cegui::Window::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getProperty方法的具体用法?C++ Window::getProperty怎么用?C++ Window::getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLabel
void PromptBox::SetLabel(const CEGUI::String& text)
{
OC_CEGUI_TRY;
{
CEGUI::Window* messageText = mPromptBox->getChild(mPromptBox->getName() + "/MessageText");
CEGUI::Window* editbox = mPromptBox->getChild(mPromptBox->getName() + "/Editbox");
const float32 offset = 10;
float32 buttonHeight = mPromptBox->getChild(mPromptBox->getName() + "/ButtonOK")->getPixelSize().d_height;
float32 editboxHeight = editbox->getPixelSize().d_height;
messageText->setText(text);
float32 textWidth = StringConverter::FromString<float32>(messageText->getProperty("HorzExtent").c_str());
float32 textHeight = StringConverter::FromString<float32>(messageText->getProperty("VertExtent").c_str());
editbox->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber(&PromptBox::OnEditboxKeyDown, this));
messageText->setArea(CEGUI::UDim(0,offset), CEGUI::UDim(0,0), CEGUI::UDim(1, -2.0f*offset), CEGUI::UDim(1, -buttonHeight-editboxHeight - offset));
mPromptBox->setWidth(CEGUI::UDim(0, textWidth + 2.0f*offset + INNER_FRAME_OFFSET));
mPromptBox->setHeight(CEGUI::UDim(0, textHeight + buttonHeight + editboxHeight + offset + INNER_FRAME_OFFSET));
mPromptBox->setXPosition(CEGUI::UDim(0.5f, -0.5f*mPromptBox->getPixelSize().d_width));
mPromptBox->setYPosition(CEGUI::UDim(0.5f, -0.5f*mPromptBox->getPixelSize().d_height));
EnsureWindowIsWideEnough();
}
OC_CEGUI_CATCH;
}
示例2: SetText
void MessageBox::SetText(const CEGUI::String& text)
{
CEGUI::Window* messageText = mMessageBox->getChild(mMessageBox->getName() + "/MessageText");
const float32 offset = 10;
float32 buttonHeight = mMessageBox->getChild(mMessageBox->getName() + "/ButtonOK")->getPixelSize().d_height;
messageText->setText(text);
float32 textWidth = StringConverter::FromString<float32>(messageText->getProperty("HorzExtent").c_str());
float32 textHeight = StringConverter::FromString<float32>(messageText->getProperty("VertExtent").c_str());
messageText->setArea(CEGUI::UDim(0,offset), CEGUI::UDim(0,0), CEGUI::UDim(1, -2.0f*offset), CEGUI::UDim(1, -buttonHeight-offset));
mMessageBox->setWidth(CEGUI::UDim(0, textWidth + 2.0f*offset + INNER_FRAME_OFFSET));
mMessageBox->setHeight(CEGUI::UDim(0, textHeight + buttonHeight + offset + INNER_FRAME_OFFSET));
mMessageBox->setXPosition(CEGUI::UDim(0.5f, -0.5f*mMessageBox->getPixelSize().d_width));
mMessageBox->setYPosition(CEGUI::UDim(0.5f, -0.5f*mMessageBox->getPixelSize().d_height));
EnsureWindowIsWideEnough();
}
示例3: OnEventKeyDown
bool TabNavigation::OnEventKeyDown(const CEGUI::EventArgs& e)
{
const CEGUI::KeyEventArgs& args = static_cast<const CEGUI::KeyEventArgs&>(e);
if (args.scancode == CEGUI::Key::Tab) // Tab or Shift+Tab
{
WidgetList::iterator itCurrent = Containers::find(mTabOrder.begin(), mTabOrder.end(), args.window);
OC_ASSERT(itCurrent != mTabOrder.end());
WidgetList::iterator itFocus = itCurrent;
CEGUI::Window* newWidget = 0;
do
{
if (args.sysKeys & CEGUI::Shift)
{
// Set previous
if (itFocus == mTabOrder.begin())
itFocus = mTabOrder.end();
--itFocus;
}
else
{
// Set next
++itFocus;
if (itFocus == mTabOrder.end())
itFocus = mTabOrder.begin();
}
newWidget = *itFocus;
}
while ((!newWidget->isVisible() || newWidget->isDisabled() || newWidget->getProperty("ReadOnly") == "True" ) && itFocus != itCurrent);
newWidget->activate();
// Make sure active widget will be visible
if (mScrollablePane)
{
CEGUI::Window* w = newWidget;
CEGUI::Vector2 widgetOffset(0, 0);
do
{
widgetOffset += w->getPosition().asAbsolute(w->getParentPixelSize());
w = w->getParent();
}
while (w != mScrollablePane && w != 0);
float32 scrollViewTop = mScrollablePane->getContentPaneArea().getSize().d_height * mScrollablePane->getVerticalScrollPosition();
float32 scrollViewBottom = scrollViewTop + mScrollablePane->getClipRect().getHeight();
if (widgetOffset.d_y < scrollViewTop || widgetOffset.d_y + newWidget->getPixelSize().d_height > scrollViewBottom)
{
// We need to scroll
mScrollablePane->setVerticalScrollPosition(widgetOffset.d_y / mScrollablePane->getContentPaneArea().getSize().d_height);
}
}
return true;
}
return false;
}
示例4: handleOptionsVisibility
bool GUIManager::handleOptionsVisibility ( CEGUI::EventArgs const & )
{
CEGUI::Window *dsFrame = CEGUI::WindowManager::getSingleton().getWindow(
"Sheet/DatasetFrame");
std::string prop = dsFrame->getProperty("Visible").c_str();
if (prop == "False")
dsFrame->show();
else
dsFrame->hide();
return true;
}
示例5: HandleInventoryEnter
/***********************************************************
handle windows enter event
***********************************************************/
bool ContainerBox::HandleInventoryEnter (const CEGUI::EventArgs& e)
{
const CEGUI::MouseEventArgs& dd_args = static_cast<const CEGUI::MouseEventArgs&>(e);
unsigned int id = dd_args.window->getID();
CEGUI::Window* tmp = dd_args.window;
std::string ttip = tmp->getProperty("Tooltip").c_str();
if(ttip == "")
{
CEGUI::String tmpstr((const unsigned char *)InventoryHandler::getInstance()->GetItemDescription(id).c_str());
tmp->setProperty("Tooltip", tmpstr);
}
return true;
}
示例6: getPoints
int GamePlate::getPoints()
{
CEGUI::Window* window = d_window->getChild("ImageWindowObject");
CEGUI::String objectImage = window->getProperty("Image");
if(objectImage.compare(HUDDemo::s_imageNameBread) == 0)
return 2;
else if(objectImage.compare(HUDDemo::s_imageNamePoo) == 0)
return -6;
else if(objectImage.compare(HUDDemo::s_imageNameSteak) == 0)
return -13;
else if(objectImage.compare(HUDDemo::s_imageNamePrizza) == 0)
return 3;
else if(objectImage.compare(HUDDemo::s_imageNameVegPeople) == 0)
return 1;
else if(objectImage.compare(HUDDemo::s_imageNameVegFruits) == 0)
return 88;
return 0;
}