diff --git a/flake.nix b/flake.nix index 8c2340b..b9d5a01 100644 --- a/flake.nix +++ b/flake.nix @@ -16,8 +16,9 @@ packages = forEachSupportedSystem ({ pkgs }: { default = pkgs.writeShellScriptBin "mineschemer" '' LD_LIBRARY_PATH="${pkgs.raylib}/lib" \ - ${pkgs.chez}/bin/scheme \ - --script ${pkgs.writeText "main.scm" (builtins.readFile ./main.scm)} \ + ${pkgs.chez}/bin/scheme \ + --script ${./main.scm} \ + ${./skins/classic.bmp} \ $@ ''; }); diff --git a/main.scm b/main.scm index abe441f..01f91be 100644 --- a/main.scm +++ b/main.scm @@ -690,7 +690,7 @@ ; draw-game-over as a separate thing would be nice ; the game shows -99 when (- num-mines num-flagged) is less than -99 -(define (run-game mines width height seed) +(define (run-game mines width height seed skin-path) (init-window (* width square-width) (* height square-width) "mineschemer") (set-target-fps 60) @@ -698,7 +698,7 @@ (newline) (random-seed seed) - (let ([skin (load-skin "xp-flowers.bmp")] + (let ([skin (load-texture skin-path)] [game (new-game mines width height)]) ;; (display skin) ;; (newline) @@ -734,10 +734,12 @@ (time-nanosecond (current-time))) (unless (and - (>= 4 (length (command-line-arguments)) 3) - (for-all number? (map string->number (command-line-arguments)))) + (pair? (command-line-arguments)) + (>= 4 (length (cdr (command-line-arguments))) 3) + (for-all number? (map string->number (cdr (command-line-arguments))))) (display "i need 3-4 numbers (MINES WIDTH HEIGHT SEED)") (exit 1)) -(apply run-game (append (map string->number (command-line-arguments)) - (list (get-nano-seed)))) +; i really need some actual arg parsing this is embarassing +(apply run-game (append (map string->number (cdr (command-line-arguments))) + (list (get-nano-seed) (car (command-line-arguments))))) diff --git a/skins/classic.bmp b/skins/classic.bmp new file mode 100644 index 0000000..497fa26 Binary files /dev/null and b/skins/classic.bmp differ diff --git a/skins/ewq-inverted-colors.bmp b/skins/ewq-inverted-colors.bmp new file mode 100644 index 0000000..a59d0a0 Binary files /dev/null and b/skins/ewq-inverted-colors.bmp differ diff --git a/skins/xp-flowers.bmp b/skins/xp-flowers.bmp new file mode 100644 index 0000000..c5ea70f Binary files /dev/null and b/skins/xp-flowers.bmp differ