Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/CGUI.h
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | public: | ||||
* Performs processing that should happen every frame | * Performs processing that should happen every frame | ||||
* (including sending the "Tick" event to scripts) | * (including sending the "Tick" event to scripts) | ||||
*/ | */ | ||||
void TickObjects(); | void TickObjects(); | ||||
/** | /** | ||||
* Sends a specified script event to every object | * Sends a specified script event to every object | ||||
* | * | ||||
* @param EventName String representation of event name | * @param eventName String representation of event name | ||||
*/ | */ | ||||
void SendEventToAll(const CStr& EventName); | void SendEventToAll(const CStr& eventName); | ||||
/** | /** | ||||
* Sends a specified script event to every object | * Sends a specified script event to every object | ||||
* | * | ||||
* @param EventName String representation of event name | * @param eventName String representation of event name | ||||
* @param paramData JS::HandleValueArray storing the arguments passed to the event handler. | * @param paramData JS::HandleValueArray storing the arguments passed to the event handler. | ||||
*/ | */ | ||||
void SendEventToAll(const CStr& EventName, const JS::HandleValueArray& paramData); | void SendEventToAll(const CStr& eventName, const JS::HandleValueArray& paramData); | ||||
/** | /** | ||||
* Displays the whole GUI | * Displays the whole GUI | ||||
*/ | */ | ||||
void Draw(); | void Draw(); | ||||
/** | /** | ||||
* Draw GUI Sprite | * Draw GUI Sprite | ||||
▲ Show 20 Lines • Show All 510 Lines • ▼ Show 20 Lines | private: | ||||
std::map<CStr, std::vector<IGUIObject*> > m_HotkeyObjects; | std::map<CStr, std::vector<IGUIObject*> > m_HotkeyObjects; | ||||
/** | /** | ||||
* Map from hotkey names to functions that are triggered if the hotkey is pressed. | * Map from hotkey names to functions that are triggered if the hotkey is pressed. | ||||
* Contrary to object hotkeys, this allows for only one global function per hotkey name. | * Contrary to object hotkeys, this allows for only one global function per hotkey name. | ||||
*/ | */ | ||||
std::map<CStr, JS::PersistentRootedValue> m_GlobalHotkeys; | std::map<CStr, JS::PersistentRootedValue> m_GlobalHotkeys; | ||||
/** | |||||
* XML and JS can subscribe handlers to events identified by these names. | |||||
* Store in static const members to avoid string copies, gain compile errors when misspelling and | |||||
* to allow reuse in other classes. | |||||
*/ | |||||
static const CStr EventNameLoad; | |||||
static const CStr EventNameTick; | |||||
static const CStr EventNamePress; | |||||
static const CStr EventNameRelease; | |||||
static const CStr EventNameMouseRightPress; | |||||
static const CStr EventNameMouseLeftPress; | |||||
static const CStr EventNameMouseWheelDown; | |||||
static const CStr EventNameMouseWheelUp; | |||||
static const CStr EventNameMouseLeftDoubleClick; | |||||
static const CStr EventNameMouseLeftRelease; | |||||
static const CStr EventNameMouseRightDoubleClick; | |||||
static const CStr EventNameMouseRightRelease; | |||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
// Databases | // Databases | ||||
// These are loaded from XML files and marked as noncopyable and const to | // These are loaded from XML files and marked as noncopyable and const to | ||||
// rule out unintentional modification and copy, especially during Draw calls. | // rule out unintentional modification and copy, especially during Draw calls. | ||||
//-------------------------------------------------------- | //-------------------------------------------------------- | ||||
// Colors | // Colors | ||||
std::map<CStr, const CGUIColor> m_PreDefinedColors; | std::map<CStr, const CGUIColor> m_PreDefinedColors; | ||||
Show All 15 Lines |
Wildfire Games · Phabricator