//---------------------------------------------------------------------------- // Java_pfx_renderingsupport_PhysicsEffectsRenderer_nativePhysicsEffectsSimulate // /// Implementation of JNI function to update the simulation and view parameters, /// perform one simulation step, and redraw the scene. /// /// @param env Pointer to JNI environment //---------------------------------------------------------------------------- void Java_pfx_renderingsupport_PhysicsEffectsRenderer_nativePhysicsEffectsSimulate( JNIEnv* env ) { update(); physics_simulate(); render(); perf_sync(); }
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) { if(!createWindow(SAMPLE_NAME,DISPLAY_WIDTH,DISPLAY_HEIGHT)) { MessageBox(NULL,"Can't create gl window.","ERROR",MB_OK|MB_ICONEXCLAMATION); return 0; } init(); physics_create_scene(sceneId); PfxPerfCounter counter; counter.countBegin("dt"); SCE_PFX_PRINTF("## %s: INIT SUCCEEDED ##\n", SAMPLE_NAME); MSG msg; while(s_isRunning) { if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if(msg.message==WM_QUIT) { s_isRunning = false; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { counter.countEnd(); float dt = counter.getCountTime(0)/1000.f; update(dt); if(simulating) stepSimulation(dt); counter.resetCount(); counter.countBegin("dt"); render(); perf_sync(); } } shutdown(); SCE_PFX_PRINTF("## %s: FINISHED ##\n", SAMPLE_NAME); releaseWindow(); return (msg.wParam); }
int main(void) { init(); physics_create_scene(sceneId); printf("## %s: INIT SUCCEEDED ##\n", SAMPLE_NAME); while (s_isRunning) { update(); if(simulating) physics_simulate(); render(); perf_sync(); } shutdown(); printf("## %s: FINISHED ##\n", SAMPLE_NAME); return 0; }