#ifndef __URDE_CGUISYS_HPP__ #define __URDE_CGUISYS_HPP__ #include "hecl/hecl.hpp" #include #include #include #include #include "CGuiAutoRepeatData.hpp" #include "CSaveableState.hpp" #include "IOStreams.hpp" namespace urde { class CGuiObject; class CVParamTransfer; class SObjectTag; class IFactory; class CSimplePool; class CGuiWidget; class CGuiFrame; typedef CGuiObject*(*FGuiFactoryFunc)(const SObjectTag&, const CVParamTransfer&); class CGuiFactoryMgr { friend class CGuiSys; std::unordered_map m_factories; public: void AddFactory(FourCC key, FGuiFactoryFunc func) { m_factories[key] = func; } }; class CGuiSys { friend class CGuiFrame; public: enum class EUsageMode { Zero, One, Two }; private: IFactory& x0_resFactory; CSimplePool& x4_resStore; CGuiFactoryMgr x8_factoryMgr; std::unordered_map x18_repeatMap; EUsageMode x2c_mode; std::stack> x30_saveStack; CVParamTransfer x38_frameFactoryParams; std::chrono::time_point x40_constructTime; void AddFactories(EUsageMode mode); void LoadWidgetFunctions(); static CGuiWidget* CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* frame); public: CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode); CSimplePool& GetResStore() {return x4_resStore;} std::unordered_map& GetRepeatMap() {return x18_repeatMap;} EUsageMode GetUsageMode() const {return x2c_mode;} }; /** Global GuiSys instance */ extern CGuiSys* g_GuiSys; /** Parameter pack for FRME factory */ struct CGuiResFrameData { CGuiSys& x0_guiSys; CGuiResFrameData(CGuiSys& guiSys) : x0_guiSys(guiSys) {} }; } #endif // __URDE_CGUISYS_HPP__