+static void DrawFrameTicks(void)
+{
+ uint32_t color = 0x00FF2020;
+ uint32_t address = 8 + (24 * VIRTUAL_SCREEN_WIDTH);
+
+ for(uint32_t i=0; i<17; i++)
+ {
+ for(uint32_t yy=0; yy<5; yy++)
+ {
+ for(uint32_t xx=0; xx<9; xx++)
+ {
+//THIS IS NOT ENDIAN SAFE
+//NB: Setting the alpha channel here does nothing.
+ *(scrBuffer + address + xx + (yy * VIRTUAL_SCREEN_WIDTH)) = 0x7F000000;
+ }
+ }
+
+ address += (5 * VIRTUAL_SCREEN_WIDTH);
+ }
+
+ address = 8 + (24 * VIRTUAL_SCREEN_WIDTH);
+
+ // frameTicks is the amount of time remaining; so to show the amount
+ // consumed, we subtract it from 17.
+ uint32_t bars = 17 - frameTicks;
+
+ if (bars & 0x80000000)
+ bars = 0;
+
+ for(uint32_t i=0; i<17; i++)
+ {
+ for(uint32_t yy=1; yy<4; yy++)
+ {
+ for(uint32_t xx=1; xx<8; xx++)
+ {
+//THIS IS NOT ENDIAN SAFE
+//NB: Setting the alpha channel here does nothing.
+ *(scrBuffer + address + xx + (yy * VIRTUAL_SCREEN_WIDTH)) = (i < bars ? color : 0x003F0000);
+ }
+ }
+
+ address += (5 * VIRTUAL_SCREEN_WIDTH);
+ }
+
+ static char msg[32];
+
+ if ((frameTimePtr % 15) == 0)
+ {
+// uint32_t prevClock = (frameTimePtr + 1) % 60;
+ uint64_t prevClock = (frameTimePtr + 1) % 60;
+// float fps = 59.0f / (((float)frameTime[frameTimePtr] - (float)frameTime[prevClock]) / 1000.0f);
+ double fps = 59.0 / ((double)(frameTime[frameTimePtr] - frameTime[prevClock]) / (double)SDL_GetPerformanceFrequency());
+ sprintf(msg, "%.1lf FPS", fps);
+ }
+
+ DrawString(20, 24, color, msg);
+}
+
+