}
//{{{ run
- void Application::run( Scene& scene )
- {
- scene.initialize();
- mof::Finalizer finalizer( scene.finalize ); //run\82ð\94²\82¯\82é\82Æ\82«\82É\89ð\95ú\8f\88\97\9d\82ð\8ds\82¤
- MSG msg;
- ZeroMemory( &msg, sizeof(msg) );
- mof::Timer timer;
- mof::Timer fpsTimer;
- int frameCount = 0;
-
- mof::Captor Captor( _T("output"));
- int sleepingTime = 0;
- for( ; ; )
- {
- while( PeekMessage( &msg, NULL, 0U, 0U, PM_NOREMOVE ) )
- {
- if( msg.message == WM_QUIT )return;
- GetMessage( &msg , NULL , 0 , 0 );
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
-
- for( int i = 0 ; i < m_nUpdatingPerFrame ; i++ )scene.update();//\83V\81[\83\93\82Ì\8f\88\97\9d
-
-
- mof::GraphicsDevice::beginScene();
- scene.draw();//\83V\81[\83\93\82Ì\95`\89æ
- if (enable_output_frame_) Captor.capture();
- mof::GraphicsDevice::endScene();
-
-
-
- //FPS\82Ì\8cv\91ª
- double true_past_time = timer.getTime();
- double past_time = frame_interval_ * (frameCount + 1);
- if(past_time > true_past_time) {
- Sleep(static_cast<int>(past_time - true_past_time));
- sleepingTime += past_time - true_past_time;
- }
-
- //timer.reset();
-
- if(++frameCount % 500 == 0)
- {
- float fps = 500.0f / static_cast<float>(fpsTimer.getTime() - sleepingTime) * 1000;
- fpsTimer.reset();
- sleepingTime = 0;
- DEBUG_PRINT( "FPS --- " << fps );
- }
- } // for
-
-
- }
-//}}}
-//{{{ run
void Application::run(scene& s)
{
MSG msg;
{
while( PeekMessage( &msg, NULL, 0U, 0U, PM_NOREMOVE ) )
{
+ // \83^\83C\83}\82ð\82Æ\82ß\82é
+ timer.pause();
+ fpsTimer.pause();
if( msg.message == WM_QUIT )return;
GetMessage( &msg , NULL , 0 , 0 );
TranslateMessage( &msg );
DispatchMessage( &msg );
}
+ // \83^\83C\83}\82ª\8e~\82Ü\82Á\82Ä\82¢\82ê\82Î\81A\8dÄ\8aJ
+ timer.start();
+ fpsTimer.start();
for( int i = 0 ; i < m_nUpdatingPerFrame ; i++ )s.update();//\83V\81[\83\93\82Ì\8f\88\97\9d
s.draw();//\83V\81[\83\93\82Ì\95`\89æ
if (enable_output_frame_) Captor.capture();
mof::GraphicsDevice::endScene();
-
-
//FPS\82Ì\8cv\91ª
double true_past_time = timer.getTime();