DEADSOFTWARE

implement optional opengl render
[flatwaifu.git] / src / main.c
index 81c257ce0a40d7914b6fb719f22923c53fbbbb01..edf7156aedddd98fffb899796f534cdcb4e2dd01 100644 (file)
 #include "player.h"
 #include "my.h"
 #include "render.h"
+#include "game.h"
+#include "music.h"
 
 #include <SDL.h>
 
-void logo(const char *s,...) {
-  va_list ap;
-  int x,y;
-
-  va_start(ap,s);
-  vprintf(s,ap);
-  va_end(ap);
-  fflush(stdout);
-}
-
-void logo_gas(int cur,int all) {
-}
-
-void myrandomize(void);
-
 int main(int argc, char *argv[]) {
   if (SDL_Init(SDL_INIT_VIDEO)<0) ERR_failinit("Unable to init SDL: %s\n", SDL_GetError());
   SDL_WM_SetCaption("Doom 2D v1.351", "Doom 2D");
@@ -106,22 +93,16 @@ int main(int argc, char *argv[]) {
   F_loadmus("MENU");
   S_startmusic(0);
   
-  Uint32 ticks = 0;
-  for(;;) {
-
+  Uint32 ticks = SDL_GetTicks();
+  for (;;) {
     updatee_keys();
-
     S_updatemusic();
-
-    G_act();
-
-    R_draw();
-    
-    Uint32 t;
-    while ((t = SDL_GetTicks())-ticks < DELAY) {
-        SDL_Delay(1);
+    Uint32 t = SDL_GetTicks();
+    if (t - ticks > DELAY) {
+      ticks = t;
+      G_act();
     }
-    ticks = t - t % DELAY;
-
+    R_draw();
+    //SDL_Delay(1);
   }
 }