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


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

本文整理汇总了C++中Bundle::loadNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Bundle::loadNode方法的具体用法?C++ Bundle::loadNode怎么用?C++ Bundle::loadNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bundle的用法示例。


在下文中一共展示了Bundle::loadNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialize

void TerrainSample::initialize()
{
    // Load scene
	_scene = Scene::load("res/common/terrain/sample.scene");
	_terrain = dynamic_cast<Terrain*>(_scene->findNode("terrain")->getDrawable());
    _sky = _scene->findNode("sky");
    _sky->setTag("lighting", "none");

    // Load shapes
    Bundle* bundle;
    bundle = Bundle::create("res/common/sphere.gpb");
    _sphere = bundle->loadNode("sphere");
    dynamic_cast<Model*>(_sphere->getDrawable())->setMaterial("res/common/terrain/shapes.material#sphere", 0);
    SAFE_RELEASE(bundle);

    bundle = Bundle::create("res/common/box.gpb");
    _box = bundle->loadNode("box");
    dynamic_cast<Model*>(_box->getDrawable())->setMaterial("res/common/terrain/shapes.material#box", 0);
    SAFE_RELEASE(bundle);

    // Load font
	_font = Font::create("res/ui/arial.gpb");

    // Setup form
    _form = Form::create("res/common/terrain/terrain.form");
    _form->getControl("plusButton")->addListener(this, Control::Listener::CLICK);
    _form->getControl("minusButton")->addListener(this, Control::Listener::CLICK);
    _form->getControl("wireframe")->addListener(this, Control::Listener::VALUE_CHANGED);
    _form->getControl("patches")->addListener(this, Control::Listener::VALUE_CHANGED);
    _form->getControl("physics")->addListener(this, Control::Listener::VALUE_CHANGED);
    _form->getControl("lod")->addListener(this, Control::Listener::VALUE_CHANGED);
    _form->getControl("culling")->addListener(this, Control::Listener::VALUE_CHANGED);
    _form->getControl("snapToGround")->addListener(this, Control::Listener::VALUE_CHANGED);
    _form->getControl("dropSphere")->addListener(this, Control::Listener::CLICK);
    _form->getControl("dropBox")->addListener(this, Control::Listener::CLICK);
    _form->getControl("clearAll")->addListener(this, Control::Listener::CLICK);
    Control* main = _form->getControl("main");
    _formSize.set(main->getWidth(), main->getHeight());

    // Use script camera for navigation
	enableScriptCamera(true);
    setScriptCameraSpeed(20, 80);

    _directionalLight = _scene->findNode("directionalLight")->getLight();
}
开发者ID:03050903,项目名称:GamePlay,代码行数:45,代码来源:TerrainSample.cpp

示例2: lua_Bundle_loadNode

static int lua_Bundle_loadNode(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_TSTRING || lua_type(state, 2) == LUA_TNIL))
            {
                // Get parameter 1 off the stack.
                const char* param1 = gameplay::ScriptUtil::getString(2, false);

                Bundle* instance = getInstance(state);
                void* returnPtr = ((void*)instance->loadNode(param1));
                if (returnPtr)
                {
                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
                    object->instance = returnPtr;
                    object->owns = true;
                    luaL_getmetatable(state, "Node");
                    lua_setmetatable(state, -2);
                }
                else
                {
                    lua_pushnil(state);
                }

                return 1;
            }

            lua_pushstring(state, "lua_Bundle_loadNode - 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,代码行数:47,代码来源:lua_Bundle.cpp


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