int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); if ( ! initInstance() || !applicationDidFinishLaunching() ) { return 0; } int64 updateTime = s3eTimerGetMs(); while (!s3eDeviceCheckQuitRequest()) { int64 currentTime = s3eTimerGetMs(); if (currentTime - updateTime > m_nAnimationInterval) { updateTime = currentTime; s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); CCDirector::sharedDirector()->mainLoop(); } else { s3eDeviceYield(0); } } return -1; }
//----------------------------------------------------------------------------- // Main global function //----------------------------------------------------------------------------- int main() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #ifndef IW_DEBUG DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again."); return 0; #endif #endif //IwGx can be initialised in a number of different configurations to help the linker eliminate unused code. //Normally, using IwGxInit() is sufficient. //To only include some configurations, see the documentation for IwGxInit_Base(), IwGxInit_GLRender() etc. IwGxInit(); // Example main loop ExampleInit(); // Set screen clear colour IwGxSetColClear(0xff, 0xff, 0xff, 0xff); IwGxPrintSetColour(128, 128, 128); while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); int64 start = s3eTimerGetMs(); bool result = ExampleUpdate(); if ( (result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest()) ) break; // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); RenderButtons(); RenderSoftkeys(); ExampleRender(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } } ExampleShutDown(); DeleteButtons(); IwGxTerminate(); return 0; }
// "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; }
int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); s3eBool quitRequested = 0; bool bNeedQuit = false; if (!applicationDidFinishLaunching() ) { return 0; } uint64 updateTime = 0 ; while (true) { updateTime = s3eTimerGetMs(); s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); quitRequested = s3eDeviceCheckQuitRequest(); if( quitRequested) { CCDirector* pDirector = CCDirector::sharedDirector(); // if opengl view has been released, delete the director. if (pDirector->getOpenGLView() == NULL) { CC_SAFE_DELETE(pDirector); bNeedQuit = true; } else { pDirector->end(); } } if( bNeedQuit ) { break; } CCDirector::sharedDirector()->mainLoop(); while ((s3eTimerGetMs() - updateTime) < m_nAnimationInterval) { int32 yield = (int32) (m_nAnimationInterval - (s3eTimerGetMs() - updateTime)); if (yield<0) break; s3eDeviceYield(yield); } } return -1; }
//----------------------------------------------------------------------------- // Main global function //----------------------------------------------------------------------------- int main() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #ifndef IW_DEBUG DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again."); return 0; #endif #endif Iw2DInit(); // Example main loop ExampleInit(); // Set screen clear colour while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); int64 start = s3eTimerGetMs(); bool result = ExampleUpdate(); if ( (result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest()) ) break; // Clear the screen Iw2DSurfaceClear(0xffffffff); RenderSoftkeys(); ExampleRender(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } } ExampleShutDown(); Iw2DTerminate(); return 0; }
int main() { IwGxInit(); IwGxSetColClear(0, 0, 0xff, 0xff); IwResManagerInit(); Iw2DInit(); setupTextures(); registerInput(); const int textWidth = s3eDebugGetInt(S3E_DEBUG_FONT_SIZE_WIDTH); const int textHeight = s3eDebugGetInt(S3E_DEBUG_FONT_SIZE_HEIGHT); const int width = s3eSurfaceGetInt(S3E_SURFACE_WIDTH); const int height = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT); sprintf(g_debugButtonEvent, "ButtonEvent:"); sprintf(g_debugKeyEvent, "KeyEvent:"); sprintf(g_debugMotionEvent, "MotionEvent:"); sprintf(g_debugTouchEvent, "TouchEvent:"); sprintf(g_debugTouchMotionEvent, "TouchMotionEvent:"); while (!s3eDeviceCheckQuitRequest()) { render(); // Yield until unyield is called or a quit request is recieved s3eDeviceYield(S3E_DEVICE_YIELD_FOREVER); } destroyTextures(); Iw2DTerminate(); IwResManagerTerminate(); IwGxTerminate(); return 0; }
// "main" is the S3E entry point int main() { if (s3eChartboostAvailable()) { s3eChartboostSetAppID("app id"); s3eChartboostSetAppSignature("app signature"); s3eChartboostInstall(); s3eChartboostShowInterstitial("pre-game"); } // to exit correctly, applications should poll for quit requests while(!s3eDeviceCheckQuitRequest()) { // S3E applications should yield frequently s3eDeviceYield(); } return 0; }
int main() { Iw2DInit(); TweenTest* tests = new TweenTest(); while (!s3eDeviceCheckQuitRequest()) { tests->Update(FRAME_TIME); Iw2DSurfaceClear(0xff000000); //tests->Render(); Iw2DSurfaceShow(); s3eDeviceYield(0); } delete tests; Iw2DTerminate(); return 0; }
int main() { // Start up Virtual Piggy VirtualPiggy::Create(); VIRTUAL_PIGGY->Init(VIRTUAL_PIGGY_API_KEY); VIRTUAL_PIGGY->setMerchantID(VIRTUAL_PIGGY_MERCHANT_ID); // TESTS: Run each test individually // TEST_ParentPurchase(); // TEST_ChildPurchase(); // TEST_ChildPurchaseSubscription(); // TEST_ParentPurchaseSubscription(); // TEST_GetChildAddress(); // TEST_GetChildGenderAge(); // TEST_GetLoyaltyBalance(); // TEST_GetParentAddress(); // TEST_GetParentChildAddress(); // TEST_MerchantCancelSubscription(); TEST_PingHeaders(); // Marmalade main loop while (!s3eDeviceCheckQuitRequest()) { VIRTUAL_PIGGY->Update(); s3eDeviceYield(0); } // Shut down Virtual Piggy VIRTUAL_PIGGY->Release(); VirtualPiggy::Destroy(); return 0; }
//-------------------------------------------------------------------------- // Main global function //-------------------------------------------------------------------------- S3E_MAIN_DECL void IwMain() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #endif // Example main loop ExampleInit(); uint64 timeOld = s3eTimerGetMs(); while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); uint64 timeNew = s3eTimerGetMs(); float dt = (timeNew - timeOld) * 0.001f; timeOld = timeNew; bool result = ExampleUpdate(dt); if ( (result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN)|| (s3eKeyboardGetState(s3eKeyLSK) & S3E_KEY_STATE_DOWN)|| (s3eDeviceCheckQuitRequest()) ) break; ExampleRender(); //s3eSurfaceShow(); } ExampleShutDown(); }
int main() { Iw2DInit(); CIw2DImage* g_AirplayLogo = Iw2DCreateImage("largeAirplayLogo.bmp"); while (1) { int64 start = s3eTimerGetMs(); if (s3eDeviceCheckQuitRequest()) break; // Clear the screen Iw2DSurfaceClear(0xffffffff); CIwSVec2 topLeft = CIwSVec2((int16)(Iw2DGetSurfaceWidth() / 2 - g_AirplayLogo->GetWidth() / 2), (int16)(Iw2DGetSurfaceHeight() / 2 - g_AirplayLogo->GetHeight() / 2)); CIwSVec2 size = CIwSVec2((int16)g_AirplayLogo->GetWidth(), (int16)g_AirplayLogo->GetHeight()); Iw2DDrawImage(g_AirplayLogo, topLeft, size); Iw2DSurfaceShow(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } } delete g_AirplayLogo; Iw2DTerminate(); return 0; }
//-------------------------------------------------------------------------- // Main global function //-------------------------------------------------------------------------- S3E_MAIN_DECL void IwMain() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #endif onInit(); while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); bool result = onUpdate(); if ( (result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyLSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest()) ) { break; } onRender(); s3eSurfaceShow(); } onShutDown(); }
COggVorbisFileHelper::~COggVorbisFileHelper() { stop(); bStopDecoding = true; while(mDecThread.thread_status == CThread::TRUNNING) { s3eDebugTracePrintf("waiting decoding thread terminating\n"); s3eDeviceYield(10); } if(mDecBuffer != NULL) { delete mDecBuffer; mDecBuffer = NULL; } //cleanup(); if(res_contR) speex_resampler_destroy(res_contR); if(res_contL) speex_resampler_destroy(res_contL); delete [] iFilterBufferL; delete [] iFilterBufferR; delete [] dFilterCoefficients; delete [] m_outL; delete [] m_outR; /*if(nStatus != OH_NAN) ov_clear(&vf);*/ }
S3E_MAIN_DECL int main() { s3eBool available = FortumoAvailable(); Fortumo_SetLoggingEnabled(true); while(!s3eDeviceCheckQuitRequest()) { s3eDeviceYield(0); s3ePointerUpdate(); s3eDebugPrint(0, 30, (available) ? "Fortumo (OK)" : "Fortumo (ERR)", 0); s3eSurfaceShow(); if(available && (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED)) { Fortumo_PaymentRequest *request = Fortumo_PaymentRequest_Create(); Fortumo_PaymentRequest_SetDisplayString(request, "display_string_here"); Fortumo_PaymentRequest_SetService(request, "service_id_here", "app_secret_here"); Fortumo_PaymentRequest_SetProductName(request, "product_name_here"); Fortumo_PaymentRequest_SetConsumable(request, true); Fortumo_MakePayment(request, &Fortumo_OnPaymentComplete, NULL); Fortumo_PaymentRequest_Delete(request); } } return 0; }
// Main entry point for the application int main() { int i = 0; bool hidden = false; bool adsAvailable = false; bool noView = false; if(AdmobAdsAvailable()){ InitAds("a14bd815ee70598"); adsAvailable = true; } // Wait for a quit request from the host OS while (!s3eDeviceCheckQuitRequest()) { // Fill background blue s3eSurfaceClear(0, 0, 255); // Print a line of debug text to the screen at top left (0,0) // Starting the text with the ` (backtick) char followed by 'x' and a hex value // determines the colour of the text. s3eDebugPrint(120, 150, "`xffffffHello, World!", 0); if (noView){ s3eDebugPrint(120, 190, "`xff1111No view", 0); }else{ s3eDebugPrint(120, 190, "`x11ff11Ok", 0); } // Flip the surface buffer to screen s3eSurfaceShow(); // Sleep for 0ms to allow the OS to process events etc. s3eDeviceYield(1); if(adsAvailable){ i++; if(i>15000){ i = 0; if (hidden) { noView = ShowAds() != 0; } else { noView = HideAds() != 0; } hidden = !hidden; } } s3eKeyboardUpdate(); if(s3eKeyboardGetState(s3eKeyBack) & S3E_KEY_STATE_DOWN){ break; } } return 0; }
bool Notify(CIwUIElement* pReceiver, CIwEvent* pEvent) { int id = pEvent->GetID(); if (id == IWUI_EVENT_CLICK) { CIwUIEventClick* a = (CIwUIEventClick*)pEvent; if (!a->GetPressed()) { EventStruct x; x.pReceiver = pReceiver; x.pEvent = IW_GX_ALLOC(CIwUIEventClick, 1); memcpy(x.pEvent, a, sizeof(CIwUIEventClick)); g_events.append(x); return true; } } return CIwUIController::Notify(pReceiver, pEvent); if (pEvent->GetSender()) { s3eDeviceYield(0); return true; } return CIwUIController::FilterEvent(pEvent); }
void endOfGame() { SplashInit(); SplashUpdate("continue"); SplashRender(); IwGxLightingOn(); gameFinalRender(); IwGxFlush(); IwGxSwapBuffers(); while(!s3eDeviceCheckQuitRequest()) { int64 start = s3eTimerGetMs(); while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } if (g_Input.getTouchCount() != 0) { s3eResult g_result = s3eOSExecExecute("http://www.facebook.com/Baconbb10", true); } } }
//! runs the device. Returns false if device wants to be deleted bool CIrrDeviceMarmalade::run() { s3eDeviceYield(); s3ePointerUpdate(); s3eKeyboardUpdate(); os::Timer::tick(); return !Close; }
void N2F::Iw3D::Iw2DHelper::EndTick() { IwGxFlush(); Iw2DSurfaceShow(); s3eDeviceYield(0); return; }
int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); s3eBool quitRequested = 0; if ( ! initInstance() || !applicationDidFinishLaunching() ) { return 0; } int64 updateTime = s3eTimerGetMs(); while (true) { int64 currentTime = s3eTimerGetMs(); if (currentTime - updateTime > m_nAnimationInterval) { updateTime = currentTime; s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); quitRequested = s3eDeviceCheckQuitRequest() ; if( quitRequested && CCDirector::sharedDirector()->getOpenGLView() != NULL ) { CCDirector::sharedDirector()->end() ; // end status will be processed in CCDirector::sharedDirector()->mainLoop(); } CCDirector::sharedDirector()->mainLoop(); if( quitRequested ) { break ; } } else { s3eDeviceYield(0); } } return -1; }
int redisContextConnectTcpS3E(redisContext *c, const char *addr, int port) { int32 counter = 0; s3eInetAddress s3eaddr; uint64 testStartTime; memset(&s3eaddr, 0, sizeof(s3eaddr)); c->socket = s3eSocketCreate(S3E_SOCKET_TCP, 0); if (c->socket == NULL) return REDIS_ERR; c->flags &= ~REDIS_CONNECTED; if (s3eInetLookup(addr, &s3eaddr, NULL, NULL) == S3E_RESULT_ERROR) return REDIS_ERR; s3eaddr.m_Port = s3eInetHtons(port); if (s3eSocketConnect(c->socket, &s3eaddr, &redisContextConnectTcpS3ECB, c) != S3E_RESULT_SUCCESS) { switch (s3eSocketGetError()) { // These errors are 'OK', because they mean, // that a connect is in progress case S3E_SOCKET_ERR_INPROGRESS: case S3E_SOCKET_ERR_ALREADY: case S3E_SOCKET_ERR_WOULDBLOCK: break; default: return REDIS_ERR; } testStartTime = s3eTimerGetMs(); while (!s3eDeviceCheckQuitRequest() && s3eTimerGetMs()-testStartTime < 30000) { // Stop waiting since socket is now connected if (c->flags & REDIS_CONNECTED) break; // trying to connect ... s3eDeviceYield(30); } } if (c->flags & REDIS_CONNECTED) { s3eSocketSetOpt(c->socket,S3E_SOCKET_NODELAY,0,0); return REDIS_OK; } else { s3eSocketClose(c->socket); c->socket=NULL; return REDIS_ERR; } }
int main() { IwGxInit(); Iw2DInit(); AppWarp::Client* WarpClientRef; AppWarp::Client::initialize("b29f4030aba3b2bc7002c4eae6815a4130c862c386e43ae2a0a092b27de1c5af","bf45f27e826039754f8dda659166d59ffb7b9dce830ac51d6e6b576ae4b26f7e"); WarpClientRef = AppWarp::Client::getInstance(); MenuScreen *menu = new MenuScreen; GameScreen *game = new GameScreen(WarpClientRef); Game *gm = new Game; gm->AddScene("game",game); gm->AddScene("menu",menu); menu->game = game; menu->app = gm; Listener listener(WarpClientRef,game); WarpClientRef->setConnectionRequestListener(&listener); WarpClientRef->setRoomRequestListener(&listener); WarpClientRef->setNotificationListener(&listener); s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB,gm); while(!s3eDeviceCheckQuitRequest()) { s3eKeyboardUpdate(); if(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) break; WarpClientRef->update(); s3ePointerUpdate(); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); IwGxPrintSetScale(2); IwGxPrintString(0,0,game->msg.c_str()); gm->Move(); gm->Render(); Iw2DSurfaceShow(); s3eDeviceYield(); } s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB); gm->CleanUp(); delete menu; delete game; delete gm; WarpClientRef->terminate(); Iw2DTerminate(); IwGxTerminate(); }
void COggVorbisFileHelper::decode_loop() { int res = EOK; while(res != EOS) { res = decode(); s3eDeviceYield(); } }
int main() { char animatingText[] = "... Some Animating Text ..."; uint64 animatingTextTimer; // seed RNG int32 ms = (int32)s3eTimerGetMs(); IwRandSeed(ms); // create our Marmalade UI interface ExampleUI *ui = new ExampleUI(); ui->Log("main()"); //ui->EnableAllButtons(false); // Attempt to start up the Store interface s3eAndroidGooglePlayBillingStart(publicKey); // register callbacks and pass in our UI pointer which the callback s3eAndroidGooglePlayBillingRegister(S3E_ANDROIDGOOGLEPLAYBILLING_LIST_PRODUCTS_CALLBACK,ListCallback,ui); s3eAndroidGooglePlayBillingRegister(S3E_ANDROIDGOOGLEPLAYBILLING_RESTORE_CALLBACK,RestoreCallback,ui); s3eAndroidGooglePlayBillingRegister(S3E_ANDROIDGOOGLEPLAYBILLING_PURCHASE_CALLBACK,PurchaseCallback,ui); s3eAndroidGooglePlayBillingRegister(S3E_ANDROIDGOOGLEPLAYBILLING_CONSUME_CALLBACK,ConsumeCallback,ui); ui->SetStatusText((s3eAndroidGooglePlayBillingIsSupported())?"Initialised":"Unitialised"); // create the Unit Test singleton //gTests = new UnitTests(ui); // DH: Not implemented for this extension yet animatingTextTimer = s3eTimerGetMs(); // run the app while (1) { //gTests->Update(); // update the tests if they're running //s3eAndroidGooglePlayBillingIsSupported() // animate the text if (s3eTimerGetMs() > animatingTextTimer + 20) { int len = strlen(animatingText); char c = animatingText[0]; memmove(animatingText,animatingText+1,len-1); animatingText[len-1] = c; ui->SetAnimatingText(animatingText); animatingTextTimer = s3eTimerGetMs(); } //ui->SetStatusText((s3eAndroidGooglePlayBillingIsSupported())?"Initialised":"Unitialised"); // annoying log spam ui->Update(); // update the UI s3eDeviceYield(); } return 0; }
bool ExamplesMainUpdate() { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); int64 start = s3eTimerGetMs(); if (!ExampleUpdate() || ExampleCheckQuit()) { s3eDebugTracePrintf("ExampleUpdate returned false, exiting.."); return false; } // Clear the screen if (g_ClearScreen) IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); ButtonsRender(); if (g_DrawCursor) CursorRender(); SoftkeysRender(); // User code render ExampleRender(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } IwGxFlush(); IwGxSwapBuffers(); return true; }
int main() { Iw2DInit(); game = new Game(); game->Initialize(); game->NewGame(); int currentUpdate = GetUpdateFrame(); int nextUpdate = currentUpdate; s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback) MouseEventCallback, NULL); while(!s3eDeviceCheckQuitRequest()) { while(!s3eDeviceCheckQuitRequest()) { nextUpdate = GetUpdateFrame(); if( nextUpdate != currentUpdate ) break; s3eDeviceYield(1); } // execute update steps int frames = nextUpdate - currentUpdate; frames = MIN(MAX_UPDATES, frames); while(frames--) { game->Update(); } Iw2DSurfaceClear(0xffffffff); game->Render(); Iw2DSurfaceShow(); s3ePointerUpdate(); s3eKeyboardUpdate(); s3eDeviceYield(); } delete game; Iw2DTerminate(); return 0; }
int main() { Initialize(); // --HowTo: Load the tmx map from the json file tmxparser::Map_t *map = new tmxparser::Map_t; tmxparser::parseTmxFromJSON_file("testLevel.json", map); // --HowTo: Create a renderer tmxparser::TmxRenderer *renderer = new tmxparser::TmxRenderer(map); // an offset to use for scrolling the map CIwFVec2 offset(0,0); IwGxSetColClear(0x2f, 0x3f, 0x3f, 0xff); // Loop forever, until the user or the OS performs some action to quit the app while (!s3eDeviceCheckQuitRequest()) { //Update the input systems s3eKeyboardUpdate(); s3ePointerUpdate(); // Clear the surface IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); // --HowTo: render all layers, at original pixel size: //renderer->Render(offset); // --HowTo: render all layers at reduced/scaled tile size renderer->Render(offset, CIwFVec2(64.0f, 64.0f)); // --HowTo: render only one layer at original pixel size //renderer->RenderLayer(0, offset, CIwFVec2(0.0f, 0.0f)); // --HowTo: render only one layer at scaled pixel size //renderer->RenderLayer(0, offset, CIwFVec2(64.0f, 64.0f)); // advance offset offset.x += 3; if (offset.x>1900) offset.x =0; // Standard EGL-style flush of drawing to the surface IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(0); } delete renderer; delete map; Terminate(); // Return return 0; }
//! pause execution for a specified time void CIrrDeviceMarmalade::sleep(u32 timeMs, bool pauseTimer) { const bool wasStopped = Timer ? Timer->isStopped() : true; if (pauseTimer && !wasStopped) Timer->stop(); s3eDeviceYield(timeMs); if (pauseTimer && !wasStopped) Timer->start(); }
void COggVorbisFileHelper::cleanup() { if(nSoundChannel >= 0) s3eSoundChannelStop(nSoundChannel); bStopDecoding = true; while(mDecThread.thread_status == CThread::TRUNNING) { s3eDebugTracePrintf("waiting decoding thread terminating\n"); s3eDeviceYield(10); } if(nSoundChannel != -1) { s3eSoundChannelUnRegister(nSoundChannel, S3E_CHANNEL_GEN_AUDIO_STEREO); s3eSoundChannelUnRegister(nSoundChannel, S3E_CHANNEL_GEN_AUDIO); s3eSoundChannelUnRegister(nSoundChannel, S3E_CHANNEL_END_SAMPLE); } //m_resampler.clear(); total_samples = 0; nChannels = 0; nRate = 0; time_length = 0; current_time = 0; current_sample = 0; current_section = 0; nSoundChannel = -1; nOutputRate = 0; bOutputIsStereo = -1; dResampleFactor = 0; wait_counter = 0; nStatus = OH_NAN; nW = 0; nL = 0; bStopDecoding = false; stereoOutputMode = STEREO_MODE_MONO; rcb_len = 0; ov_clear(&vf); oggvorbis_filein = NULL; if(vi) { vorbis_info_clear(vi); vi = NULL; } nResampleQuality = 0; bEnableResampling = false; }
void ciclo() { if (g_Input.getSound()) g_Input.playSong(); while (!s3eDeviceCheckQuitRequest()) { if (g_Input.getLifes()<1) { gameOver(); } if (menuB) break; s3eDeviceBacklightOn(); g_Input.updateSound(); s3eDeviceYield(0); int64 start = s3eTimerGetMs(); bool result = BaconUpdate(); bool result2 = FondoUpdate(); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); IwGxLightingOff(); FondoRender(); LifeStatusRender(); BaconRender(); insertaObstaculos(); spriteManager->render(); chuletas->render(); tank->render(); IwGxLightingOn(); FontLifeRender(); FontCoinsRender(); IwGxFlush(); IwGxSwapBuffers(); //g_Input.setScore(g_Input.getScore()+1); // Attempt frame rate /*while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); }*/ } }