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


C++ MEngine类代码示例

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


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

示例1: clear

void MSoundRef::clear(void)
{
    MEngine * engine = MEngine::getInstance();
    MSoundContext * soundContext = engine->getSoundContext();

    soundContext->deleteBuffer(&m_bufferId);
}
开发者ID:sivarajankumar,项目名称:maratis,代码行数:7,代码来源:MSoundRef.cpp

示例2: Save

    void Atlas::Save()
    {
	MEngine* engine = MEngine::getInstance();

	std::string imgName = (std::string("atlases/") + m_Name + ".png");
	engine->getImageSaver()->loadData(imgName.c_str(), &m_Atlas);
	if(m_ConfigFile)
	{
	    m_ConfigFile->Write("atlas.filename", imgName);
	    m_ConfigFile->Write("atlas.images", m_Images.size());
	    int i = 0;
	    for(imageMapIter iImage = m_Images.begin(); iImage != m_Images.end(); iImage++)
	    {
		std::string root = "atlas.image";
		char num[32];
		snprintf(num, 32, "%d.", i);
		root += num;
		++i;

		m_ConfigFile->Write((root + "name").c_str(), iImage->first);
		m_ConfigFile->Write((root + "pos").c_str(), iImage->second.uv);
		m_ConfigFile->Write((root + "w").c_str(), iImage->second.width);
		m_ConfigFile->Write((root + "h").c_str(), iImage->second.height);
	    }
	    m_ConfigFile->Save();
	}
    }
开发者ID:galek,项目名称:MIngEd,代码行数:27,代码来源:atlas.cpp

示例3: changeCurrentScene

void MLevel::changeCurrentScene(unsigned int id)
{
	if(id == m_currentSceneId)
		return;

	MEngine * engine = MEngine::getInstance();

	if(id < getScenesNumber())
	{
		MScene * scene = getCurrentScene();

		// onEndScene
		MGame * game = engine->getGame();
		if(game)
			game->onEndScene();

		// change scene
		setCurrentSceneId(id);
		scene = getCurrentScene();

		// onBeginScene
		if(game)
			game->onBeginScene();
	}	
}
开发者ID:garydai,项目名称:Maratis_3d_engine,代码行数:25,代码来源:MLevel.cpp

示例4: getRepertory

void MaratisPlayer::loadProject(MProject* proj, const char * filename)
{
	MWindow * window = MWindow::getInstance();
	MEngine * engine = MEngine::getInstance();
	
	
	// working directory
	char workingDir[256];
	getRepertory(workingDir, filename);
	window->setWorkingDirectory(workingDir);
	
	// restart
	restart();
	loadGamePlugin();
	
	// renderer
	changeRenderer(proj->renderer.c_str());
	
	// if we have a package manager, try to load the package
	if(MPackageManager* pPackMan = MEngine::getInstance()->getPackageManager())
	{
		char projName[256];
		getLocalFilename(projName, workingDir, filename);
		if(char* ext = strstr(projName, ".mproj"))
		{
			sprintf(ext, ".npk");
			char packageFile[256];
			getGlobalFilename(packageFile, workingDir, projName);
			pPackMan->loadPackage(packageFile);
		}
	}
	
	// load start level
	engine->loadLevel(proj->startLevel.c_str());
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: draw

void MScene::draw(MOCamera * camera)
{
	MEngine * engine = MEngine::getInstance();
	MRenderer * renderer = engine->getRenderer();
	if(renderer)
		renderer->drawScene(this, camera);
}
开发者ID:Keedu,项目名称:maratis,代码行数:7,代码来源:MScene.cpp

示例6: graphicLoop

void MaratisPlayer::graphicLoop(void)
{
	MWindow * window = MWindow::getInstance();
	MEngine * engine = MEngine::getInstance();
	MRenderingContext * render = engine->getRenderingContext();

	// game
	MGame * game = engine->getGame();
	if(game)
	{
		if(game->isRunning())
		{
			render->disableScissorTest();
			render->setViewport(0, 0, window->getWidth(), window->getHeight());
			game->draw();
		}
		else
		{
			render->clear(M_BUFFER_COLOR);
		}
	}
	else
	{
		render->clear(M_BUFFER_COLOR);
	}
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例7: WriteImage

    void Atlas::Generate(bool clear)
    {
	m_Atlas.create(M_UBYTE, m_Width, m_Height, m_BPP);
	unsigned char col[]= {255, 255, 255, 0};
	for(uint32 x = 0; x < m_Width; ++x)
	    for(uint32 y = 0; y < m_Height; ++y) 
		m_Atlas.writePixel(x, y, col);

	for(imageMapIter iImage = m_Images.begin(); 
	    iImage != m_Images.end(); 
	    iImage++)
	    WriteImage(iImage->second);

	MEngine* engine = MEngine::getInstance();
	MRenderingContext* render = engine->getRenderingContext();
	
	if(m_TextureID == 0)
	    render->createTexture(&m_TextureID);

	render->bindTexture(m_TextureID);
	render->sendTextureImage(&m_Atlas, false, 1, 0);

	if(clear)
	{
	    // remove images
            delete [] m_Layout;
            m_Layout = NULL;
        }
    }
开发者ID:galek,项目名称:MIngEd,代码行数:29,代码来源:atlas.cpp

示例8: 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

示例9: update

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

	if(! m_font)
		m_font = MFont::getNew();

	engine->getFontLoader()->loadData(getFilename(), m_font, arg);
}
开发者ID:UPO33,项目名称:Maratis-4,代码行数:9,代码来源:MFontRef.cpp

示例10: 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

示例11: 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

示例12: update

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

	if(! m_materialsAnim)
		m_materialsAnim = MMaterialsAnim::getNew();

	engine->getMaterialsAnimLoader()->loadData(getFilename(), m_materialsAnim, arg);
}
开发者ID:UPO33,项目名称:Maratis-4,代码行数:9,代码来源:MMaterialsAnimRef.cpp

示例13: update

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

	if(! m_texturesAnim)
		m_texturesAnim = MTexturesAnim::getNew();

	engine->getTexturesAnimLoader()->loadData(getFilename(), m_texturesAnim);	
}
开发者ID:mconbere,项目名称:Newt,代码行数:9,代码来源:MTexturesAnimRef.cpp

示例14: 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

示例15: M_PROFILE_SCOPE

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

	if(! m_materialsAnim)
		m_materialsAnim = MMaterialsAnim::getNew();

	engine->getMaterialsAnimLoader()->loadData(getFilename(), m_materialsAnim);	
}
开发者ID:galek,项目名称:MIngEd,代码行数:10,代码来源:MMaterialsAnimRef.cpp


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