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


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

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


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

示例1: start

void MaratisPlayer::start(void)
{
	// MEngine
	{
		MEngine * engine = MEngine::getInstance();

		// package manager
		engine->setPackageManager(m_packageManager);
		m_packageManager->init();
		
		// contexts
		engine->setSoundContext(m_soundContext); // sound context
		engine->setRenderingContext(m_render); // rendering context
		engine->setPhysicsContext(m_physics); // physics context
		engine->setScriptContext(m_script); // script context
		engine->setInputContext(m_input); // input context
		engine->setSystemContext(m_system); // system context

		// loaders
		engine->getImageLoader()->addLoader(M_loadImage); // image loader
		engine->getSoundLoader()->addLoader(M_loadSound); // sound loader
		engine->getLevelLoader()->addLoader(xmlLevelLoad); // level loader
		engine->getFontLoader()->addLoader(M_loadFont); // font loader
		engine->getFontLoader()->addLoader(M_loadBinFont); // bin font loader

		// add behaviors
		engine->getBehaviorManager()->addBehavior(MBLookAt::getStaticName(), M_OBJECT3D_CAMERA, MBLookAt::getNew);
		engine->getBehaviorManager()->addBehavior(MBFollow::getStaticName(), M_OBJECT3D, MBFollow::getNew);

		// add renderers
		engine->getRendererManager()->addRenderer(MStandardRenderer::getStaticName(), MStandardRenderer::getNew);
		engine->getRendererManager()->addRenderer(MFixedRenderer::getStaticName(), MFixedRenderer::getNew);
		
		// mesh loader
		engine->getMeshLoader()->addLoader(xmlMeshLoad);
		engine->getMeshLoader()->addLoader(M_loadBinMesh);
		engine->getArmatureAnimLoader()->addLoader(xmlArmatureAnimLoad);
		engine->getArmatureAnimLoader()->addLoader(M_loadBinArmatureAnim);
		engine->getTexturesAnimLoader()->addLoader(xmlTextureAnimLoad);
		engine->getTexturesAnimLoader()->addLoader(M_loadBinTexturesAnim);
		engine->getMaterialsAnimLoader()->addLoader(xmlMaterialAnimLoad);
        engine->getMaterialsAnimLoader()->addLoader(M_loadBinMaterialsAnim);

		// level
		engine->setLevel(m_level);

		// game
		engine->setGame(m_game);
		
		// set default renderer (standard)
		if(m_renderer == NULL)
			m_renderer = new MStandardRenderer();
		engine->setRenderer(m_renderer);


		engine->setSaveFileFactory(MSaveFileImpl::getNew);
	}
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例2: main

// main
int main(int argc, char **argv)
{
	setlocale(LC_NUMERIC, "C");

	unsigned int width = 800;
	unsigned int height = 400;
	bool fullscreen = false;

	// get engine
	MEngine* engine = MEngine::getInstance();

	// get window
	MWindow* window = MWindow::getInstance();
	window->setPointerEvent(windowEvents); // window events

	// create window
	if(! window->create("Maratis - ManualUse example", width, height, 32, fullscreen))
	{
		MLOG(4, "window create failed");
		return 0;
	}
	
	if(fullscreen)
		window->hideCursor();

	// set current directory
	{
		char rep[256];
		getRepertory(rep, argv[0]);
		window->setCurrentDirectory(rep);
	}

	// create virtual contexts
	MSoundContext * soundContext = new MALContext();
	MRenderingContext * render = new MGLContext();
	MPhysicsContext * physics = new MBulletContext();
	MScriptContext * script = new MScript();
	MInputContext *	input = new MInput();
	MSystemContext * system = new MWinContext();

	MLOG(5, "Render version: " << render->getRendererVersion());
	
	// create default Level and Game
	MLevel * level = new MLevel();
	MGame * game = new MyGame(); // MyGame
	
	// init MEngine (you can replace all contexts by others and add or use different data loaders)
	engine->setSoundContext(soundContext); // sound context
	engine->setRenderingContext(render); // rendering context
	engine->setPhysicsContext(physics); // physics context
	engine->setScriptContext(script); // script context
	engine->setInputContext(input); // input context
	engine->setSystemContext(system); // system context

	engine->getImageLoader()->addLoader(M_loadImage); // image loader
	engine->getSoundLoader()->addLoader(M_loadSound); // sound loader
	// engine->getLevelLoader()->addLoader(xmlLevelLoad); // level loader : uncomment if wanted
	engine->getFontLoader()->addLoader(M_loadFont); // font loader
	// engine->getFontLoader()->addLoader(M_loadBinFont); // bin font loader : uncomment if wanted

	// add some default "Maratis" behaviors : uncomment if wanted or add custom
	// engine->getBehaviorManager()->addBehavior(MBLookAt::getStaticName(), M_OBJECT3D_CAMERA, MBLookAt::getNew);
	// engine->getBehaviorManager()->addBehavior(MBFollow::getStaticName(), M_OBJECT3D, MBFollow::getNew);

	// add renderers
	engine->getRendererManager()->addRenderer(MStandardRenderer::getStaticName(), MStandardRenderer::getNew);
	engine->getRendererManager()->addRenderer(MFixedRenderer::getStaticName(), MFixedRenderer::getNew);

	// mesh loader
	engine->getMeshLoader()->addLoader(xmlMeshLoad);
	engine->getArmatureAnimLoader()->addLoader(xmlArmatureAnimLoad);
	engine->getTexturesAnimLoader()->addLoader(xmlTextureAnimLoad);
	engine->getMaterialsAnimLoader()->addLoader(xmlMaterialAnimLoad);

	// set level
	engine->setLevel(level);

	// set game
	engine->setGame(game);

	// set renderer (standard)
	MRenderer * renderer = engine->getRendererManager()->getRendererByName("StandardRenderer")->getNewRenderer();
	engine->setRenderer(renderer);

	// begin game
	game->begin();

	// time
	unsigned int frequency = 60;
	unsigned long previousFrame = 0;
	unsigned long startTick = window->getSystemTick();

	// on events
	while(window->isActive())
	{
		// on events
		if(window->onEvents())
		{
			// compute target tick
//.........这里部分代码省略.........
开发者ID:Keedu,项目名称:maratis,代码行数:101,代码来源:main.cpp


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