#include "externals.hh" #include "odbg.hh" #include "shaders.hh" #include "texture.hh" #include "ui.hh" #include "ui-app.hh" #include "ui-sync.hh" namespace { struct UIData_ { T_UIApp window; T_TextureManager textures; T_ShaderManager shaders; T_OutputDebugger odbg; T_UISync sync; }; std::aligned_storage_t< sizeof( UIData_ ) , alignof( UIData_ ) > Instance_; } // namespace /*----------------------------------------------------------------------------*/ void UI::Init( ) noexcept { new ((char*)&Instance_) UIData_( ); } void UI::Shutdown( ) noexcept { ((UIData_*)(char*)&Instance_)->~UIData_( ); } /*----------------------------------------------------------------------------*/ #define M_GET_( P ) ((UIData_*)(char*)&Instance_)->P T_UIApp& UI::Main( ) noexcept { return M_GET_( window ); } T_TextureManager& UI::Textures( ) noexcept { return M_GET_( textures ); } T_ShaderManager& UI::Shaders( ) noexcept { return M_GET_( shaders ); } T_OutputDebugger& UI::ODbg( ) noexcept { return M_GET_( odbg ); } T_UISync& UI::Sync( ) noexcept { return M_GET_( sync ); }