mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
nilrider:: levels now can be loaded from menu
This commit is contained in:
parent
51c64dec45
commit
70ee1e6abf
@ -281,8 +281,9 @@ void clear_path(level *l) {
|
|||||||
crash_sound = true;
|
crash_sound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string fname = "horizontal.nrl";
|
||||||
|
|
||||||
void pick_level() {
|
void pick_level() {
|
||||||
clearMessages();
|
|
||||||
dialog::init(XLAT("select the track"), 0xC0C0FFFF, 150, 100);
|
dialog::init(XLAT("select the track"), 0xC0C0FFFF, 150, 100);
|
||||||
for(auto l: all_levels) {
|
for(auto l: all_levels) {
|
||||||
dialog::addItem(l->name, l->hotkey);
|
dialog::addItem(l->name, l->hotkey);
|
||||||
@ -295,6 +296,19 @@ void pick_level() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
|
dialog::addItem("load a level from a file", '0');
|
||||||
|
dialog::add_action([] {
|
||||||
|
dialog::openFileDialog(fname, XLAT("level to load:"), ".nrl", [] () {
|
||||||
|
try {
|
||||||
|
load_level(fname);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(hr_exception& e) {
|
||||||
|
addMessage(e.what());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user