2016-03-10 03:47:37 +00:00
|
|
|
#ifndef __URDE_CGUIFRAME_HPP__
|
|
|
|
#define __URDE_CGUIFRAME_HPP__
|
|
|
|
|
|
|
|
#include "CGuiWidget.hpp"
|
2016-03-11 22:50:15 +00:00
|
|
|
#include "CGuiAutoRepeatData.hpp"
|
|
|
|
#include "CGuiPhysicalMsg.hpp"
|
|
|
|
#include "CGuiControllerInfo.hpp"
|
|
|
|
#include "CGuiLogicalEventTrigger.hpp"
|
|
|
|
#include "CGuiWidgetIdDB.hpp"
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2016-03-11 05:32:18 +00:00
|
|
|
class CGuiSys;
|
2016-03-11 22:50:15 +00:00
|
|
|
class CLight;
|
|
|
|
class CGuiCamera;
|
|
|
|
class CGuiHeadWidget;
|
|
|
|
class CFinalInput;
|
|
|
|
class CGuiLight;
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
enum class EFrameTransitionOptions
|
|
|
|
{
|
|
|
|
Zero
|
|
|
|
};
|
|
|
|
|
|
|
|
class CGuiFrameTransitionOptions
|
|
|
|
{
|
|
|
|
EFrameTransitionOptions x0_opts;
|
|
|
|
bool x4_ = true;
|
|
|
|
float x8_ = 1.f;
|
|
|
|
zeus::CVector3f xc_;
|
|
|
|
public:
|
|
|
|
CGuiFrameTransitionOptions(EFrameTransitionOptions opts)
|
|
|
|
: x0_opts(opts) {}
|
|
|
|
};
|
|
|
|
|
2016-03-11 22:50:15 +00:00
|
|
|
class CGuiFrameMessageMapNode
|
|
|
|
{
|
|
|
|
CGuiLogicalEventTrigger x0_trigger;
|
|
|
|
public:
|
|
|
|
CGuiFrameMessageMapNode(const CGuiPhysicalMsg& msg, int val)
|
|
|
|
: x0_trigger(msg, val, false) {}
|
2016-03-14 00:58:19 +00:00
|
|
|
const CGuiLogicalEventTrigger& GetTrigger() const {return x0_trigger;}
|
2016-03-11 22:50:15 +00:00
|
|
|
};
|
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
class CGuiFrame
|
|
|
|
{
|
2016-03-11 22:50:15 +00:00
|
|
|
public:
|
|
|
|
enum class EFrameStates
|
|
|
|
{
|
|
|
|
};
|
|
|
|
private:
|
2016-03-12 04:58:56 +00:00
|
|
|
bool x0_controllerStatus[4] = {};
|
2016-03-11 05:32:18 +00:00
|
|
|
std::string x4_name;
|
2016-03-14 00:58:19 +00:00
|
|
|
TResId x14_id;
|
2016-03-11 05:32:18 +00:00
|
|
|
CGuiFrameTransitionOptions x1c_transitionOpts;
|
2016-03-11 22:50:15 +00:00
|
|
|
u32 x34_ = 0;
|
|
|
|
u32 x38_ = 0;
|
|
|
|
CGuiSys& x3c_guiSys;
|
|
|
|
u32 x40_ = 0;
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiHeadWidget* x44_headWidget = nullptr;
|
2016-03-11 22:50:15 +00:00
|
|
|
std::unique_ptr<CGuiWidget> x48_rootWidget;
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiCamera* x4c_camera = nullptr;
|
|
|
|
CGuiWidget* x50_background = nullptr;
|
2016-03-11 22:50:15 +00:00
|
|
|
zeus::CQuaternion x54_;
|
|
|
|
CGuiWidgetIdDB x64_idDB;
|
2016-03-14 00:58:19 +00:00
|
|
|
using LogicalEventList = std::list<std::unique_ptr<CGuiFrameMessageMapNode>>;
|
|
|
|
using WidgetToLogicalEventMap =
|
|
|
|
std::unordered_map<s16, std::unique_ptr<LogicalEventList>>;
|
|
|
|
std::unordered_map<u64, std::unique_ptr<WidgetToLogicalEventMap>> x7c_messageMap;
|
|
|
|
std::vector<CGuiWidget*> x90_widgets;
|
2016-03-12 04:58:56 +00:00
|
|
|
std::vector<CGuiLight*> xa0_lights;
|
2016-03-11 22:50:15 +00:00
|
|
|
int xb0_a;
|
|
|
|
int xb4_b;
|
|
|
|
int xb8_c;
|
|
|
|
bool xbc_24_flag1 : 1;
|
|
|
|
bool xbd_flag2 = false;
|
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
public:
|
2016-03-14 00:58:19 +00:00
|
|
|
CGuiFrame(TResId id, const std::string& name, CGuiSys& sys, int a, int b, int c);
|
2016-03-11 22:50:15 +00:00
|
|
|
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiSys& GetGuiSys() {return x3c_guiSys;}
|
|
|
|
|
|
|
|
CGuiLight* GetFrameLight(int idx) {return xa0_lights[idx];}
|
2016-03-11 22:50:15 +00:00
|
|
|
CGuiWidget* FindWidget(const std::string& name) const;
|
|
|
|
CGuiWidget* FindWidget(s16 id) const;
|
|
|
|
void ResetControllerStatus();
|
2016-03-12 04:58:56 +00:00
|
|
|
void SetControllerStatus(int idx, bool set) {x0_controllerStatus[idx] = set;}
|
|
|
|
void SetFrameBackground(CGuiWidget* bg) {x50_background = bg;}
|
|
|
|
void SetFrameCamera(CGuiCamera* camr) {x4c_camera = camr;}
|
|
|
|
void SetHeadWidget(CGuiHeadWidget* hwig) {x44_headWidget = hwig;}
|
2016-03-11 22:50:15 +00:00
|
|
|
void InterpretGUIControllerState(const CFinalInput& input,
|
|
|
|
CGuiPhysicalMsg::PhysicalMap& state,
|
|
|
|
char&, char&, char&, char&);
|
2016-03-14 00:58:19 +00:00
|
|
|
WidgetToLogicalEventMap* FindWidget2LogicalEventMap(u64 events);
|
|
|
|
LogicalEventList* FindLogicalEventList(u64 events, s16 id);
|
2016-03-11 22:50:15 +00:00
|
|
|
void SendWidgetMessage(s16,
|
|
|
|
std::list<std::unique_ptr<CGuiFrameMessageMapNode>>&,
|
|
|
|
CGuiPhysicalMsg::PhysicalMap& state,
|
|
|
|
CGuiControllerInfo::CGuiControllerStateInfo& csInfo);
|
|
|
|
void ClearAllMessageMap();
|
2016-03-14 00:58:19 +00:00
|
|
|
void ClearMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id);
|
|
|
|
void AddMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id);
|
2016-03-11 22:50:15 +00:00
|
|
|
void SortDrawOrder();
|
|
|
|
void EnableLights(u32) const;
|
|
|
|
void DisableLights() const;
|
|
|
|
void RemoveLight(CGuiLight* light);
|
|
|
|
void AddLight(CGuiLight* light);
|
|
|
|
bool GetIsFinishedLoading() const;
|
|
|
|
void Touch() const;
|
|
|
|
void ProcessControllerInput(const CFinalInput& input);
|
|
|
|
|
|
|
|
void Update(float dt);
|
|
|
|
void Draw(const CGuiWidgetDrawParms& parms) const;
|
|
|
|
void Stop(const CGuiFrameTransitionOptions&, EFrameStates, bool);
|
|
|
|
void Run(CGuiFrame*, const CGuiFrameTransitionOptions&, EFrameStates, bool);
|
|
|
|
void Initialize();
|
|
|
|
void LoadWidgetsInGame(CInputStream& in);
|
|
|
|
|
|
|
|
CGuiWidgetIdDB& GetWidgetIdDB() {return x64_idDB;}
|
|
|
|
|
2016-03-14 00:58:19 +00:00
|
|
|
static CGuiFrame* CreateFrame(TResId frmeId, CGuiSys& sys, CInputStream& in);
|
|
|
|
static std::string CreateFrameName(TResId frmeId);
|
2016-03-11 05:32:18 +00:00
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CGUIFRAME_HPP__
|