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


C++ MEngine::getScriptContext方法代码示例

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


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

示例1: onBeginScene

void MGame::onBeginScene(void)
{
	MEngine * engine = MEngine::getInstance();

	// get level
	MLevel * level = MEngine::getInstance()->getLevel();
	if(! level)
		return;

	// get current scene
	MScene * scene = level->getCurrentScene();
	if(! scene)
		return;

	// update objects
	scene->updateObjectsMatrices();

	// start sound
	scene->playLoopSounds();

	// prepare physics
	scene->preparePhysics();

	// run script
	if(engine->getScriptContext())
		engine->getScriptContext()->runScript(scene->getScriptFilename());
}
开发者ID:mconbere,项目名称:Newt,代码行数:27,代码来源:MGame.cpp

示例2: ScriptAtlasSelect

    int ScriptAtlasSelect()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	if(Atlas* atlas = (Atlas*)script->getPointer(0))
	    atlas->Select();
	return 0;	
    }
开发者ID:galek,项目名称:MIngEd,代码行数:9,代码来源:atlas.cpp

示例3: MPluginEnd

void MPluginEnd(MScriptExt)
{
    MResource::unregisterFactory("MScriptExt", MScriptExtGetter);
    MEngine* engine = MEngine::getInstance();
    if(engine->getScriptContext() == s_script)
        engine->setScriptContext(NULL);

    delete s_script;
}   
开发者ID:nistur,项目名称:MScriptExt,代码行数:9,代码来源:MScriptPlugin.cpp

示例4: ScriptAtlasWrite

    int ScriptAtlasWrite()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	Atlas* atlas = (Atlas*)script->getPointer(0);
	atlas->Save();

	return 0;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:10,代码来源:atlas.cpp

示例5: update

void MGame::update(void)
{
	MEngine * engine = MEngine::getInstance();

	// run script
	if(engine->getScriptContext())
		engine->getScriptContext()->callFunction("onSceneUpdate");

	// get level
	MLevel * level = MEngine::getInstance()->getLevel();
	if(! level)
		return;

	// get current scene
	MScene * scene = level->getCurrentScene();
	if(! scene)
		return;

	// update behaviors
	unsigned int i;
	unsigned int oSize = scene->getObjectsNumber();
	for(i=0; i<oSize; i++)
	{
		MObject3d * object = scene->getObjectByIndex(i);
		if(! object->isActive())
			continue;
			
		object->updateBehaviors();
	}

	// update scene
	scene->update();

	// update physics
	scene->updatePhysics();

	// update objects matrices
	scene->updateObjectsMatrices();

	// flush input
	engine->getInputContext()->flush();
}
开发者ID:mconbere,项目名称:Newt,代码行数:42,代码来源:MGame.cpp

示例6: ScriptAtlasImageDestroy

    int ScriptAtlasImageDestroy()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	MImage* image = (MImage*)script->getPointer(0);
	if(image)
	    delete image;

	return 0;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:11,代码来源:atlas.cpp

示例7: ScriptAtlasDestroy

    int ScriptAtlasDestroy()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	Atlas* atlas = (Atlas*)script->getPointer(0);
	if(atlas)
	    delete atlas;

	return 0;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:11,代码来源:atlas.cpp

示例8: ScriptAtlasCreate

    int ScriptAtlasCreate()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	unsigned int size = script->getInteger(0);
	const char* name = script->getString(1);
	
	script->pushPointer(new Atlas(size, 4, name));
	return 1;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:11,代码来源:atlas.cpp

示例9: ScriptAtlasImageWrite

    int ScriptAtlasImageWrite()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	MImage* image = (MImage*)script->getPointer(0);
	const char* file = script->getString(1);

	engine->getImageSaver()->loadData(file, image);
	return 0;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:11,代码来源:atlas.cpp

示例10: begin

void MScene::begin(void)
{
	MEngine * engine = MEngine::getInstance();
	MScriptContext * scriptContext = engine->getScriptContext();

	updateObjectsMatrices();
	playLoopSounds();
	preparePhysics();

	// run script
	if(scriptContext)
		scriptContext->runScript(getScriptFilename());
}
开发者ID:Keedu,项目名称:maratis,代码行数:13,代码来源:MScene.cpp

示例11: ScriptAtlasImageGetSize

    int ScriptAtlasImageGetSize()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	MImage* image = (MImage*)script->getPointer(0);
	if(image)
	{
	    script->pushInteger(image->getWidth());
	    script->pushInteger(image->getHeight());
	    return 2;
	}
	return 0;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:14,代码来源:atlas.cpp

示例12: ScriptAtlasGetSize

    int ScriptAtlasGetSize()
    { 
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();
	Atlas* atlas = (Atlas*)script->getPointer(0);
	if(atlas)
	{
	    MImage* image = atlas->GetImage();
	    script->pushInteger(image->getWidth());
	    script->pushInteger(image->getHeight());
	    return 2;
	}
	return 0;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:14,代码来源:atlas.cpp

示例13: ScriptAtlasGetUVs

    int ScriptAtlasGetUVs()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	MVector2 uvs[2];
	if(Atlas* atlas = (Atlas*)script->getPointer(0))
	    atlas->GetUVs(uvs, script->getString(1));

	script->pushFloat(uvs[0].x);
	script->pushFloat(uvs[0].y);
	script->pushFloat(uvs[1].x);
	script->pushFloat(uvs[1].y);
	return 4;
    }
开发者ID:galek,项目名称:MIngEd,代码行数:15,代码来源:atlas.cpp

示例14: ScriptSetColour

    int ScriptSetColour()
    {
	MEngine* engine = MEngine::getInstance();
	MScriptContext* script = engine->getScriptContext();

	if(script->getArgsNumber() >= 3)
	{
	    g_CurrentColour.r = script->getInteger(0);
	    g_CurrentColour.g = script->getInteger(1);
	    g_CurrentColour.b = script->getInteger(2);
	    if(script->getArgsNumber() >= 4)
		g_CurrentColour.a = script->getInteger(3);
	    else
		g_CurrentColour.a = 255;
	}
    }
开发者ID:galek,项目名称:MIngEd,代码行数:16,代码来源:renderer.cpp

示例15: MPluginStart

void MPluginStart(MScriptExt)
{
    MResource::registerFactory("MScriptExt", MScriptExtGetter);
    MEngine* engine = MEngine::getInstance();
    s_script = new MScriptExtImpl;

    // copy the existing environment
    MScriptContext* oldScriptContext = engine->getScriptContext();
    char fnName[256];
    if(oldScriptContext)
        for(int i = 0; i < oldScriptContext->getNumCFunctions(); ++i)
        {
            MScriptContext::CFunction fn = oldScriptContext->getCFunction(i, fnName);
            s_script->addFunction(fnName, fn);
        }
        
    engine->setScriptContext(s_script);

    s_script->init();
}
开发者ID:nistur,项目名称:MScriptExt,代码行数:20,代码来源:MScriptPlugin.cpp


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