1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

rogueviz::presentation:: new options

This commit is contained in:
Zeno Rogue 2022-08-05 23:55:24 +02:00
parent eec0c968d9
commit 6030dd2a47
2 changed files with 47 additions and 0 deletions

View File

@ -505,6 +505,51 @@ vector<slide> rvslides_default = {
},
};
map<string, gamedata> switch_gd;
EX void switch_game(string from, string to) {
if(game_active) switch_gd[from].storegame();
if(switch_gd.count(to)) {
switch_gd[to].restoregame();
switch_gd.erase(to);
}
}
/** have a separate 'game' that lives between several slides */
void uses_game(presmode mode, string name, reaction_t launcher, reaction_t restore) {
if(mode == pmStart) {
switch_game("main", name);
if(!game_active) launcher();
else restore();
restorers.push_back([name] { switch_game(name, "main"); });
}
}
void latex_slide(presmode mode, string s, flagtype flags, int size) {
empty_screen(mode);
add_stat(mode, [=] {
tour::slide_backup(no_find_player, true);
if(flags & sm::SIDE) {
cmode |= sm::SIDE;
dynamicval<bool> db(nomap, false);
dynamicval<color_t> dc(modelcolor, 0xFF);
dynamicval<color_t> dc2(bordcolor, 0);
gamescreen();
}
else
gamescreen();
dialog::init();
dialog_may_latex(
s,
"(LaTeX is off)",
dialog::dialogcolor, size, LATEX_COLOR
);
dialog::display();
return true;
});
no_other_hud(mode);
}
int pres_hooks =
addHook(hooks_slide, 100, [] (int mode) {
if(currentslide == 0 && slides == default_slides) {

View File

@ -243,6 +243,8 @@ function<void(presmode)> roguevizslide_action(char c, const T& t, const U& act)
void show_latex(presmode mode, string s);
void dialog_add_latex(string s, color_t color, int size = 100, flagtype flag = 0);
void dialog_may_latex(string latex, string normal, color_t col = dialog::dialogcolor, int size = 100, flagtype flag = 0);
void uses_game(presmode mode, string name, reaction_t launcher, reaction_t restore);
void latex_slide(presmode mode, string s, flagtype flags = 0, int size = 100);
inline ld angle = 0;
inline int dir = -1;