void CzPlatform_Destroy() { PLATFORM->Release(); CzPlatform::Destroy(); IwUtilTerminate(); }
// "main" is the S3E entry point int main() { Iw2DInit(); IwUtilInit(); // create game object pGame = new CGame; int currentUpdate = GetUpdateFrame(); int nextUpdate = currentUpdate; s3ePointerUpdate(); // to exit correctly, applications should poll for quit requests while(!s3eDeviceCheckQuitRequest()) { // run logic at a fixed frame rate (defined by UPS) // block until the next frame (don't render unless at // least one update has occurred) while(!s3eDeviceCheckQuitRequest()) { nextUpdate = GetUpdateFrame(); if( nextUpdate != currentUpdate ) break; s3eDeviceYield(1); } // execute update steps int frames = nextUpdate - currentUpdate; frames = MIN(MAX_UPDATES, frames); while(frames--) { pGame->Update(nextUpdate - currentUpdate); } currentUpdate = nextUpdate; // render the results pGame->Render(); // if an application uses polling input the application // must call update once per frame s3ePointerUpdate(); s3eKeyboardUpdate(); // S3E applications should yield frequently s3eDeviceYield(); } // clear up game object delete pGame; Ground::DestroyGround(); IwUtilTerminate(); Iw2DTerminate(); return 0; }
// Main entry point int main() { // Initialie Marmalade utility API IwUtilInit(); // Initialise the graphics system g_pGraphics = new Graphics(); // Initialise the input system g_pInput = new Input(); // Initialise the audio system g_pAudio = new Audio(); // Load resources g_pResources = new Resources(); g_pResources->Init(); // Create a world (world creates game objects, MyWorld::Init()) MyWorld* world = new MyWorld(); world->Init(); // Loop forever, until the user or the OS performs some action to quit the app while (!s3eDeviceCheckQuitRequest()) { // Get current system time time in milliseconds uint64 new_time = s3eTimerGetMs(); // Clear the drawing surface g_pGraphics->PreRender(); // Update input system g_pInput->Update(); // Update audio system g_pAudio->Update(); // Update the world world->Update(); // Render the world world->Render(); // Show the drawing surface g_pGraphics->PostRender(); // Lock frame rate to 30 frames per second int yield = (int)(FRAME_TIME * 1000 - (s3eTimerGetMs() - new_time)); if (yield < 0) yield = 0; s3eDeviceYield(yield); // Yield to OS } // Cleanup world->Release(); delete world; g_pResources->Release(); delete g_pResources; delete g_pAudio; delete g_pInput; delete g_pGraphics; IwUtilTerminate(); return 0; }