2017-11-23 22:44:20 +01:00
|
|
|
#include "externals.hh"
|
2017-11-24 09:51:05 +01:00
|
|
|
#include "common.hh"
|
2017-11-23 22:44:20 +01:00
|
|
|
#include "ui.hh"
|
2017-11-23 22:51:50 +01:00
|
|
|
#include "ui-app.hh"
|
2017-11-23 23:31:24 +01:00
|
|
|
#include "ui-odbg.hh"
|
|
|
|
#include "ui-profiling.hh"
|
|
|
|
#include "ui-shaders.hh"
|
2017-11-23 22:44:20 +01:00
|
|
|
#include "ui-sync.hh"
|
2017-11-23 23:31:24 +01:00
|
|
|
#include "ui-texture.hh"
|
2017-11-23 22:44:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
struct UIData_
|
|
|
|
{
|
2017-11-23 22:51:50 +01:00
|
|
|
T_UIApp window;
|
2017-11-23 23:31:24 +01:00
|
|
|
T_Profiler profiler;
|
2017-11-23 22:44:20 +01:00
|
|
|
T_TextureManager textures;
|
|
|
|
T_ShaderManager shaders;
|
|
|
|
T_OutputDebugger odbg;
|
|
|
|
T_UISync sync;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::aligned_storage_t< sizeof( UIData_ ) , alignof( UIData_ ) > Instance_;
|
|
|
|
|
|
|
|
} // namespace <anon>
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void UI::Init( ) noexcept
|
|
|
|
{
|
2017-11-24 09:51:05 +01:00
|
|
|
Common::Init( );
|
2017-11-23 22:44:20 +01:00
|
|
|
new ((char*)&Instance_) UIData_( );
|
|
|
|
}
|
|
|
|
|
|
|
|
void UI::Shutdown( ) noexcept
|
|
|
|
{
|
|
|
|
((UIData_*)(char*)&Instance_)->~UIData_( );
|
2017-11-24 09:51:05 +01:00
|
|
|
Common::Shutdown( );
|
2017-11-23 22:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#define M_GET_( P ) ((UIData_*)(char*)&Instance_)->P
|
|
|
|
|
2017-11-23 22:51:50 +01:00
|
|
|
T_UIApp& UI::Main( ) noexcept
|
2017-11-23 22:44:20 +01:00
|
|
|
{ return M_GET_( window ); }
|
|
|
|
|
2017-11-23 23:31:24 +01:00
|
|
|
T_Profiler& UI::Profiler( ) noexcept
|
|
|
|
{ return M_GET_( profiler ); }
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
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 ); }
|