-#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;) {
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);
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[] = {
Game *const game = PUSH_LT(
lt,
create_game(
- level_filename,
+ "./levels/",
sound_sample_files,
sound_sample_files_count,
renderer),