本文整理汇总了C++中Theme::getEmptyStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ Theme::getEmptyStyle方法的具体用法?C++ Theme::getEmptyStyle怎么用?C++ Theme::getEmptyStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::getEmptyStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lua_Theme_getEmptyStyle
static int lua_Theme_getEmptyStyle(lua_State* state)
{
// Get the number of parameters.
int paramCount = lua_gettop(state);
// Attempt to match the parameters to a valid binding.
switch (paramCount)
{
case 1:
{
if ((lua_type(state, 1) == LUA_TUSERDATA))
{
Theme* instance = getInstance(state);
void* returnPtr = ((void*)instance->getEmptyStyle());
if (returnPtr)
{
gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
object->instance = returnPtr;
object->owns = false;
luaL_getmetatable(state, "ThemeStyle");
lua_setmetatable(state, -2);
}
else
{
lua_pushnil(state);
}
return 1;
}
lua_pushstring(state, "lua_Theme_getEmptyStyle - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 1).");
lua_error(state);
break;
}
}
return 0;
}
示例2: create
Form* Form::create(const char* url)
{
// Load Form from .form file.
Properties* properties = Properties::create(url);
if (properties == NULL)
{
GP_ASSERT(properties);
return NULL;
}
// Check if the Properties is valid and has a valid namespace.
Properties* formProperties = (strlen(properties->getNamespace()) > 0) ? properties : properties->getNextNamespace();
assert(formProperties);
if (!formProperties || !(strcmp(formProperties->getNamespace(), "form") == 0))
{
GP_ASSERT(formProperties);
SAFE_DELETE(properties);
return NULL;
}
// Create new form with given ID, theme and layout.
const char* themeFile = formProperties->getString("theme");
const char* layoutString = formProperties->getString("layout");
Layout* layout;
switch (getLayoutType(layoutString))
{
case Layout::LAYOUT_ABSOLUTE:
layout = AbsoluteLayout::create();
break;
case Layout::LAYOUT_FLOW:
layout = FlowLayout::create();
break;
case Layout::LAYOUT_VERTICAL:
layout = VerticalLayout::create();
break;
default:
GP_ERROR("Unsupported layout type '%d'.", getLayoutType(layoutString));
break;
}
Theme* theme = Theme::create(themeFile);
GP_ASSERT(theme);
Form* form = new Form();
form->_layout = layout;
form->_theme = theme;
// Get default projection matrix.
Game* game = Game::getInstance();
Matrix::createOrthographicOffCenter(0, game->getWidth(), game->getHeight(), 0, 0, 1, &form->_defaultProjectionMatrix);
Theme::Style* style = NULL;
const char* styleName = formProperties->getString("style");
if (styleName)
{
style = theme->getStyle(styleName);
}
else
{
style = theme->getEmptyStyle();
}
form->initialize(style, formProperties);
form->_consumeInputEvents = formProperties->getBool("consumeInputEvents", false);
// Alignment
if ((form->_alignment & Control::ALIGN_BOTTOM) == Control::ALIGN_BOTTOM)
{
form->_bounds.y = Game::getInstance()->getHeight() - form->_bounds.height;
}
else if ((form->_alignment & Control::ALIGN_VCENTER) == Control::ALIGN_VCENTER)
{
form->_bounds.y = Game::getInstance()->getHeight() * 0.5f - form->_bounds.height * 0.5f;
}
if ((form->_alignment & Control::ALIGN_RIGHT) == Control::ALIGN_RIGHT)
{
form->_bounds.x = Game::getInstance()->getWidth() - form->_bounds.width;
}
else if ((form->_alignment & Control::ALIGN_HCENTER) == Control::ALIGN_HCENTER)
{
form->_bounds.x = Game::getInstance()->getWidth() * 0.5f - form->_bounds.width * 0.5f;
}
form->_scroll = getScroll(formProperties->getString("scroll"));
form->_scrollBarsAutoHide = formProperties->getBool("scrollBarsAutoHide");
if (form->_scrollBarsAutoHide)
{
form->_scrollBarOpacity = 0.0f;
}
// Add all the controls to the form.
form->addControls(theme, formProperties);
SAFE_DELETE(properties);
form->updateBounds();
__forms.push_back(form);
//.........这里部分代码省略.........