Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This file is part of the Marmalade SDK Code Samples.
- *
- * Copyright (C) 2001-2011 Ideaworks3D Ltd.
- * All Rights Reserved.
- *
- * This source code is intended only as a supplement to Ideaworks Labs
- * Development Tools and/or on-line documentation.
- *
- * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
- * PARTICULAR PURPOSE.
- */
- #include "s3e.h"
- // Include the single header file for the IwGx module
- #include "IwGx.h"
- //duration of one frame in milliseconds
- float durationOfOneFrame = 1000/30.0f;
- //the time passed since the marmalade application is run
- uint64 lastFrameTime = s3eTimerGetMs();
- float time_scale = 1.0f;
- // Standard C-style entry point. This can take args if required.
- int main()
- {
- // Initialise the IwGx drawing module
- IwGxInit();
- // Set the background colour to (opaque) blue
- IwGxSetColClear(0, 0, 0xff, 0xff);
- float timer = 0.0f;
- int textDisplay = 0;
- uint64 currentFrameTime = 0;
- // Loop forever, until the user or the OS performs some action to quit the app
- while(!s3eDeviceCheckQuitRequest())
- {
- // Clear the surface
- IwGxClear();
- if (timer >= 1000.0f)
- {
- if(textDisplay == 2)
- {
- textDisplay = 0;
- }
- else
- {
- textDisplay++;
- }
- timer = 0.0f;
- }
- else
- {
- currentFrameTime = s3eTimerGetMs();
- timer += (lastFrameTime - currentFrameTime);
- lastFrameTime = currentFrameTime;
- }
- switch(textDisplay)
- {
- case 0:
- // Use the built-in font to display a string at coordinate (120, 150)
- IwGxPrintString(120, 150, "Hello, World!");
- break;
- case 1:
- // Use the built-in font to display a string at coordinate (120, 150)
- IwGxPrintString(120, 150, "It's been nice");
- break;
- case 2:
- // Use the built-in font to display a string at coordinate (120, 150)
- IwGxPrintString(120, 150, "Let's work together!");
- break;
- }
- // Standard EGL-style flush of drawing to the surface
- IwGxFlush();
- // Standard EGL-style flipping of double-buffers
- IwGxSwapBuffers();
- // Sleep for 0ms to allow the OS to process events etc.
- s3eDeviceYield(0);
- }
- // Shut down the IwGx drawing module
- IwGxTerminate();
- // Return
- return 0;
- }
Add Comment
Please, Sign In to add comment