2015-12-02 01:32:15 +00:00
|
|
|
#include "Specter/ViewResources.hpp"
|
2015-11-26 00:24:01 +00:00
|
|
|
|
|
|
|
namespace Specter
|
|
|
|
{
|
|
|
|
static LogVisor::LogModule Log("Specter");
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache, float pixelScale)
|
2015-11-26 00:24:01 +00:00
|
|
|
{
|
|
|
|
m_factory = factory;
|
2015-12-02 01:32:15 +00:00
|
|
|
m_mainFont = fcache->prepMainFont(factory, AllCharFilter, false, 10.0, 72 * pixelScale);
|
|
|
|
m_monoFont = fcache->prepMonoFont(factory, AllCharFilter, false, 10.0, 72 * pixelScale);
|
|
|
|
m_heading14 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 14.0, 72 * pixelScale);
|
|
|
|
m_heading18 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 18.0, 72 * pixelScale);
|
2015-11-26 00:24:01 +00:00
|
|
|
switch (factory->platform())
|
|
|
|
{
|
|
|
|
case boo::IGraphicsDataFactory::Platform::OGL:
|
|
|
|
init<boo::GLDataFactory>(static_cast<boo::GLDataFactory*>(factory), fcache);
|
|
|
|
break;
|
|
|
|
#if _WIN32
|
|
|
|
case boo::IGraphicsDataFactory::Platform::D3D11:
|
|
|
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
|
|
|
init<boo::ID3DDataFactory>(static_cast<boo::ID3DDataFactory*>(factory), fcache);
|
|
|
|
break;
|
|
|
|
#elif BOO_HAS_METAL
|
|
|
|
case boo::IGraphicsDataFactory::Platform::Metal:
|
|
|
|
init<boo::MetalDataFactory>(static_cast<boo::MetalDataFactory*>(factory), fcache);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
Log.report(LogVisor::FatalError, _S("unable to init view system for %s"), factory->platformName());
|
|
|
|
}
|
2015-11-26 07:35:43 +00:00
|
|
|
fcache->closeBuiltinFonts();
|
2015-12-02 01:32:15 +00:00
|
|
|
m_resData.reset(factory->commit());
|
2015-11-26 00:24:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|