diff --git a/src/main.d b/src/main.d index 25541f9..842b2dc 100644 --- a/src/main.d +++ b/src/main.d @@ -36,7 +36,8 @@ int main(string[] unparsed_args) { private bool ParseArgs(string[] unparsed_args, out Args args) { auto helpinfo = unparsed_args.getopt( - "window-size", &args.window_size + "debug-music-index", &args.debug_music_index, + "window-size", &args.window_size ); auto valid = true; diff --git a/src/sj/Args.d b/src/sj/Args.d index c838f8a..e3de3fe 100644 --- a/src/sj/Args.d +++ b/src/sj/Args.d @@ -6,4 +6,7 @@ struct Args { public: /// int window_size = 600; + + /// + int debug_music_index = -1; } diff --git a/src/sj/Game.d b/src/sj/Game.d index e85efdd..4dc77f9 100644 --- a/src/sj/Game.d +++ b/src/sj/Game.d @@ -2,6 +2,7 @@ module sj.Game; import std.algorithm, + std.exception, std.file, std.json, std.path; @@ -48,8 +49,15 @@ class Game : AbstractGame { play_ .SetupSceneDependency(result_); result_.SetupSceneDependency(title_); - title_.Initialize(); - super(title_); + if (args.debug_music_index >= 0) { + enforce(args.debug_music_index < music_list.length); + load_.Initialize(music_list_[args.debug_music_index]); + super(load_); + + } else { + title_.Initialize(); + super(title_); + } } ~this() {