本文整理汇总了C++中Bundle::getObjectId方法的典型用法代码示例。如果您正苦于以下问题:C++ Bundle::getObjectId方法的具体用法?C++ Bundle::getObjectId怎么用?C++ Bundle::getObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle::getObjectId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lua_Bundle_getObjectId
static int lua_Bundle_getObjectId(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 2:
{
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
lua_type(state, 2) == LUA_TNUMBER)
{
// Get parameter 1 off the stack.
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
Bundle* instance = getInstance(state);
const char* result = instance->getObjectId(param1);
// Push the return value onto the stack.
lua_pushstring(state, result);
return 1;
}
lua_pushstring(state, "lua_Bundle_getObjectId - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 2).");
lua_error(state);
break;
}
}
return 0;
}
示例2: initialize
void SamplesGame::initialize()
{
LOGI(">SamplesGame::initialize ()");
LOGI(">SamplesGame::initialize FileSystem::getAssetPath() = '%s'", FileSystem::getAssetPath());
LOGI(">SamplesGame::initialize FileSystem::getResourcePath() = '%s'", FileSystem::getResourcePath());
Bundle* bundle = Bundle::create("res/ui/arial.gpb");
LOGI(">SamplesGame::initialize bundle=%p", bundle);
_font = bundle->loadFont(bundle->getObjectId(0));
LOGI(">SamplesGame::initialize _font=%p", _font);
_font = Font::create("res/ui/arial.gpb");
LOGI(">SamplesGame::initialize _font=%p", _font);
for (size_t i = 0; i < _categories->size(); ++i)
{
std::sort((*_samples)[i].begin(), (*_samples)[i].end());
}
// Load camera script
getScriptController()->loadScript("res/common/camera.lua");
// Create the selection form
_sampleSelectForm = Form::create("sampleSelect", NULL, Layout::LAYOUT_VERTICAL);
_sampleSelectForm->setWidth(220);
_sampleSelectForm->setHeight(1, true);
_sampleSelectForm->setScroll(Container::SCROLL_VERTICAL);
const size_t size = _samples->size();
LOGI(">SamplesGame::initialize _samples->size()=%d", size);
for (size_t i = 0; i < size; ++i)
{
Label* categoryLabel = Label::create((*_categories)[i].c_str());
categoryLabel->setFontSize(22);
categoryLabel->setText((*_categories)[i].c_str());
_sampleSelectForm->addControl(categoryLabel);
categoryLabel->release();
SampleRecordList list = (*_samples)[i];
const size_t listSize = list.size();
for (size_t j = 0; j < listSize; ++j)
{
SampleRecord sampleRecord = list[j];
Button* sampleButton = Button::create(sampleRecord.title.c_str());
sampleButton->setText(sampleRecord.title.c_str());
sampleButton->setWidth(1, true);
sampleButton->setHeight(50);
sampleButton->addListener(this, Control::Listener::CLICK);
_sampleSelectForm->addControl(sampleButton);
sampleButton->release();
}
}
_sampleSelectForm->setFocus();
// Disable virtual gamepads.
unsigned int gamepadCount = getGamepadCount();
for (unsigned int i = 0; i < gamepadCount; i++)
{
Gamepad* gamepad = getGamepad(i, false);
if (gamepad->isVirtual())
{
gamepad->getForm()->setEnabled(false);
}
}
/*
for (size_t i = 0; i < size; ++i)
{
SampleRecordList list = (*_samples)[i];
const size_t listSize = list.size();
for (size_t j = 0; j < listSize; ++j)
{
SampleRecord sampleRecord = list[j];
// TODO if (sampleRecord.title.compare(control->getId()) == 0)
{
_sampleSelectForm->setEnabled(false);
runSample(sampleRecord.funcPtr);
LOGI("<SamplesGame::initialize _activeSample=%lx", (long )_activeSample);
return;
}
}
}
*/
LOGI("<SamplesGame::initialize _activeSample=%lx", (long )_activeSample);
}