mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 16:27:42 +00:00
Working font rendering
This commit is contained in:
@@ -7,19 +7,33 @@ namespace Specter
|
||||
RootView::RootView(ViewSystem& system, boo::IWindow* window)
|
||||
: View(system), m_window(window), m_textView(system, system.m_mainFont)
|
||||
{
|
||||
window->setCallback(this);
|
||||
boo::SWindowRect rect = window->getWindowFrame();
|
||||
m_renderTex = system.m_factory->newRenderTexture(rect.size[0], rect.size[1], 1);
|
||||
system.m_factory->commit();
|
||||
resized(rect);
|
||||
m_textView.typesetGlyphs("Hello, World!");
|
||||
m_textView.typesetGlyphs("Hello, World! — こんにちは世界!", Zeus::CColor::skGreen);
|
||||
Zeus::CColor transBlack(0.f, 0.f, 0.f, 0.5f);
|
||||
m_textView.setBackground(transBlack);
|
||||
setBackground(Zeus::CColor::skBlue);
|
||||
}
|
||||
|
||||
void RootView::destroyed()
|
||||
{
|
||||
m_destroyed = true;
|
||||
}
|
||||
|
||||
void RootView::resized(const boo::SWindowRect& rect)
|
||||
{
|
||||
m_rootRect = rect;
|
||||
resized(rect, rect);
|
||||
}
|
||||
|
||||
void RootView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
m_rootRect = root;
|
||||
m_rootRect.location[0] = 0;
|
||||
m_rootRect.location[1] = 0;
|
||||
View::resized(m_rootRect);
|
||||
View::resized(m_rootRect, m_rootRect);
|
||||
boo::SWindowRect textRect = m_rootRect;
|
||||
textRect.location[0] = 10;
|
||||
textRect.location[1] = 10;
|
||||
@@ -27,7 +41,7 @@ void RootView::resized(const boo::SWindowRect& rect)
|
||||
if (textRect.size[0] < 0)
|
||||
textRect.size[0] = 0;
|
||||
textRect.size[1] = 10;
|
||||
m_textView.resized(textRect);
|
||||
m_textView.resized(m_rootRect, textRect);
|
||||
m_resizeRTDirty = true;
|
||||
}
|
||||
|
||||
@@ -94,7 +108,10 @@ void RootView::modKeyUp(boo::EModifierKey mod)
|
||||
void RootView::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
{
|
||||
if (m_resizeRTDirty)
|
||||
{
|
||||
gfxQ->resizeRenderTexture(m_renderTex, m_rootRect.size[0], m_rootRect.size[1]);
|
||||
m_resizeRTDirty = false;
|
||||
}
|
||||
gfxQ->setRenderTarget(m_renderTex);
|
||||
gfxQ->setViewport(m_rootRect);
|
||||
View::draw(gfxQ);
|
||||
|
||||
Reference in New Issue
Block a user