Fix a help dialog that appears in the top-left

This commit is contained in:
2025-02-14 15:37:44 -06:00
committed by Celtic Minstrel
parent e83ad32618
commit d3dff69d1a
3 changed files with 10 additions and 5 deletions

View File

@@ -533,6 +533,13 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
makeFrontWindow(*parentWin);
}
void cDialog::runWithHelp(short help1, short help2) {
extern void give_help(short help1, short help2, cDialog& parent);
run([help1, help2](cDialog& me) -> void {
give_help(help1, help2, me);
});
}
// This method is a main event event loop of the dialog.
void cDialog::handle_events() {
sf::Event currentEvent;

View File

@@ -115,6 +115,8 @@ public:
/// Show the dialog and start its event loop. All dialogs are modal.
/// @param onopen A function to be called after the dialog is displayed but before the event loop starts.
void run(std::function<void(cDialog&)> onopen = nullptr); // cd_run_dialog
/// Show this dialog. Before starting its event loop, show a help window if it hasn't been shown before.
void runWithHelp(short help1, short help2);
/// Get the result of the dialog.
/// @tparam type The result type.
/// @throw boost::bad_any_cast if the provided result type is different from the type set by setResult().