iw4x-client/src/Components/Modules/UIScript.hpp

43 lines
983 B
C++
Raw Normal View History

2015-12-28 08:08:46 -05:00
namespace Components
{
class UIScript : public Component
{
public:
UIScript();
~UIScript();
const char* GetName() { return "UIScript"; };
class Token
{
public:
Token(const char** args) : token(0) { this->Parse(args); };
Token(const Token &obj) { this->token = obj.token; };
template<typename T> T Get();
bool IsValid();
private:
char* token;
void Parse(const char** args);
};
typedef void(*Callback)(Token token);
typedef void(*CallbackRaw)();
static void Add(std::string name, Callback callback);
static void Add(std::string name, CallbackRaw callback);
2016-01-03 19:30:15 -05:00
static void AddOwnerDraw(int ownerdraw, CallbackRaw callback);
2015-12-28 08:08:46 -05:00
2016-01-03 19:30:15 -05:00
private:
static void OwnerDrawHandleKeyStub(int ownerDraw, int flags, float *special, int key);
2015-12-28 08:08:46 -05:00
static bool RunMenuScript(const char* name, const char** args);
static void RunMenuScriptStub();
static std::map<std::string, Callback> UIScripts;
2016-01-03 19:30:15 -05:00
static std::map<int, CallbackRaw> UIOwnerDraws;
2015-12-28 08:08:46 -05:00
};
}