]> Shamusworld >> Repos - stargem2/blobdiff - src/timing.cpp
Converted to SDL 2, added fullscreen support (F12 to toggle).
[stargem2] / src / timing.cpp
index ebca2bfe6e6d9a561737c66cb70cfcb2c2106500..e7ac35f69fc63d1a33d49cbde607fa38acf03845 100755 (executable)
@@ -17,8 +17,7 @@
 //
 
 #include "timing.h"
-
-#include "types.h"
+#include <stdint.h>
 #include "log.h"
 
 #define EVENT_LIST_SIZE       512
@@ -40,19 +39,22 @@ struct Event
     void (* timerCallback)(void);
 };
 
+
 static Event eventList[EVENT_LIST_SIZE];
-static uint32 nextEvent;
+static uint32_t nextEvent;
+
 
 void InitializeEventList(void)
 {
-    for(uint32 i=0; i<EVENT_LIST_SIZE; i++)
+    for(uint32_t i=0; i<EVENT_LIST_SIZE; i++)
         eventList[i].valid = false;
 }
 
+
 //We just slap the next event into the list, no checking, no nada...
 void SetCallbackTime(void (* callback)(void), double time)
 {
-    for(uint32 i=0; i<EVENT_LIST_SIZE; i++)
+    for(uint32_t i=0; i<EVENT_LIST_SIZE; i++)
     {
         if (!eventList[i].valid)
         {
@@ -68,9 +70,10 @@ void SetCallbackTime(void (* callback)(void), double time)
     WriteLog("SetCallbackTime() failed to find an empty slot in the list!\n");
 }
 
+
 void RemoveCallback(void (* callback)(void))
 {
-    for(uint32 i=0; i<EVENT_LIST_SIZE; i++)
+    for(uint32_t i=0; i<EVENT_LIST_SIZE; i++)
     {
         if (eventList[i].valid && eventList[i].timerCallback == callback)
         {
@@ -81,9 +84,10 @@ void RemoveCallback(void (* callback)(void))
     }
 }
 
+
 void AdjustCallbackTime(void (* callback)(void), double time)
 {
-    for(uint32 i=0; i<EVENT_LIST_SIZE; i++)
+    for(uint32_t i=0; i<EVENT_LIST_SIZE; i++)
     {
         if (eventList[i].valid && eventList[i].timerCallback == callback)
         {
@@ -94,12 +98,13 @@ void AdjustCallbackTime(void (* callback)(void), double time)
     }
 }
 
+
 double GetTimeToNextEvent(void)
 {
     double time = 0;
     bool firstTime = true;
 
-    for(uint32 i=0; i<EVENT_LIST_SIZE; i++)
+    for(uint32_t i=0; i<EVENT_LIST_SIZE; i++)
     {
         if (eventList[i].valid)
         {
@@ -116,12 +121,13 @@ double GetTimeToNextEvent(void)
     return time;
 }
 
+
 void HandleNextEvent(void)
 {
     double elapsedTime = eventList[nextEvent].eventTime;
     void (* event)(void) = eventList[nextEvent].timerCallback;
 
-    for(uint32 i=0; i<EVENT_LIST_SIZE; i++)
+    for(uint32_t i=0; i<EVENT_LIST_SIZE; i++)
         if (eventList[i].valid)
             eventList[i].eventTime -= elapsedTime;
 
@@ -129,3 +135,4 @@ void HandleNextEvent(void)
 
     (*event)();
 }
+