]> git.lizzy.rs Git - nothing.git/blobdiff - src/main.c
Add TODO(#886)
[nothing.git] / src / main.c
index cd4011de75458cdd6f568220147ddb5ffa29d1d4..a369a61b5f565a780ccb61157f1616cfa63a8c61 100644 (file)
@@ -1,5 +1,4 @@
-#include <SDL2/SDL.h>
-#include <SDL2/SDL_mixer.h>
+#include <SDL.h>
 
 #include <stdint.h>
 #include <stdio.h>
 #include "sdl/renderer.h"
 #include "system/log.h"
 #include "system/lt.h"
-#include "system/lt/lt_adapters.h"
 
 #define SCREEN_WIDTH 800
 #define SCREEN_HEIGHT 600
 
 static void print_usage(FILE *stream)
 {
-    fprintf(stream, "Usage: nothing [--fps <fps>] <level-file>\n");
+    fprintf(stream, "Usage: nothing [--fps <fps>]\n");
 }
 
 int main(int argc, char *argv[])
 {
     srand((unsigned int) time(NULL));
 
-    Lt *const lt = create_lt();
+    Lt *lt = create_lt();
 
-    char *level_filename = NULL;
     int fps = 30;
 
     for (int i = 1; i < argc;) {
@@ -50,22 +47,17 @@ int main(int argc, char *argv[])
                 RETURN_LT(lt, -1);
             }
         } else {
-            level_filename = argv[i];
-            i++;
+            log_fail("Unknown flag %s\n", argv[i]);
+            print_usage(stderr);
+            RETURN_LT(lt, -1);
         }
     }
 
-    if (level_filename == NULL) {
-        log_fail("Path to level file is not provided\n");
-        print_usage(stderr);
-        RETURN_LT(lt, -1);
-    }
-
     if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
         log_fail("Could not initialize SDL: %s\n", SDL_GetError());
         RETURN_LT(lt, -1);
     }
-    PUSH_LT(lt, 42, SDL_Quit_lt);
+    PUSH_LT(lt, 42, SDL_Quit);
 
     SDL_ShowCursor(SDL_DISABLE);
 
@@ -117,16 +109,6 @@ int main(int argc, char *argv[])
         log_warn("Could not find any Sticks of the Joy\n");
     }
 
-    if (Mix_OpenAudio(
-            MIX_DEFAULT_FREQUENCY,
-            MIX_DEFAULT_FORMAT,
-            2,
-            1024) < 0) {
-        log_fail("Could not initialize the audio: %s\n", Mix_GetError());
-        RETURN_LT(lt, -1);
-    }
-    PUSH_LT(lt, 42, Mix_CloseAudio_lt);
-
     // ------------------------------
 
     const char * sound_sample_files[] = {
@@ -138,7 +120,7 @@ int main(int argc, char *argv[])
     Game *const game = PUSH_LT(
         lt,
         create_game(
-            level_filename,
+            "./levels/",
             sound_sample_files,
             sound_sample_files_count,
             renderer),