quick implementation of previewing dialogxml for #564
This commit is contained in:
@@ -1147,3 +1147,16 @@ void cDialogIterator::increment() {
|
|||||||
parent = nullptr;
|
parent = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void preview_dialog_xml() {
|
||||||
|
fs::path dialog_xml = nav_get_rsrc({"xml"});
|
||||||
|
std::unique_ptr<DialogDefn> defn(load_dialog_defn(dialog_xml));
|
||||||
|
cDialog dialog(*defn);
|
||||||
|
// Make every control's click event close the dialog
|
||||||
|
for (auto control : dialog){
|
||||||
|
control.second->attachClickHandler([](cDialog& me, std::string item_hit, eKeyMod mod) -> bool {
|
||||||
|
me.toast(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
dialog.run();
|
||||||
|
}
|
||||||
|
|||||||
@@ -377,4 +377,7 @@ public:
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
// For development/debugging only.
|
||||||
|
void preview_dialog_xml();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2367,6 +2367,9 @@ void init_debug_actions() {
|
|||||||
add_debug_action({'H'}, "Heal", debug_heal);
|
add_debug_action({'H'}, "Heal", debug_heal);
|
||||||
// This one was missing from the old help dialog:
|
// This one was missing from the old help dialog:
|
||||||
add_debug_action({'I'}, "Give item", debug_give_item);
|
add_debug_action({'I'}, "Give item", debug_give_item);
|
||||||
|
// TODO this is not recorded or replayed because the rsrc you pick might not even be packaged
|
||||||
|
// in the build
|
||||||
|
add_debug_action({'J'}, "Preview a dialog's layout", preview_dialog_xml);
|
||||||
add_debug_action({'K'}, "Kill everything", debug_kill);
|
add_debug_action({'K'}, "Kill everything", debug_kill);
|
||||||
add_debug_action({'N'}, "End scenario", []() -> void {handle_victory(true);});
|
add_debug_action({'N'}, "End scenario", []() -> void {handle_victory(true);});
|
||||||
add_debug_action({'O'}, "Print your location", debug_print_location);
|
add_debug_action({'O'}, "Print your location", debug_print_location);
|
||||||
|
|||||||
Reference in New Issue
Block a user