In no particular order:
- Added some of the most basic dialogs - Changed C-style <xxx.h> headers to C++-style <cxxx> headers - Switched graphics to load from the PNG files in graphics.exd rather than from Blades of Exile Graphics (NOTE: Some graphics still don't work, probably because of incorrect source rects) - Switched cursors to load from GIF files in graphics.exd rather than from Blades of Exile Graphics - Moved Niemand's tileImage functions from boe.graphics.cpp to graphtool.cpp, so they can be used by all three programs. - Added some string lists in .txt files - Made cursors into an enum - Rewrote the code for displaying the Edit Terrain dialog to use the new engine (not tested yet) - Fixed some __attribute__((deprecated)) stuff - Most graphics are now loaded just after the custom graphics. This means they will be overridden by a file of the same name in the scenario's .exr folder. - Altered modes a little so that when at the startup screen you are in MODE_STARTUP rather than MODE_OUTDOORS. - Switched from function pointers to boost::function – the Boost libraries are now required. - Finished off the new dialog engine and made gess necessary - Added status icons as another type that can be drawn in dialogs - C Wrappers for Cocoa cursors based on an Apple example. This is tested, and works perfectly. - Added a switch in the program for using Windows graphics; however, there is no way as yet to set this flag, and in fact there aren't even any Windows graphics to use. - Added include guards to graphtool.h - Made separate mac and win directories within sounds.exa, since the Mac and Windows sounds are mostly subtly different (with two completely different!) git-svn-id: http://openexile.googlecode.com/svn/trunk@90 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
@@ -11,70 +11,119 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/function.hpp>
|
||||
#include "graphtool.h" // for pic_num_t
|
||||
#include "soundtool.h" // for snd_num_t
|
||||
|
||||
typedef void (*record_callback_t)(std::string,std::string);
|
||||
//typedef void (*record_callback_t)(std::string,std::string);
|
||||
typedef boost::function<void(std::string,std::string)> record_callback_t;
|
||||
|
||||
class cStrDlog {
|
||||
cDialog dlg, *parent;
|
||||
std::string str1, str2, title;
|
||||
static std::string getFileName(short n_strs, ePicType type, bool hasTitle);
|
||||
cDialog dlg;
|
||||
std::string str1, str2;
|
||||
short sound;
|
||||
record_callback_t rec_f;
|
||||
bool hasRecord;
|
||||
const ePicType type;
|
||||
bool onRecord(cDialog& me, std::string id);
|
||||
bool onDismiss(cDialog& me, std::string id);
|
||||
public:
|
||||
cStrDlog(std::string str) : dlg("1str.xml") {}
|
||||
cStrDlog(std::string str1, std::string str2, bool hasTitle) : dlg(hasTitle ? "1str-title.xml" : "2str.xml") {}
|
||||
cStrDlog(std::string str1, std::string str2, std::string title) : dlg("2str-title.xml") {}
|
||||
cStrDlog& setPict(short num, ePicType type);
|
||||
cStrDlog& setSound(short num);
|
||||
cStrDlog& setParent(cDialog* parent);
|
||||
cStrDlog(std::string str1,std::string str2,std::string title,pic_num_t pic,ePicType t,cDialog* parent);
|
||||
cStrDlog& setSound(snd_num_t num);
|
||||
cStrDlog& setRecordHandler(record_callback_t rec);
|
||||
void show();
|
||||
};
|
||||
|
||||
class cChoiceDlog {
|
||||
cDialog dlg, *parent;
|
||||
cDialog dlg;
|
||||
protected:
|
||||
bool onClick(cDialog& me, std::string id);
|
||||
public:
|
||||
cChoiceDlog(std::string str) : dlg(str) {}
|
||||
cChoiceDlog& setParent(cDialog* parent);
|
||||
cChoiceDlog(std::string file, std::vector<std::string> buttons, cDialog* p = NULL);
|
||||
explicit cChoiceDlog(std::vector<std::string> buttons, cDialog* p = NULL);
|
||||
cDialog* operator->();
|
||||
std::string show();
|
||||
};
|
||||
|
||||
template<bool b> struct bbtt { // stands for "basic button type template"
|
||||
eBtnType type;
|
||||
std::string label;
|
||||
cKey defaultKey;
|
||||
operator bool();
|
||||
bbtt<b>& operator=(bbtt<!b>&);
|
||||
};
|
||||
|
||||
template<> struct bbtt<false> {
|
||||
operator bool();
|
||||
bbtt<false>& operator=(bbtt<true>&);
|
||||
};
|
||||
typedef bbtt<true> cBasicButtonType;
|
||||
|
||||
namespace {const bbtt<false> null_btn = {};}
|
||||
#ifndef BTNS_DEFINED
|
||||
extern cBasicButtonType basic_buttons[];
|
||||
extern size_t available_btns[];
|
||||
#endif
|
||||
|
||||
class cThreeChoice : public cChoiceDlog {
|
||||
//static std::string getFileName(size_t n_strs);
|
||||
bool btn_used[3];
|
||||
cBasicButtonType btns[3];
|
||||
unsigned short buttons_right, buttons_top;
|
||||
void init_strings(std::vector<std::string>& strings, unsigned short left);
|
||||
template<bool a, bool b, bool c> void init_buttons(bbtt<a> btn1, bbtt<b> btn2, bbtt<c> btn3);
|
||||
void init_pict(pic_num_t pic);
|
||||
const ePicType type;
|
||||
public:
|
||||
cThreeChoice(std::string str) : cChoiceDlog("1str-3-c.xml") {}
|
||||
cThreeChoice(std::string str1, std::string str2) : cChoiceDlog("2str-3-c.xml") {}
|
||||
cThreeChoice(std::string str1, std::string str2, std::string str3) : cChoiceDlog("3str-3-c.xml") {}
|
||||
cThreeChoice(std::string str1, std::string str2, std::string str3, std::string str4) : cChoiceDlog("4str-3-c.xml") {}
|
||||
cThreeChoice(std::string str1, std::string str2, std::string str3, std::string str4, std::string str5) : cChoiceDlog("5str-3-c.xml") {}
|
||||
cThreeChoice(std::string str1, std::string str2, std::string str3, std::string str4, std::string str5, std::string str6) : cChoiceDlog("6str-3-c.xml") {}
|
||||
cThreeChoice& setPict(short num, ePicType type);
|
||||
cThreeChoice& setParent(cDialog* parent);
|
||||
string show();
|
||||
template<bool a, bool b, bool c> cThreeChoice
|
||||
(std::vector<std::string> strings, bbtt<a> btn1, bbtt<b> btn2, bbtt<c> btn3, pic_num_t pic, ePicType t, cDialog* parent = NULL)
|
||||
: cChoiceDlog(std::vector<std::string>(), parent), type(t){
|
||||
if(type == PIC_CUSTOM_DLOG_LG || type == PIC_DLOG_LG || type == PIC_SCEN_LG)
|
||||
init_strings(strings,86);
|
||||
else
|
||||
init_strings(strings,50);
|
||||
init_buttons(btn1, btn2, btn3);
|
||||
init_pict(pic);
|
||||
operator->()->recalcRect();
|
||||
}
|
||||
cThreeChoice(std::vector<std::string> strings, short btn1, short btn2, short btn3, pic_num_t pic, ePicType t, cDialog* parent = NULL);
|
||||
std::string show();
|
||||
};
|
||||
|
||||
class cStringChoice {
|
||||
cDialog dlg, *parent;
|
||||
static const size_t per_page;
|
||||
cDialog dlg;
|
||||
bool onLeft(cDialog& me, std::string id);
|
||||
bool onRight(cDialog& me, std::string id);
|
||||
bool onCancel(cDialog& me, std::string id);
|
||||
bool onOkay(cDialog& me, std::string id);
|
||||
void fillPage();
|
||||
std::vector<std::string> strings;
|
||||
size_t page, cur;
|
||||
public:
|
||||
cStringChoice(std::vector<std::string>& strs);
|
||||
cStringChoice(std::vector<std::string>::iterator begin, std::vector<std::string>::iterator end);
|
||||
size_t show(); // returns the _index_ of the chosen string
|
||||
explicit cStringChoice(std::vector<std::string>& strs, cDialog* parent = NULL);
|
||||
cStringChoice(std::vector<std::string>::iterator begin, std::vector<std::string>::iterator end, cDialog* parent = NULL);
|
||||
size_t show(std::string select); // returns the _index_ of the chosen string, relative to begin
|
||||
// returns strs.size() if the user cancels
|
||||
};
|
||||
|
||||
class cPictChoice {
|
||||
cDialog dlg, *parent;
|
||||
static const size_t per_page;
|
||||
cDialog dlg;
|
||||
bool onLeft(cDialog& me, std::string id);
|
||||
bool onRight(cDialog& me, std::string id);
|
||||
bool onCancel(cDialog& me, std::string id);
|
||||
bool onOkay(cDialog& me, std::string id);
|
||||
void fillPage();
|
||||
std::vector<pic_num_t> picts;
|
||||
const ePicType type;
|
||||
size_t page, cur;
|
||||
public:
|
||||
cPictChoice(std::vector<short>& pics, ePicType type);
|
||||
cPictChoice(std::vector<short>::iterator begin, std::vector<short>::iterator end, ePicType type);
|
||||
short show(); // returns the _number_ of the chosen picture, _not_ the index; there's no way to distinguish between duplicates
|
||||
cPictChoice(std::vector<pic_num_t>& pics, ePicType t, cDialog* parent = NULL);
|
||||
cPictChoice(std::vector<pic_num_t>::iterator begin, std::vector<pic_num_t>::iterator end, ePicType t, cDialog* parent = NULL);
|
||||
pic_num_t show(pic_num_t fallback, pic_num_t cur_sel); // returns the _number_ of the chosen picture, _not_ the index; there's no way to distinguish between duplicates
|
||||
// returns fallback if the user cancels
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user