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


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

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


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

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

示例2: 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,代码来源:

示例3: logicLoop

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

	// game
	MGame * game = engine->getGame();
	if(game)
	{
		if(game->isRunning()){
			game->update();
		}
	}
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: update

void update(void)
{
	MEngine * engine = MEngine::getInstance();
	MGame * game = engine->getGame();

	if(game)
	{
		if(game->isRunning())
		{
			game->update();
		}
	}
}
开发者ID:Keedu,项目名称:maratis,代码行数:13,代码来源:main.cpp

示例5: windowEvents

// window events
void windowEvents(MWinEvent * windowEvents)
{
	MEngine * engine = MEngine::getInstance();

	// game
	MGame * game = engine->getGame();
	if(game)
	{
		if(game->isRunning()){
			gameWinEvents(windowEvents);
		}
	}

	if(windowEvents->type == MWIN_EVENT_KEY_DOWN && windowEvents->data[0] == MKEY_ESCAPE){
		MWindow::getInstance()->setActive(false);
	}

	if(windowEvents->type == MWIN_EVENT_WINDOW_CLOSE){
		MWindow::getInstance()->setActive(false);
	}
}
开发者ID:Keedu,项目名称:maratis,代码行数:22,代码来源:main.cpp

示例6: draw

void draw(void)
{
	MWindow * window = MWindow::getInstance();
	MEngine * engine = MEngine::getInstance();
	MRenderingContext * render = engine->getRenderingContext();
	MGame * game = engine->getGame();

	// set basic viewport
	render->disableScissorTest();
	render->setViewport(0, 0, window->getWidth(), window->getHeight());

	if(game)
	{
		if(game->isRunning())
		{
			game->draw();
		}
	}

	window->swapBuffer();
}
开发者ID:Keedu,项目名称:maratis,代码行数:21,代码来源:main.cpp

示例7: main


//.........这里部分代码省略.........

		render->createTexture(&logoTextureId);
		render->bindTexture(logoTextureId);
		render->sendTextureImage(&image, false, false, false);

		// clear window
		draw();

		MGuiText text("LOADING", MVector2(480, 280), 16, MVector4(1, 1, 1, 1));
		text.draw();

		window->swapBuffer();
	}

	// load project
	if(argc > 1)
    {
		maratis->loadProject(argv[1]);
	}

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

	int f = 0;
	int t = 0;
	
	
	// on events
	while(window->isActive())
	{
		// on events
		if(window->onEvents())
		{
			// compute target tick
			unsigned long currentTick = window->getSystemTick();

			unsigned long tick = currentTick - startTick;
			unsigned long frame = (unsigned long)(tick * (frequency * 0.001f));

			// update elapsed time
			unsigned int i;
			unsigned int steps = (unsigned int)(frame - previousFrame);

			if(window->getFocus())
			{
				// don't wait too much
				if(steps >= (frequency/2))
				{
					update();
					draw();
					previousFrame += steps;
					continue;
				}
				
				// update
				for(i=0; i<steps; i++)
				{
					update();
					previousFrame++;
					t++;
					if(t == frequency)
					{
						MGame * game = engine->getGame();
						if(game)
						{
							if(! game->isRunning())
								MFilesUpdate::update();
						}
						else
						{
							MFilesUpdate::update();
						}

						//printf("fps:%d\n", f);
						t = 0;
						f = 0;
					}
				}

				// draw
				//if(steps > 0)
				{
					draw();
					f++;
				}
			}
			else
			{
				previousFrame = frame;
				window->swapBuffer();
			}
		}
	}

	gui->clear();
	maratis->clear();
	return 0;
}
开发者ID:mconbere,项目名称:Newt,代码行数:101,代码来源:main.cpp


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