aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/main.c b/main.c
index e89aa1a..e497e73 100644
--- a/main.c
+++ b/main.c
@@ -2,8 +2,29 @@
2#define NONSTD_IMPLEMENTATION 2#define NONSTD_IMPLEMENTATION
3#define VFS_IMPLEMENTATION 3#define VFS_IMPLEMENTATION
4#include "all.h" 4#include "all.h"
5#include <getopt.h>
6#include <string.h>
7
8int main(int argc, char *argv[]) {
9 char map_path[256] = "maps/demo3.map";
10 bool skip_title = false;
11
12 static struct option long_options[] = {
13 {"map", required_argument, 0, 'm'},
14 {0, 0, 0, 0}
15 };
16
17 int opt;
18 int option_index = 0;
19 while ((opt = getopt_long_only(argc, argv, "m:", long_options, &option_index)) != -1) {
20 switch (opt) {
21 case 'm':
22 strncpy(map_path, optarg, sizeof(map_path) - 1);
23 skip_title = true;
24 break;
25 }
26 }
5 27
6int main(void) {
7 SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_HIGHDPI); 28 SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_HIGHDPI);
8 InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE); 29 InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE);
9 30
@@ -14,7 +35,17 @@ int main(void) {
14 SetTargetFPS(GetMonitorRefreshRate(monitor)); 35 SetTargetFPS(GetMonitorRefreshRate(monitor));
15 36
16 vfs_init("data.pak"); 37 vfs_init("data.pak");
17 InitGame("maps/demo3.map"); 38 InitGame();
39 SetMap(map_path);
40
41 if (skip_title) {
42 if (LoadMap(game.map_path)) {
43 game.mode = STATE_PLAYING;
44 game.cursor_captured = true;
45 DisableCursor();
46 }
47 }
48
18 game.vsync = true; 49 game.vsync = true;
19 50
20 while (!WindowShouldClose()) { 51 while (!WindowShouldClose()) {