// "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 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; }
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; }
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; }
//-------------------------------------------------------------------------- // 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(); }
// 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; }
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; }
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); } } }
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" 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; }
//----------------------------------------------------------------------------- // 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; }
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(); }
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; } }
bool ExampleCheckQuit() { bool rtn = s3eDeviceCheckQuitRequest() || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_PRESSED) || (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_PRESSED); if (rtn) s3eDebugTracePrintf("quiting example"); return rtn; }
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; }
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; }
// Example showing how to use the s3eWwise extension int main() { IW_CALLSTACK("main"); s3eDebugOutputString("Booting s3eWwise example"); initWwise(); s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent, NULL); s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent, NULL); IwGxInit(); IwGxSetColClear(0, 0, 0, 0xff); while(!s3eDeviceCheckQuitRequest()) { std::stringstream str; s3eWwiseSoundEngineRenderAudio(); IwGxClear(); IwGxPrintString(100, 100, "s3eWwise"); IwGxPrintString(100, 300, "Touch to fire event"); str << "RPM = " << rpm; IwGxPrintString(100, 400, str.str().c_str()); str.str(std::string()); str << "TH = " << touchHeight; IwGxPrintString(100, 500, str.str().c_str()); str.str(std::string()); str << "Height = " << height; IwGxPrintString(100, 600, str.str().c_str()); str.str(std::string()); IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(0); } IwGxTerminate(); s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent); s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent); shutdownWwise(); return 0; }
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); }*/ } }
int main() { Initialise(); while (!s3eDeviceCheckQuitRequest()) { Update(); Render(); } Terminate(); return 0; }
//----------------------------------------------------------------------------- // 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; }
// Main entry point for the application int main() { message = "`xffffff"; if (s3ePushWooshNotificationsAvailable()) { s3ePushWooshRegister(S3E_PUSHWOOSH_REGISTRATION_SUCCEEDED, (s3eCallback)&OnPushRegistered, 0); s3ePushWooshRegister(S3E_PUSHWOOSH_MESSAGE_RECEIVED, (s3eCallback)&OnPushReceived, 0); s3ePushWooshRegister(S3E_PUSHWOOSH_REGISTRATION_ERROR, (s3eCallback)&OnPushRegisterError, 0); //s3ePushWooshNotificationRegister(); const char* cstrApp = PW_APPID.c_str(); s3ePushWooshNotificationRegisterWithPWAppID(cstrApp); s3ePushWooshStartLocationTracking(); s3ePushWooshNotificationSetBadgeNumber(6); //Sample code for using local notifications //Currently this is available for Android only. You can use default Marmalade extension for iOS local notifications at this time. //s3ePushWooshClearLocalNotifications(); //30 seconds for local notification to fire //s3ePushWooshScheduleLocalNotification("Your pumpkins are ready!", 30, 0); // postEvent example //s3ePushWooshSetUserId("${userId}"); //s3ePushWooshPostEvent("testEvent", "{ \"attribute\" : \"value\" }"); } // 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, message.c_str(), 0); // else // s3eDebugPrint(120, 150, "`xffffffNot available :(", 0); // Flip the surface buffer to screen s3eSurfaceShow(); // Sleep for 0ms to allow the OS to process events etc. s3eDeviceYield(0); } return 0; }
int main() { // Initialise the 2D graphics system Iw2DInit(); // Set up input systems g_pInput = new Input(); // Create an image from a PNG file CIw2DImage* image = Iw2DCreateImage("textures/letter_A.png"); CIwFVec2 image_position = CIwFVec2::g_Zero; // Loop forever, until the user or the OS performs some action to quit the app while (!s3eDeviceCheckQuitRequest()) { // Update input system g_pInput->Update(); // Clear the drawing surface Iw2DSurfaceClear(0xff000000); // Draw an image CIwFVec2 sz = CIwFVec2(50, 50); Iw2DDrawImage(image, image_position, sz); // Check for user tapping screen if (!g_pInput->m_Touched && g_pInput->m_PrevTouched) { // Move image to touched position image_position.x = (float)g_pInput->m_X - 25; image_position.y = (float)g_pInput->m_Y - 25; // Reset input g_pInput->Reset(); } // Show the drawing surface Iw2DSurfaceShow(); // Yield to the OS s3eDeviceYield(0); } // Clean-up delete image; delete g_pInput; Iw2DTerminate(); return 0; }
int HelloWorldMain() { HelloWorldInit(); while (!s3eDeviceCheckQuitRequest()) { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); HelloWorldRender(); if(!HelloWorldUpdate()) break; } HelloWorldShutDown(); return 0; }
int main(int argc, char **argv) { IwGLInit(); AndroidInit(); s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, key_handler, NULL); while (!s3eDeviceCheckQuitRequest()) { AndroidStep(IwGLGetInt(IW_GL_WIDTH), IwGLGetInt(IW_GL_HEIGHT)); s3eDeviceYield(0); IwGLSwapBuffers(); } AndroidQuit(); }
// Main entry point for the application int main() { // Initialise Iw2D Iw2DInit(); // Get surface width and height int surface_width = Iw2DGetSurfaceWidth(); int surface_height = Iw2DGetSurfaceHeight(); // Rotation angle of rectangle float angle = 0; // Wait for a quit request from the host OS while (!s3eDeviceCheckQuitRequest()) { // Clear background to blue Iw2DSurfaceClear(0xff8080); // Set up a transform CIwFMat2D mat; mat.SetRot(angle); mat.ScaleRot(2.0f); mat.SetTrans(CIwFVec2((float)surface_width / 2, (float)surface_height / 2)); Iw2DSetTransformMatrix(mat); angle += 0.01f; // Render filled rectangle Iw2DSetColour(0xff00ffff); Iw2DFillRect(CIwFVec2(-50.0f, -100.0f), CIwFVec2(100.0f, 200.0f)); // Render filled arc Iw2DSetColour(0xffff00ff); Iw2DFillArc(CIwFVec2(0, 0), CIwFVec2(100.0f, 100.0f), 0, 1.8 * PI); // Flip the surface buffer to screen Iw2DSurfaceShow(); // Sleep to allow the OS to process events etc. s3eDeviceYield(0); } // Shut down Iw2D Iw2DTerminate(); return 0; }
// Helper function to display message for Debug-Only Examples void DisplayMessage(const char* strmessage) { uint16* screen = (uint16*)s3eSurfacePtr(); int32 width = s3eSurfaceGetInt(S3E_SURFACE_WIDTH); int32 height = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT); int32 pitch = s3eSurfaceGetInt(S3E_SURFACE_PITCH); for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) screen[y * pitch/2 + x] = 0; s3eDebugPrint(0, 10, strmessage, 1); s3eSurfaceShow(); while (!s3eDeviceCheckQuitRequest() && !s3eKeyboardAnyKey()) { s3eDeviceYield(0); s3eKeyboardUpdate(); } }
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; }