1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-14 20:57:10 +00:00

improved presentation support in RogueViz

This commit is contained in:
Zeno Rogue
2020-09-11 11:41:23 +02:00
parent 3eb576e309
commit 1789ad1a33
4 changed files with 385 additions and 102 deletions

View File

@@ -971,11 +971,6 @@ int readArgs() {
else if(argis("-lq")) {
shift_arg_formula(linequality);
}
#if CAP_RVSLIDES
else if(argis("-rvpres")) {
tour::slides = rvtour::gen_rvtour();
}
#endif
else if(argis("-nolegend")) {
legend.clear();
}
@@ -1132,82 +1127,6 @@ void showMenu() {
dialog::display();
}
#if CAP_RVSLIDES
namespace rvtour {
using namespace tour;
vector<slide> rvslides;
extern vector<slide> rvslides_default;
slide *gen_rvtour() {
rvslides = rvslides_default;
callhooks(hooks_build_rvtour, rvslides);
rvslides.emplace_back(
slide{"THE END", 99, LEGAL::ANY | FINALSLIDE,
"Press '5' to leave the presentation.",
[] (presmode mode) {
firstland = specialland = laIce;
if(mode == 4) restart_game(rg::tour);
}
});
return &rvslides[0];
}
vector<slide> rvslides_default = {
{"RogueViz", 999, LEGAL::ANY,
"This is a presentation of RogueViz, which "
"is an adaptation of HyperRogue as a visualization tool "
"rather than a game. Hyperbolic space is great "
"for visualizing some kinds of data because of the vast amount "
"of space.\n\n"
"Press '5' to switch to the standard HyperRogue tutorial. "
"Press ESC to look at other functions of this presentation."
,
[] (presmode mode) {
slidecommand = "the standard presentation";
if(mode == pmStartAll) firstland = specialland = laPalace;
if(mode == 4) {
tour::slides = default_slides;
while(tour::on) restart_game(rg::tour);
firstland = specialland = laIce;
tour::start();
}
}
},
{"straight lines in the Palace", 999, LEGAL::ANY,
"One simple slide about HyperRogue. Press '5' to show some hyperbolic straight lines.",
[] (presmode mode) {
using namespace linepatterns;
slidecommand = "toggle the Palace lines";
if(mode == 4) patPalace.color = 0xFFD500FF;
if(mode == 3) patPalace.color = 0xFFD50000;
}
},
};
int rvtour_hooks =
addHook(hooks_slide, 100, [] (int mode) {
if(currentslide == 0 && slides == default_slides) {
slidecommand = "RogueViz presentation";
if(mode == 1)
help +=
"\n\nYour version of HyperRogue is compiled with RogueViz. "
"Press '5' to switch to the RogueViz slides. Watching the "
"common HyperRogue tutorial first is useful too, "
"as an introduction to hyperbolic geometry.";
if(mode == 4) {
slides = gen_rvtour();
while(tour::on) restart_game(rg::tour);
tour::start();
}
}
}) +
0;
}
#endif
bool default_help() {
if(!vizid) return false;
@@ -1234,31 +1153,11 @@ auto hooks =
addHook(shmup::hooks_kill, 100, activate) +
addHook(hooks_o_key, 100, o_key) +
#if CAP_RVSLIDES
addHook(tour::ss::hooks_extra_slideshows, 100, [] (tour::ss::slideshow_callback cb) {
if(rogueviz::rvtour::rvslides.empty()) rvtour::gen_rvtour();
cb(XLAT("RogueViz mixed bag"), &rvtour::rvslides[0], 'r');
}) +
#endif
addHook(dialog::hooks_display_dialog, 100, [] () {
if(current_screen_cfunction() == showMainMenu) {
dialog::addItem(XLAT("rogueviz menu"), 'u');
dialog::add_action_push(rogueviz::showMenu);
}
#if CAP_RVSLIDES
if(current_screen_cfunction() == showStartMenu) {
dialog::addBreak(100);
dialog::addBigItem(XLAT("RogueViz"), 'r');
dialog::add_action([] () {
tour::slides = rogueviz::rvtour::gen_rvtour();
popScreenAll();
tour::start();
printf("tour start\n");
});
dialog::addInfo(XLAT("see the visualizations"));
}
#endif
}) +
addHook(hooks_welcome_message, 100, [] () {
if(vizid) addMessage(XLAT("Welcome to RogueViz!"));