1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-01-27 21:11:20 +00:00

nicer help for number dialogs

This commit is contained in:
Zeno Rogue
2025-09-09 16:56:47 +02:00
parent ab9d7a404f
commit dbebf13465
6 changed files with 68 additions and 35 deletions

View File

@@ -1383,38 +1383,62 @@ EX namespace dialog {
init("number dialog help");
dialog::addBreak(100);
dialog::addHelp(XLAT("You can enter formulas in this dialog."));
dialog::addBreak(100);
dialog::addHelp(XLAT("Functions available:"));
addHelp(available_functions());
dialog::addBreak(100);
dialog::addHelp(XLAT("Constants and variables available:"));
addHelp(available_constants());
if(ptr && ptr->animatable) {
dialog::addBreak(150);
dialog::addItem("functions and constants", 'f');
dialog::add_action_push([] {
init("functions and constants");
dialog::addHelp(XLAT("Functions available:"));
addHelp(available_functions());
dialog::addBreak(100);
dialog::addHelp(XLAT("Animations:"));
dialog::addHelp(XLAT("a..b -- animate linearly from a to b"));
dialog::addHelp(XLAT("a..b..|c..d -- animate from a to b, then from c to d"));
dialog::addHelp(XLAT("a../x..b../y -- change smoothly, x and y are derivatives"));
}
/* "Most parameters can be animated simply by using '..' in their editing dialog. "
"For example, the value of a parameter set to 0..1 will grow linearly from 0 to 1. "
"You can also use functions (e.g. cos(0..2*pi)) and refer to other parameters."
)); */
dialog::addHelp(XLAT("Constants available:"));
addHelp(available_constants());
dialog::addBreak(100);
dialog::addBack();
dialog::display();
});
dialog::addItem("variables", 'v');
dialog::add_action_push([] {
init("variables");
addHelp(available_variables());
dialog::addBreak(100);
dialog::addBack();
dialog::display();
});
#if CAP_ANIMATIONS
dialog::addBreak(50);
auto f = find_edit(!ptr ? nullptr : ptr->intval ? (void*) ptr->intval : (void*) ptr->editwhat);
if(f)
dialog::addHelp(XLAT("Parameter names, e.g. '%1'", f->name));
dialog::addItem(XLAT("parameter names, e.g. '%1'", f->name), 'p');
else
dialog::addHelp(XLAT("Parameter names"));
dialog::addBreak(50);
for(auto& ap: anims::aps) {
dialog::addInfo(ap.par->name + " = " + ap.formula);
}
dialog::addItem(XLAT("parameter names"), 'p');
dialog::add_action_push([] {
init("parameter names");
for(auto& ap: anims::aps) {
dialog::addInfo(ap.par->name + " = " + ap.formula);
}
dialog::addBreak(100);
dialog::addBack();
dialog::display();
});
#endif
dialog::addBreak(50);
if(ptr && ptr->animatable) {
dialog::addItem("animations", 'a');
dialog::add_action_push([] {
init("Animations:");
dialog::addHelp(XLAT("a..b -- animate linearly from a to b"));
dialog::addHelp(XLAT("a..b..|c..d -- animate from a to b, then from c to d"));
dialog::addHelp(XLAT("a../x..b../y -- change smoothly, x and y are derivatives"));
dialog::addBreak(100);
dialog::addBack();
dialog::display();
});
}
dialog::addBreak(150);
dialog::addHelp(XLAT("These can be combined, e.g. %1", "projection*sin(0..2*pi)"));
display();
}