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) +
|
addHook(hooks_o_key, 100, o_key) +
|
||||||
|
|
||||||
#if CAP_RVSLIDES
|
#if CAP_RVSLIDES
|
||||||
addHook(tour::ss::hooks_extra_slideshows, 100, [] (bool view) {
|
addHook(tour::ss::hooks_extra_slideshows, 100, [] (slideshow_callback cb) {
|
||||||
if(!view) return 1;
|
if(rvslides.empty()) rvtour::gen_rvtour();
|
||||||
dialog::addBoolItem(XLAT("RogueViz Tour"), tour::ss::wts == &rvtour::rvslides[0], 'r');
|
cb(XLAT("RogueViz Tour"), &rvtour::rvslides[0], 'r');
|
||||||
dialog::add_action([] { tour::ss::wts = rvtour::gen_rvtour(); popScreen(); });
|
|
||||||
return 0;
|
|
||||||
}) +
|
}) +
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
25
tour.cpp
25
tour.cpp
@ -385,13 +385,23 @@ EX namespace ss {
|
|||||||
|
|
||||||
string slidechars = "abcdefghijklmnopqrsvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*(";
|
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() {
|
EX void slideshow_menu() {
|
||||||
dialog::init(XLAT("slideshows"), forecolor, 150, 100);
|
dialog::init(XLAT("slideshows"), forecolor, 150, 100);
|
||||||
dialog::addBoolItem(XLAT("Guided Tour"), wts == default_slides, 't');
|
for_all_slideshows([] (string title, slide *sl, char ch) {
|
||||||
dialog::add_action([] { wts = default_slides; popScreen(); });
|
dialog::addBoolItem(title, wts == sl, ch);
|
||||||
callhooks(hooks_extra_slideshows, true);
|
dialog::add_action([sl] { wts = sl; popScreen(); });
|
||||||
|
});
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
@ -445,8 +455,11 @@ EX namespace ss {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
bool b = false;
|
int cnt = 0;
|
||||||
if(callhandlers(0, hooks_extra_slideshows, b)) {
|
|
||||||
|
for_all_slideshows([&] (string title, slide *sl, char ch) { cnt++; });
|
||||||
|
|
||||||
|
if(cnt > 1) {
|
||||||
dialog::addItem(XLAT("change slideshow"), '1');
|
dialog::addItem(XLAT("change slideshow"), '1');
|
||||||
dialog::add_action_push(slideshow_menu);
|
dialog::add_action_push(slideshow_menu);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user