当前位置: 首页>>代码示例>>C++>>正文


C++ Bundle::getObjectId方法代码示例

本文整理汇总了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;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:38,代码来源:lua_Bundle.cpp

示例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);
}
开发者ID:ARVOS-APP,项目名称:ArViewerGameplay,代码行数:87,代码来源:SamplesGame.cpp


注:本文中的Bundle::getObjectId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。