int Core::RunCmdTool(int argc, char * argv[], AppHandle handle) { CoreWin32Platform * core = new CoreWin32Platform(); //core->CreateWin32Window(handle); //core->Run(); core->EnableConsoleMode(); core->CreateSingletons(); core->InitArgs(); Logger::Instance()->EnableConsoleMode(); FrameworkDidLaunched(); FrameworkWillTerminate(); core->ReleaseSingletons(); #ifdef ENABLE_MEMORY_MANAGER if (DAVA::MemoryManager::Instance() != 0) { DAVA::MemoryManager::Instance()->FinalLog(); } #endif return 0; }
void CorePlatformAndroid::Run() { willQuit = false; while (!willQuit) { // Read all pending events. int ident = 0; int events = 0; struct android_poll_source* source = NULL; // If not animating, we will block forever waiting for events. // If animating, we loop until all events are read, then continue // to draw the next frame of animation. while ((ident=ALooper_pollAll(animating ? 0 : -1, NULL, &events, (void**)&source)) >= 0) { // Process this event. if (source != NULL) { source->process(appHandle, source); } // If a sensor has data, process it now. if (ident == LOOPER_ID_USER) { if (accelerometerSensor != NULL) { ASensorEvent event; while (ASensorEventQueue_getEvents(sensorEventQueue, &event, 1) > 0) { // Logger::Info("accelerometer: x=%f y=%f z=%f", event.acceleration.x, event.acceleration.y, event.acceleration.z); } } } // Check if we are exiting. if (appHandle->destroyRequested != 0) { willQuit = true; break; } } if (animating && RenderManager::Instance()) { // Drawing is throttled to the screen update rate, so there // is no need to do timing here. // sleep(1); timespec sleepTime, sleepTime2; sleepTime.tv_nsec = 1000000; nanosleep(&sleepTime, &sleepTime2); DoFrame(); } } Core::Instance()->SystemAppFinished(); FrameworkWillTerminate(); }
void CoreWin32Platform::Run() { Core::Instance()->SystemAppStarted(); MSG msg; while(1) { DAVA::uint64 startTime = DAVA::SystemTimer::Instance()->AbsoluteMS(); // process messages willQuit = false; while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); if(msg.message == WM_QUIT) { ApplicationCore * appCore = Core::Instance()->GetApplicationCore(); if(appCore && appCore->OnQuit()) { exit(0); } else { willQuit = true; } } } RenderManager::Instance()->Lock(); Core::SystemProcessFrame(); RenderManager::Instance()->Unlock(); uint32 elapsedTime = (uint32) (SystemTimer::Instance()->AbsoluteMS() - startTime); int32 sleepMs = 1; int32 fps = RenderManager::Instance()->GetFPS(); if(fps > 0) { sleepMs = (1000 / fps) - elapsedTime; if(sleepMs < 1) { sleepMs = 1; } } Sleep(sleepMs); if (willQuit) { break; } } Core::Instance()->SystemAppFinished(); FrameworkWillTerminate(); }
void QtLayerWin32::AppFinished() { Core::Instance()->SystemAppFinished(); FrameworkWillTerminate(); Core::Instance()->ReleaseSingletons(); #ifdef ENABLE_MEMORY_MANAGER if (DAVA::MemoryManager::Instance() != 0) { DAVA::MemoryManager::Instance()->FinalLog(); } #endif CoreWin32Platform *core = dynamic_cast<CoreWin32Platform *>(CoreWin32Platform::Instance()); if (NULL != core) { CloseHandle(core->hMutex); } }
void CorePlatformAndroid::QuitAction() { Logger::Debug("[CorePlatformAndroid::QuitAction]"); if(Core::Instance()) { Core::Instance()->SystemAppFinished(); } FrameworkWillTerminate(); #ifdef ENABLE_MEMORY_MANAGER if (DAVA::MemoryManager::Instance() != 0) { DAVA::MemoryManager::Instance()->FinalLog(); } #endif Logger::Debug("[CorePlatformAndroid::QuitAction] done"); }
int Core::RunCmdTool(int argc, char *argv[], AppHandle handle) { DAVA::CoreMacOSPlatform * core = new DAVA::CoreMacOSPlatform(); core->SetCommandLine(argc, argv); core->EnableConsoleMode(); core->CreateSingletons(); FrameworkDidLaunched(); FrameworkWillTerminate(); core->ReleaseSingletons(); #ifdef ENABLE_MEMORY_MANAGER if (DAVA::MemoryManager::Instance() != 0) { DAVA::MemoryManager::Instance()->FinalLog(); } #endif return 0; }
void CoreWin32Platform::Run() { Core::Instance()->SystemAppStarted(); MSG msg; while(1) { // process messages willQuit = false; while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); if(msg.message == WM_QUIT) { ApplicationCore * appCore = Core::Instance()->GetApplicationCore(); if(appCore && appCore->OnQuit()) { exit(0); } else { willQuit = true; } } } Sleep(1); RenderManager::Instance()->Lock(); Core::SystemProcessFrame(); RenderManager::Instance()->Unlock(); if (willQuit) { break; } } Core::Instance()->SystemAppFinished(); FrameworkWillTerminate(); }