[update] Added a debug-music-index command-line option.

This commit is contained in:
falsycat 2019-10-16 00:00:00 +00:00
parent 928be56f10
commit c146ab5366
3 changed files with 15 additions and 3 deletions

View File

@ -36,6 +36,7 @@ int main(string[] unparsed_args) {
private bool ParseArgs(string[] unparsed_args, out Args args) { private bool ParseArgs(string[] unparsed_args, out Args args) {
auto helpinfo = unparsed_args.getopt( auto helpinfo = unparsed_args.getopt(
"debug-music-index", &args.debug_music_index,
"window-size", &args.window_size "window-size", &args.window_size
); );

View File

@ -6,4 +6,7 @@ struct Args {
public: public:
/// ///
int window_size = 600; int window_size = 600;
///
int debug_music_index = -1;
} }

View File

@ -2,6 +2,7 @@
module sj.Game; module sj.Game;
import std.algorithm, import std.algorithm,
std.exception,
std.file, std.file,
std.json, std.json,
std.path; std.path;
@ -48,9 +49,16 @@ class Game : AbstractGame {
play_ .SetupSceneDependency(result_); play_ .SetupSceneDependency(result_);
result_.SetupSceneDependency(title_); result_.SetupSceneDependency(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(); title_.Initialize();
super(title_); super(title_);
} }
}
~this() { ~this() {
title_.destroy(); title_.destroy();