[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,7 +36,8 @@ 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(
"window-size", &args.window_size "debug-music-index", &args.debug_music_index,
"window-size", &args.window_size
); );
auto valid = true; auto valid = true;

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,8 +49,15 @@ class Game : AbstractGame {
play_ .SetupSceneDependency(result_); play_ .SetupSceneDependency(result_);
result_.SetupSceneDependency(title_); result_.SetupSceneDependency(title_);
title_.Initialize(); if (args.debug_music_index >= 0) {
super(title_); enforce(args.debug_music_index < music_list.length);
load_.Initialize(music_list_[args.debug_music_index]);
super(load_);
} else {
title_.Initialize();
super(title_);
}
} }
~this() { ~this() {