void idle (Test& test, Entity& entity, Frame& frame) { try { // static size_t start = common::milliseconds (); static size_t last_fps = 0; static size_t frames_count = 0; // float t = float (common::milliseconds () - start) / 1000.f; if (common::milliseconds () - last_fps > 1000) { printf ("FPS: %.2f\n", float (frames_count)/float (common::milliseconds () - last_fps)*1000.f); fflush (stdout); last_fps = common::milliseconds (); frames_count = 0; return; } frames_count++; common::PropertyMap entity_dependent_properties = frame.EntityDependentProperties (); entity_dependent_properties.SetProperty ("myObjectMatrix", math::mat4f (1.0f)); common::PropertyMap frame_properties = frame.Properties (); common::PropertyMap entity_properties = entity.Properties (); // float angle = t * 3.1415926f / 4.0f; //// entity.SetWorldMatrix (math::rotate (math::radian (angle), math::vec3f (0, 0, 1))); // entity.SetWorldMatrix (math::rotate (math::radian (angle), math::vec3f (0, 0, 1)) * // math::rotate (math::radian (angle*0.2f), math::vec3f (1, 0, 0))); frame.Draw (); test.Window ().SwapBuffers (); } catch (std::exception& e) { printf ("exception: %s\n at idle\n", e.what ()); } catch (...) { printf ("unknown exception\n at idle\n"); } }
void AntiMoustiqueMainForm::StartAudioPlayer() { result r = E_SUCCESS; Frame *pFrame = (Frame *)GetParent(); if( !pFrame ) { AppLog(">>>>>> GetParent has failed.\n"); return ; } if ( !g_pAudioPlayer ) { g_pAudioPlayer = new AntiMoustiqueAudioPlayer(); if( !g_pAudioPlayer ) { AppLog( ">>>>>> new AudioPlay() has been failed\n"); return; } if( g_pAudioPlayer->ConstructAudioPlayer() == false ) { AppLog( ">>>>>>ConstructVideoPlay has been failed\n"); delete g_pAudioPlayer; g_pAudioPlayer= null; return; } //------------------------------ // Attach Form to Frame //------------------------------ r = pFrame->AddControl( *g_pAudioPlayer ); if( IsFailed(r)) { AppLog( ">>>>>> pFrame->AddControl( *g_pAudioPlayer ) has been failed\n"); delete g_pAudioPlayer; g_pAudioPlayer= null; return; } } //Assign the current form as Form1 r = pFrame->SetCurrentForm( *g_pAudioPlayer ); if( IsFailed(r)) { AppLog(">>>>>> SetCurrentForm( *g_pAudioPlayer ) has failed.\n"); return ; } //Redraw form pFrame->Draw(); r = pFrame->Show(); if( IsFailed(r)) { AppLog(">>>>>> Show() has failed.\n"); return ; } g_pAudioPlayer->AudioPlayerOpen(); }