Dialog XML definitions are now loaded thru the resource manager
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "mathutil.hpp"
|
||||
#include "dialogxml/dialogs/dialog.hpp"
|
||||
#include "dialogxml/widgets/control.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include "tools/cursors.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
@@ -104,7 +105,7 @@ void edit_gold_or_food(short which_to_edit) {
|
||||
store_which_to_edit = which_to_edit;
|
||||
|
||||
set_cursor(sword_curs);
|
||||
cDialog dlog("get-num");
|
||||
cDialog dlog(*ResMgr::dialogs.get("get-num"));
|
||||
dlog["okay"].attachClickHandler(get_num_event_filter);
|
||||
if(which_to_edit == 0)
|
||||
dlog["prompt"].setText("How much gold do you want?");
|
||||
@@ -126,7 +127,7 @@ void edit_day() {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog dlog("edit-day");
|
||||
cDialog dlog(*ResMgr::dialogs.get("edit-day"));
|
||||
dlog["okay"].attachClickHandler(get_num_event_filter);
|
||||
|
||||
dlog["number"].setTextToNum(((univ.party.age) / 3700) + 1);
|
||||
@@ -154,7 +155,7 @@ void edit_xp(cPlayer *pc) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog dlog("edit-xp");
|
||||
cDialog dlog(*ResMgr::dialogs.get("edit-xp"));
|
||||
dlog["okay"].attachClickHandler(get_num_event_filter);
|
||||
|
||||
dlog["number"].setTextToNum(pc->experience);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "dialogxml/widgets/pict.hpp"
|
||||
#include "dialogxml/dialogs/strdlog.hpp"
|
||||
#include "dialogxml/dialogs/choicedlog.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include "tools/winutil.hpp"
|
||||
#include "tools/cursors.hpp"
|
||||
#include "gfx/render_shapes.hpp" // for colour constants
|
||||
@@ -103,7 +104,7 @@ void display_pc(short pc_num,short mode, cDialog* parent) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog pcInfo("pc-spell-info", parent);
|
||||
cDialog pcInfo(*ResMgr::dialogs.get("pc-spell-info"), parent);
|
||||
pcInfo.attachClickHandlers(std::bind(display_pc_event_filter, _1, _2, mode),{"done","left","right"});
|
||||
|
||||
for(short i = 0; i < 62; i++) {
|
||||
@@ -199,7 +200,7 @@ void pick_race_abil(cPlayer *pc,short mode,cDialog* parent) {
|
||||
store_pc = pc;
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog pickAbil("pick-race-abil",parent);
|
||||
cDialog pickAbil(*ResMgr::dialogs.get("pick-race-abil"),parent);
|
||||
pickAbil["done"].attachClickHandler(std::bind(&cDialog::toast, &pickAbil, true));
|
||||
auto led_selector = std::bind(pick_race_select_led, _1, _2, _3, mode);
|
||||
pickAbil.attachFocusHandlers(led_selector, {"race", "bad1", "bad2", "bad3", "bad4", "bad5", "bad6", "bad7"});
|
||||
@@ -549,7 +550,7 @@ bool spend_xp(short pc_num, short mode, cDialog* parent) {
|
||||
save.mode = mode;
|
||||
save.skills = univ.party[pc_num].skills;
|
||||
|
||||
cDialog xpDlog("spend-xp",parent);
|
||||
cDialog xpDlog(*ResMgr::dialogs.get("spend-xp"),parent);
|
||||
xpDlog.addLabelFor("hp","Health (1/10)",LABEL_LEFT,75,true);
|
||||
xpDlog.addLabelFor("sp","Spell Pts. (1/15)",LABEL_LEFT,75,true);
|
||||
auto spend_xp_filter = std::bind(spend_xp_event_filter,_1,_2,_3,std::ref(save));
|
||||
@@ -577,7 +578,7 @@ bool spend_xp(short pc_num, short mode, cDialog* parent) {
|
||||
}
|
||||
|
||||
void edit_stuff_done() {
|
||||
cDialog sdf_dlg("set-sdf");
|
||||
cDialog sdf_dlg(*ResMgr::dialogs.get("set-sdf"));
|
||||
sdf_dlg.attachFocusHandlers([](cDialog& me, std::string, bool losing) -> bool {
|
||||
if(!losing) return true;
|
||||
int x = me["x"].getTextAsNum(), y = me["y"].getTextAsNum();
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "pc.menus.hpp"
|
||||
#include "tools/winutil.hpp"
|
||||
#include "tools/cursors.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include "fileio/resmgr/res_image.hpp"
|
||||
#include "tools/prefs.hpp"
|
||||
#include "tools/framerate_limiter.hpp"
|
||||
@@ -462,7 +463,7 @@ void display_skills(eSkill skill,cDialog* parent) {
|
||||
extern std::map<eSkill,short> skill_max;
|
||||
extern std::map<eSkill,short> skill_g_cost;
|
||||
int skill_pos = int(skill);
|
||||
cDialog skillDlog("skill-info", parent);
|
||||
cDialog skillDlog(*ResMgr::dialogs.get("skill-info"), parent);
|
||||
skillDlog["done"].attachClickHandler(std::bind(&cDialog::toast, &skillDlog, true));
|
||||
skillDlog["name"].setText(get_str("skills",skill_pos * 2 + 1));
|
||||
skillDlog["skp"].setTextToNum(skill_cost[skill]);
|
||||
|
Reference in New Issue
Block a user