Guest User

Untitled

a guest
Sep 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. /*
  2. * This file is part of the Marmalade SDK Code Samples.
  3. *
  4. * Copyright (C) 2001-2011 Ideaworks3D Ltd.
  5. * All Rights Reserved.
  6. *
  7. * This source code is intended only as a supplement to Ideaworks Labs
  8. * Development Tools and/or on-line documentation.
  9. *
  10. * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  11. * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  12. * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  13. * PARTICULAR PURPOSE.
  14. */
  15.  
  16. #include "s3e.h"
  17.  
  18. // Include the single header file for the IwGx module
  19. #include "IwGx.h"
  20.  
  21. //duration of one frame in milliseconds
  22. float durationOfOneFrame = 1000/30.0f;
  23.  
  24. //the time passed since the marmalade application is run
  25. uint64 lastFrameTime = s3eTimerGetMs();
  26.  
  27.  
  28. float time_scale = 1.0f;
  29.  
  30. // Standard C-style entry point. This can take args if required.
  31. int main()
  32. {
  33.  
  34. // Initialise the IwGx drawing module
  35. IwGxInit();
  36.  
  37. // Set the background colour to (opaque) blue
  38. IwGxSetColClear(0, 0, 0xff, 0xff);
  39.  
  40. float timer = 0.0f;
  41. int textDisplay = 0;
  42. uint64 currentFrameTime = 0;
  43.  
  44. // Loop forever, until the user or the OS performs some action to quit the app
  45. while(!s3eDeviceCheckQuitRequest())
  46. {
  47. // Clear the surface
  48. IwGxClear();
  49.  
  50.  
  51. if (timer >= 1000.0f)
  52. {
  53. if(textDisplay == 2)
  54. {
  55. textDisplay = 0;
  56. }
  57. else
  58. {
  59. textDisplay++;
  60. }
  61.  
  62. timer = 0.0f;
  63. }
  64. else
  65. {
  66. currentFrameTime = s3eTimerGetMs();
  67. timer += (lastFrameTime - currentFrameTime);
  68. lastFrameTime = currentFrameTime;
  69. }
  70.  
  71. switch(textDisplay)
  72. {
  73. case 0:
  74. // Use the built-in font to display a string at coordinate (120, 150)
  75. IwGxPrintString(120, 150, "Hello, World!");
  76. break;
  77. case 1:
  78. // Use the built-in font to display a string at coordinate (120, 150)
  79. IwGxPrintString(120, 150, "It's been nice");
  80. break;
  81. case 2:
  82. // Use the built-in font to display a string at coordinate (120, 150)
  83. IwGxPrintString(120, 150, "Let's work together!");
  84. break;
  85. }
  86.  
  87. // Standard EGL-style flush of drawing to the surface
  88. IwGxFlush();
  89.  
  90. // Standard EGL-style flipping of double-buffers
  91. IwGxSwapBuffers();
  92.  
  93. // Sleep for 0ms to allow the OS to process events etc.
  94. s3eDeviceYield(0);
  95. }
  96.  
  97. // Shut down the IwGx drawing module
  98. IwGxTerminate();
  99.  
  100. // Return
  101. return 0;
  102. }
Add Comment
Please, Sign In to add comment