metaforce/Runtime/GuiSys/CGuiSys.hpp

77 lines
1.8 KiB
C++
Raw Normal View History

2016-03-10 03:47:37 +00:00
#ifndef __URDE_CGUISYS_HPP__
#define __URDE_CGUISYS_HPP__
2015-08-18 05:54:43 +00:00
2016-03-11 00:23:16 +00:00
#include "hecl/hecl.hpp"
#include <unordered_map>
#include <vector>
#include <stack>
#include <chrono>
#include "CGuiAutoRepeatData.hpp"
#include "CSaveableState.hpp"
#include "IOStreams.hpp"
2016-03-11 00:23:16 +00:00
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
2016-03-11 00:23:16 +00:00
class CGuiObject;
class CVParamTransfer;
class SObjectTag;
class IFactory;
class CSimplePool;
class CGuiWidget;
class CGuiFrame;
2016-03-11 00:23:16 +00:00
typedef CGuiObject*(*FGuiFactoryFunc)(const SObjectTag&, const CVParamTransfer&);
class CGuiFactoryMgr
{
friend class CGuiSys;
2016-03-14 00:58:19 +00:00
std::unordered_map<FourCC, FGuiFactoryFunc> m_factories;
2016-03-11 00:23:16 +00:00
public:
2016-03-14 00:58:19 +00:00
void AddFactory(FourCC key, FGuiFactoryFunc func)
2016-03-11 00:23:16 +00:00
{
m_factories[key] = func;
}
};
2015-08-18 05:54:43 +00:00
class CGuiSys
{
2016-03-11 22:50:15 +00:00
friend class CGuiFrame;
2016-03-11 00:23:16 +00:00
public:
enum class EUsageMode
{
Zero,
One,
Two
2016-03-11 00:23:16 +00:00
};
private:
IFactory& x0_resFactory;
CSimplePool& x4_resStore;
CGuiFactoryMgr x8_factoryMgr;
std::unordered_map<EPhysicalControllerID, CGuiAutoRepeatData> x18_repeatMap;
EUsageMode x2c_mode;
std::stack<CSaveableState, std::vector<CSaveableState>> x30_saveStack;
2016-03-11 00:23:16 +00:00
CVParamTransfer x38_frameFactoryParams;
std::chrono::time_point<std::chrono::steady_clock> x40_constructTime;
void AddFactories(EUsageMode mode);
void LoadWidgetFunctions();
2016-03-14 00:58:19 +00:00
static CGuiWidget* CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame);
2016-03-11 00:23:16 +00:00
public:
CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode);
CSimplePool& GetResStore() {return x4_resStore;}
2016-03-14 23:32:44 +00:00
std::unordered_map<EPhysicalControllerID, CGuiAutoRepeatData>& GetRepeatMap() {return x18_repeatMap;}
EUsageMode GetUsageMode() const {return x2c_mode;}
2016-03-11 00:23:16 +00:00
};
/** Parameter pack for FRME factory */
struct CGuiResFrameData
{
CGuiSys& x0_guiSys;
CGuiResFrameData(CGuiSys& guiSys) : x0_guiSys(guiSys) {}
2015-08-18 05:54:43 +00:00
};
}
2016-03-10 03:47:37 +00:00
#endif // __URDE_CGUISYS_HPP__