mirror of https://github.com/AxioDL/metaforce.git
Deadlock fix and toolbar shading
This commit is contained in:
parent
bd0becc9c0
commit
f53127290d
|
@ -239,21 +239,26 @@ struct DeferredWindowEvents : public boo::IWindowCallback
|
||||||
void dispatchEvents()
|
void dispatchEvents()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(m_mt);
|
std::unique_lock<std::mutex> lk(m_mt);
|
||||||
if (m_destroyed)
|
bool destroyed = m_destroyed;
|
||||||
|
bool hasResize = m_hasResize;
|
||||||
|
if (hasResize)
|
||||||
|
m_hasResize = false;
|
||||||
|
boo::SWindowRect latestResize = m_latestResize;
|
||||||
|
std::vector<Command> cmds;
|
||||||
|
m_cmds.swap(cmds);
|
||||||
|
lk.unlock();
|
||||||
|
|
||||||
|
if (destroyed)
|
||||||
{
|
{
|
||||||
m_rec.destroyed();
|
m_rec.destroyed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_hasResize)
|
if (hasResize)
|
||||||
{
|
m_rec.resized(latestResize, latestResize);
|
||||||
m_rec.resized(m_latestResize, m_latestResize);
|
|
||||||
m_hasResize = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const Command& cmd : m_cmds)
|
for (const Command& cmd : cmds)
|
||||||
cmd.dispatch(m_rec);
|
cmd.dispatch(m_rec);
|
||||||
m_cmds.clear();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ public:
|
||||||
friend class SplitView;
|
friend class SplitView;
|
||||||
boo::ITextureS* m_shadingTex;
|
boo::ITextureS* m_shadingTex;
|
||||||
|
|
||||||
void init(boo::IGraphicsDataFactory* factory);
|
void init(boo::IGraphicsDataFactory* factory, const ThemeData& theme);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Axis
|
enum class Axis
|
||||||
|
|
|
@ -15,7 +15,7 @@ public:
|
||||||
friend class Toolbar;
|
friend class Toolbar;
|
||||||
boo::ITextureS* m_shadingTex;
|
boo::ITextureS* m_shadingTex;
|
||||||
|
|
||||||
void init(boo::IGraphicsDataFactory* factory);
|
void init(boo::IGraphicsDataFactory* factory, const ThemeData& theme);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Position
|
enum class Position
|
||||||
|
@ -27,7 +27,7 @@ private:
|
||||||
Position m_tbPos;
|
Position m_tbPos;
|
||||||
|
|
||||||
std::unique_ptr<View> m_contentView;
|
std::unique_ptr<View> m_contentView;
|
||||||
ViewBlock m_splitBlock;
|
ViewBlock m_tbBlock;
|
||||||
boo::IGraphicsBufferD* m_tbBlockBuf;
|
boo::IGraphicsBufferD* m_tbBlockBuf;
|
||||||
struct ToolbarVert
|
struct ToolbarVert
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,8 @@ public:
|
||||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||||
void resetResources(ViewResources& res);
|
void resetResources(ViewResources& res);
|
||||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||||
|
|
||||||
|
int gauge() const {return m_gauge;}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
namespace Specter
|
namespace Specter
|
||||||
{
|
{
|
||||||
|
class ThemeData;
|
||||||
class ViewResources;
|
class ViewResources;
|
||||||
class RootView;
|
class RootView;
|
||||||
|
|
||||||
|
@ -72,11 +73,11 @@ public:
|
||||||
boo::IShaderPipeline* m_texShader = nullptr;
|
boo::IShaderPipeline* m_texShader = nullptr;
|
||||||
boo::IVertexFormat* m_texVtxFmt = nullptr; /* Not OpenGL */
|
boo::IVertexFormat* m_texVtxFmt = nullptr; /* Not OpenGL */
|
||||||
|
|
||||||
void init(boo::GLDataFactory* factory);
|
void init(boo::GLDataFactory* factory, const ThemeData& theme);
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
void init(boo::ID3DDataFactory* factory);
|
void init(boo::ID3DDataFactory* factory, const ThemeData& theme);
|
||||||
#elif BOO_HAS_METAL
|
#elif BOO_HAS_METAL
|
||||||
void init(boo::MetalDataFactory* factory);
|
void init(boo::MetalDataFactory* factory, const ThemeData& theme);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,22 +7,36 @@
|
||||||
|
|
||||||
namespace Specter
|
namespace Specter
|
||||||
{
|
{
|
||||||
|
class ThemeData
|
||||||
|
{
|
||||||
|
Zeus::CColor m_vpBg = {0.2,0.2,0.2,1.0};
|
||||||
|
Zeus::CColor m_tbBg = {0.4,0.4,0.4,1.0};
|
||||||
|
Zeus::CColor m_uiText = Zeus::CColor::skWhite;
|
||||||
|
public:
|
||||||
|
virtual const Zeus::CColor& viewportBackground() const {return m_vpBg;}
|
||||||
|
virtual const Zeus::CColor& toolbarBackground() const {return m_tbBg;}
|
||||||
|
virtual const Zeus::CColor& uiText() const {return m_uiText;}
|
||||||
|
};
|
||||||
|
|
||||||
class ViewResources
|
class ViewResources
|
||||||
{
|
{
|
||||||
template <class Factory>
|
template <class Factory>
|
||||||
void init(Factory* factory, FontCache* fcache)
|
void init(Factory* factory, FontCache* fcache, const ThemeData& theme)
|
||||||
{
|
{
|
||||||
m_viewRes.init(factory);
|
m_viewRes.init(factory, theme);
|
||||||
m_textRes.init(factory, fcache);
|
m_textRes.init(factory, fcache);
|
||||||
m_splitRes.init(factory);
|
m_splitRes.init(factory, theme);
|
||||||
|
m_toolbarRes.init(factory, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
boo::IGraphicsDataFactory* m_factory = nullptr;
|
boo::IGraphicsDataFactory* m_factory = nullptr;
|
||||||
|
FontCache* m_fcache = nullptr;
|
||||||
View::Resources m_viewRes;
|
View::Resources m_viewRes;
|
||||||
TextView::Resources m_textRes;
|
TextView::Resources m_textRes;
|
||||||
SplitView::Resources m_splitRes;
|
SplitView::Resources m_splitRes;
|
||||||
Toolbar::Resources m_toolbarRes;
|
Toolbar::Resources m_toolbarRes;
|
||||||
|
std::unique_ptr<boo::IGraphicsData> m_fontData;
|
||||||
std::unique_ptr<boo::IGraphicsData> m_resData;
|
std::unique_ptr<boo::IGraphicsData> m_resData;
|
||||||
|
|
||||||
Specter::FontTag m_mainFont;
|
Specter::FontTag m_mainFont;
|
||||||
|
@ -37,10 +51,15 @@ public:
|
||||||
ViewResources& operator=(const ViewResources& other) = delete;
|
ViewResources& operator=(const ViewResources& other) = delete;
|
||||||
ViewResources& operator=(ViewResources&& other) = default;
|
ViewResources& operator=(ViewResources&& other) = default;
|
||||||
|
|
||||||
void init(boo::IGraphicsDataFactory* factory, FontCache* fcache, unsigned dpi);
|
void init(boo::IGraphicsDataFactory* factory, FontCache* fcache, const ThemeData& theme, unsigned dpi);
|
||||||
|
void resetDPI(unsigned dpi);
|
||||||
|
void resetTheme(const ThemeData& theme);
|
||||||
|
|
||||||
float m_pixelFactor = 0;
|
float m_pixelFactor = 0;
|
||||||
float pixelFactor() const {return m_pixelFactor;}
|
float pixelFactor() const {return m_pixelFactor;}
|
||||||
|
|
||||||
|
ThemeData m_theme;
|
||||||
|
const ThemeData& themeData() const {return m_theme;}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "Specter/RootView.hpp"
|
#include "Specter/RootView.hpp"
|
||||||
#include "Specter/ViewResources.hpp"
|
#include "Specter/ViewResources.hpp"
|
||||||
|
#include "Specter/Space.hpp"
|
||||||
|
|
||||||
namespace Specter
|
namespace Specter
|
||||||
{
|
{
|
||||||
|
@ -13,16 +14,19 @@ RootView::RootView(ViewResources& res, boo::IWindow* window)
|
||||||
m_renderTex = res.m_factory->newRenderTexture(rect.size[0], rect.size[1], 1);
|
m_renderTex = res.m_factory->newRenderTexture(rect.size[0], rect.size[1], 1);
|
||||||
commitResources(res);
|
commitResources(res);
|
||||||
m_splitView.reset(new SplitView(res, *this, SplitView::Axis::Horizontal));
|
m_splitView.reset(new SplitView(res, *this, SplitView::Axis::Horizontal));
|
||||||
|
Space* space1 = new Space(res, *m_splitView, Toolbar::Position::Bottom);
|
||||||
MultiLineTextView* textView1 = new MultiLineTextView(res, *this, res.m_heading18);
|
MultiLineTextView* textView1 = new MultiLineTextView(res, *this, res.m_heading18);
|
||||||
|
space1->setContentView(std::unique_ptr<MultiLineTextView>(textView1));
|
||||||
|
Space* space2 = new Space(res, *m_splitView, Toolbar::Position::Bottom);
|
||||||
MultiLineTextView* textView2 = new MultiLineTextView(res, *this, res.m_heading18);
|
MultiLineTextView* textView2 = new MultiLineTextView(res, *this, res.m_heading18);
|
||||||
m_splitView->setContentView(0, std::unique_ptr<MultiLineTextView>(textView1));
|
space2->setContentView(std::unique_ptr<MultiLineTextView>(textView2));
|
||||||
m_splitView->setContentView(1, std::unique_ptr<MultiLineTextView>(textView2));
|
m_splitView->setContentView(0, std::unique_ptr<Space>(space1));
|
||||||
|
m_splitView->setContentView(1, std::unique_ptr<Space>(space2));
|
||||||
resized(rect, rect);
|
resized(rect, rect);
|
||||||
textView1->typesetGlyphs("Hello, World!\n\n", Zeus::CColor::skWhite);
|
textView1->typesetGlyphs("Hello, World!\n\n", res.themeData().uiText());
|
||||||
textView2->typesetGlyphs("こんにちは世界!\n\n", Zeus::CColor::skWhite);
|
textView2->typesetGlyphs("こんにちは世界!\n\n", res.themeData().uiText());
|
||||||
Zeus::CColor transBlack(0.f, 0.f, 0.f, 0.5f);
|
textView1->setBackground(res.themeData().viewportBackground());
|
||||||
textView1->setBackground(transBlack);
|
textView2->setBackground(res.themeData().viewportBackground());
|
||||||
textView2->setBackground(transBlack);
|
|
||||||
setBackground(Zeus::CColor::skGrey);
|
setBackground(Zeus::CColor::skGrey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,16 +38,32 @@ void Space::resetResources(ViewResources& res)
|
||||||
{
|
{
|
||||||
if (m_contentView)
|
if (m_contentView)
|
||||||
m_contentView->resetResources(res);
|
m_contentView->resetResources(res);
|
||||||
|
m_toolbar->resetResources(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Space::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
void Space::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||||
{
|
{
|
||||||
View::resized(root, sub);
|
View::resized(root, sub);
|
||||||
|
|
||||||
|
boo::SWindowRect tbRect = sub;
|
||||||
|
tbRect.size[1] = m_toolbar->gauge();
|
||||||
|
m_toolbar->resized(root, tbRect);
|
||||||
|
|
||||||
|
if (m_contentView)
|
||||||
|
{
|
||||||
|
tbRect.location[1] += tbRect.size[1];
|
||||||
|
tbRect.size[1] = sub.size[1] - tbRect.size[1];
|
||||||
|
tbRect.size[1] = std::max(tbRect.size[1], 0);
|
||||||
|
m_contentView->resized(root, tbRect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Space::draw(boo::IGraphicsCommandQueue* gfxQ)
|
void Space::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||||
{
|
{
|
||||||
View::draw(gfxQ);
|
View::draw(gfxQ);
|
||||||
|
if (m_contentView)
|
||||||
|
m_contentView->draw(gfxQ);
|
||||||
|
m_toolbar->draw(gfxQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Specter
|
||||||
{
|
{
|
||||||
static LogVisor::LogModule Log("Specter::SplitView");
|
static LogVisor::LogModule Log("Specter::SplitView");
|
||||||
|
|
||||||
void SplitView::Resources::init(boo::IGraphicsDataFactory* factory)
|
void SplitView::Resources::init(boo::IGraphicsDataFactory* factory, const ThemeData& theme)
|
||||||
{
|
{
|
||||||
static const Zeus::RGBA32 tex[3] =
|
static const Zeus::RGBA32 tex[3] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,52 +2,55 @@
|
||||||
#include "Specter/Toolbar.hpp"
|
#include "Specter/Toolbar.hpp"
|
||||||
#include "Specter/ViewResources.hpp"
|
#include "Specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#define TOOLBAR_GAUGE 28
|
||||||
|
|
||||||
namespace Specter
|
namespace Specter
|
||||||
{
|
{
|
||||||
static LogVisor::LogModule Log("Specter::Space");
|
static LogVisor::LogModule Log("Specter::Space");
|
||||||
|
|
||||||
void Toolbar::Resources::init(boo::IGraphicsDataFactory* factory)
|
void Toolbar::Resources::init(boo::IGraphicsDataFactory* factory, const ThemeData& theme)
|
||||||
{
|
{
|
||||||
static const Zeus::RGBA32 tex[3] =
|
static const Zeus::RGBA32 tex[3] =
|
||||||
{
|
{
|
||||||
{0,0,0,64},
|
{255,255,255,64},
|
||||||
{0,0,0,0},
|
{255,255,255,64},
|
||||||
{255,255,255,64}
|
{0,0,0,64}
|
||||||
};
|
};
|
||||||
m_shadingTex = factory->newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, tex, 12);
|
m_shadingTex = factory->newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, tex, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolbar::Toolbar(ViewResources& system, View& parentView, Position tbPos)
|
Toolbar::Toolbar(ViewResources& res, View& parentView, Position tbPos)
|
||||||
: View(system, parentView), m_tbPos(tbPos), m_gauge(system.pixelFactor() * 25)
|
: View(res, parentView), m_tbPos(tbPos), m_gauge(res.pixelFactor() * TOOLBAR_GAUGE)
|
||||||
{
|
{
|
||||||
m_tbBlockBuf = system.m_factory->newDynamicBuffer(boo::BufferUse::Uniform, sizeof(ViewBlock), 1);
|
m_tbBlockBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Uniform, sizeof(ViewBlock), 1);
|
||||||
m_tbVertsBuf = system.m_factory->newDynamicBuffer(boo::BufferUse::Vertex, sizeof(ToolbarVert), 10);
|
m_tbVertsBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Vertex, sizeof(ToolbarVert), 10);
|
||||||
|
|
||||||
if (!system.m_viewRes.m_texVtxFmt)
|
if (!res.m_viewRes.m_texVtxFmt)
|
||||||
{
|
{
|
||||||
boo::VertexElementDescriptor vdescs[] =
|
boo::VertexElementDescriptor vdescs[] =
|
||||||
{
|
{
|
||||||
{m_tbVertsBuf, nullptr, boo::VertexSemantic::Position4},
|
{m_tbVertsBuf, nullptr, boo::VertexSemantic::Position4},
|
||||||
{m_tbVertsBuf, nullptr, boo::VertexSemantic::UV4}
|
{m_tbVertsBuf, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
m_tbVtxFmt = system.m_factory->newVertexFormat(2, vdescs);
|
m_tbVtxFmt = res.m_factory->newVertexFormat(2, vdescs);
|
||||||
boo::IGraphicsBuffer* bufs[] = {m_tbBlockBuf};
|
boo::IGraphicsBuffer* bufs[] = {m_tbBlockBuf};
|
||||||
boo::ITexture* texs[] = {system.m_toolbarRes.m_shadingTex};
|
boo::ITexture* texs[] = {res.m_toolbarRes.m_shadingTex};
|
||||||
m_tbShaderBinding = system.m_factory->newShaderDataBinding(system.m_viewRes.m_texShader,
|
m_tbShaderBinding = res.m_factory->newShaderDataBinding(res.m_viewRes.m_texShader,
|
||||||
m_tbVtxFmt, m_tbVertsBuf, nullptr,
|
m_tbVtxFmt, m_tbVertsBuf, nullptr,
|
||||||
nullptr, 1, bufs, 1, texs);
|
nullptr, 1, bufs, 1, texs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boo::IGraphicsBuffer* bufs[] = {m_tbBlockBuf};
|
boo::IGraphicsBuffer* bufs[] = {m_tbBlockBuf};
|
||||||
boo::ITexture* texs[] = {system.m_toolbarRes.m_shadingTex};
|
boo::ITexture* texs[] = {res.m_toolbarRes.m_shadingTex};
|
||||||
m_tbShaderBinding = system.m_factory->newShaderDataBinding(system.m_viewRes.m_texShader,
|
m_tbShaderBinding = res.m_factory->newShaderDataBinding(res.m_viewRes.m_texShader,
|
||||||
system.m_viewRes.m_texVtxFmt,
|
res.m_viewRes.m_texVtxFmt,
|
||||||
m_tbVertsBuf, nullptr,
|
m_tbVertsBuf, nullptr,
|
||||||
nullptr, 1, bufs, 1, texs);
|
nullptr, 1, bufs, 1, texs);
|
||||||
}
|
}
|
||||||
|
|
||||||
commitResources(system);
|
setBackground(res.themeData().toolbarBackground());
|
||||||
|
commitResources(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toolbar::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
void Toolbar::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||||
|
@ -64,7 +67,8 @@ void Toolbar::mouseMove(const boo::SWindowCoord& coord)
|
||||||
|
|
||||||
void Toolbar::resetResources(ViewResources& res)
|
void Toolbar::resetResources(ViewResources& res)
|
||||||
{
|
{
|
||||||
m_gauge = res.pixelFactor() * 25;
|
m_gauge = res.pixelFactor() * TOOLBAR_GAUGE;
|
||||||
|
setBackground(res.themeData().toolbarBackground());
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,12 +77,16 @@ void Toolbar::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||||
View::resized(root, sub);
|
View::resized(root, sub);
|
||||||
setHorizontalVerts(sub.size[0]);
|
setHorizontalVerts(sub.size[0]);
|
||||||
m_tbVertsBuf->load(&m_tbVerts, sizeof(ToolbarVert) * 10);
|
m_tbVertsBuf->load(&m_tbVerts, sizeof(ToolbarVert) * 10);
|
||||||
|
m_tbBlock.setViewRect(root, sub);
|
||||||
|
m_tbBlockBuf->load(&m_tbBlock, sizeof(ViewBlock));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toolbar::draw(boo::IGraphicsCommandQueue* gfxQ)
|
void Toolbar::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||||
{
|
{
|
||||||
View::draw(gfxQ);
|
View::draw(gfxQ);
|
||||||
|
gfxQ->setShaderDataBinding(m_tbShaderBinding);
|
||||||
|
gfxQ->setDrawPrimitive(boo::Primitive::TriStrips);
|
||||||
|
gfxQ->draw(0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
namespace Specter
|
namespace Specter
|
||||||
{
|
{
|
||||||
|
|
||||||
void View::Resources::init(boo::GLDataFactory* factory)
|
void View::Resources::init(boo::GLDataFactory* factory, const ThemeData& theme)
|
||||||
{
|
{
|
||||||
static const char* SolidVS =
|
static const char* SolidVS =
|
||||||
"#version 330\n"
|
"#version 330\n"
|
||||||
|
|
|
@ -4,27 +4,31 @@ namespace Specter
|
||||||
{
|
{
|
||||||
static LogVisor::LogModule Log("Specter::ViewResources");
|
static LogVisor::LogModule Log("Specter::ViewResources");
|
||||||
|
|
||||||
void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache, unsigned dpi)
|
void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache,
|
||||||
|
const ThemeData& theme, unsigned dpi)
|
||||||
{
|
{
|
||||||
m_pixelFactor = dpi / 72.f;
|
m_pixelFactor = dpi / 72.f;
|
||||||
|
m_theme = theme;
|
||||||
m_factory = factory;
|
m_factory = factory;
|
||||||
|
m_fcache = fcache;
|
||||||
m_mainFont = fcache->prepMainFont(factory, AllCharFilter, false, 10.f, dpi);
|
m_mainFont = fcache->prepMainFont(factory, AllCharFilter, false, 10.f, dpi);
|
||||||
m_monoFont = fcache->prepMonoFont(factory, AllCharFilter, false, 10.f, dpi);
|
m_monoFont = fcache->prepMonoFont(factory, AllCharFilter, false, 10.f, dpi);
|
||||||
m_heading14 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 14.f, dpi);
|
m_heading14 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 14.f, dpi);
|
||||||
m_heading18 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 18.f, dpi);
|
m_heading18 = fcache->prepMainFont(factory, LatinAndJapaneseCharFilter, false, 18.f, dpi);
|
||||||
|
m_fontData.reset(factory->commit());
|
||||||
switch (factory->platform())
|
switch (factory->platform())
|
||||||
{
|
{
|
||||||
case boo::IGraphicsDataFactory::Platform::OGL:
|
case boo::IGraphicsDataFactory::Platform::OGL:
|
||||||
init<boo::GLDataFactory>(static_cast<boo::GLDataFactory*>(factory), fcache);
|
init<boo::GLDataFactory>(static_cast<boo::GLDataFactory*>(factory), fcache, theme);
|
||||||
break;
|
break;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D11:
|
case boo::IGraphicsDataFactory::Platform::D3D11:
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||||
init<boo::ID3DDataFactory>(static_cast<boo::ID3DDataFactory*>(factory), fcache);
|
init<boo::ID3DDataFactory>(static_cast<boo::ID3DDataFactory*>(factory), fcache, theme);
|
||||||
break;
|
break;
|
||||||
#elif BOO_HAS_METAL
|
#elif BOO_HAS_METAL
|
||||||
case boo::IGraphicsDataFactory::Platform::Metal:
|
case boo::IGraphicsDataFactory::Platform::Metal:
|
||||||
init<boo::MetalDataFactory>(static_cast<boo::MetalDataFactory*>(factory), fcache);
|
init<boo::MetalDataFactory>(static_cast<boo::MetalDataFactory*>(factory), fcache, theme);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -34,4 +38,20 @@ void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache,
|
||||||
m_resData.reset(factory->commit());
|
m_resData.reset(factory->commit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewResources::resetDPI(unsigned dpi)
|
||||||
|
{
|
||||||
|
m_pixelFactor = dpi / 72.f;
|
||||||
|
m_mainFont = m_fcache->prepMainFont(m_factory, AllCharFilter, false, 10.f, dpi);
|
||||||
|
m_monoFont = m_fcache->prepMonoFont(m_factory, AllCharFilter, false, 10.f, dpi);
|
||||||
|
m_heading14 = m_fcache->prepMainFont(m_factory, LatinAndJapaneseCharFilter, false, 14.f, dpi);
|
||||||
|
m_heading18 = m_fcache->prepMainFont(m_factory, LatinAndJapaneseCharFilter, false, 18.f, dpi);
|
||||||
|
m_fontData.reset(m_factory->commit());
|
||||||
|
m_fcache->closeBuiltinFonts();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewResources::resetTheme(const ThemeData& theme)
|
||||||
|
{
|
||||||
|
m_theme = theme;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue