mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
nicer support for multiple slideshows
This commit is contained in:
parent
9cc4d74da0
commit
804e426c2a
@ -1235,11 +1235,9 @@ auto hooks =
|
||||
addHook(hooks_o_key, 100, o_key) +
|
||||
|
||||
#if CAP_RVSLIDES
|
||||
addHook(tour::ss::hooks_extra_slideshows, 100, [] (bool view) {
|
||||
if(!view) return 1;
|
||||
dialog::addBoolItem(XLAT("RogueViz Tour"), tour::ss::wts == &rvtour::rvslides[0], 'r');
|
||||
dialog::add_action([] { tour::ss::wts = rvtour::gen_rvtour(); popScreen(); });
|
||||
return 0;
|
||||
addHook(tour::ss::hooks_extra_slideshows, 100, [] (slideshow_callback cb) {
|
||||
if(rvslides.empty()) rvtour::gen_rvtour();
|
||||
cb(XLAT("RogueViz Tour"), &rvtour::rvslides[0], 'r');
|
||||
}) +
|
||||
#endif
|
||||
|
||||
|
25
tour.cpp
25
tour.cpp
@ -385,13 +385,23 @@ EX namespace ss {
|
||||
|
||||
string slidechars = "abcdefghijklmnopqrsvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*(";
|
||||
|
||||
EX hookset<int(bool)> hooks_extra_slideshows;
|
||||
#if HDR
|
||||
using slideshow_callback = function<void(string, slide*, char)>;
|
||||
#endif
|
||||
|
||||
EX hookset<void(slideshow_callback)> hooks_extra_slideshows;
|
||||
|
||||
EX void for_all_slideshows(const slideshow_callback& cb) {
|
||||
cb(XLAT("Guided Tour"), default_slides, 't');
|
||||
callhooks(hooks_extra_slideshows, cb);
|
||||
}
|
||||
|
||||
EX void slideshow_menu() {
|
||||
dialog::init(XLAT("slideshows"), forecolor, 150, 100);
|
||||
dialog::addBoolItem(XLAT("Guided Tour"), wts == default_slides, 't');
|
||||
dialog::add_action([] { wts = default_slides; popScreen(); });
|
||||
callhooks(hooks_extra_slideshows, true);
|
||||
for_all_slideshows([] (string title, slide *sl, char ch) {
|
||||
dialog::addBoolItem(title, wts == sl, ch);
|
||||
dialog::add_action([sl] { wts = sl; popScreen(); });
|
||||
});
|
||||
dialog::addBack();
|
||||
dialog::display();
|
||||
}
|
||||
@ -445,8 +455,11 @@ EX namespace ss {
|
||||
});
|
||||
}
|
||||
dialog::addBreak(50);
|
||||
bool b = false;
|
||||
if(callhandlers(0, hooks_extra_slideshows, b)) {
|
||||
int cnt = 0;
|
||||
|
||||
for_all_slideshows([&] (string title, slide *sl, char ch) { cnt++; });
|
||||
|
||||
if(cnt > 1) {
|
||||
dialog::addItem(XLAT("change slideshow"), '1');
|
||||
dialog::add_action_push(slideshow_menu);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user