metaforce/specter/lib/RootView.cpp

106 lines
2.4 KiB
C++
Raw Normal View History

2015-11-21 01:14:49 +00:00
#include "Specter/RootView.hpp"
2015-11-26 07:35:43 +00:00
#include "Specter/ViewSystem.hpp"
2015-11-21 01:14:49 +00:00
2015-11-21 23:45:02 +00:00
namespace Specter
{
2015-11-21 01:14:49 +00:00
2015-11-26 00:24:01 +00:00
RootView::RootView(ViewSystem& system, boo::IWindow* window)
2015-11-26 07:35:43 +00:00
: View(system), m_window(window), m_textView(system, system.m_mainFont)
2015-11-21 23:45:02 +00:00
{
2015-11-26 07:35:43 +00:00
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!");
2015-11-21 23:45:02 +00:00
}
void RootView::resized(const boo::SWindowRect& rect)
{
2015-11-26 07:35:43 +00:00
m_rootRect = rect;
m_rootRect.location[0] = 0;
m_rootRect.location[1] = 0;
View::resized(m_rootRect);
boo::SWindowRect textRect = m_rootRect;
textRect.location[0] = 10;
textRect.location[1] = 10;
textRect.size[0] -= 20;
if (textRect.size[0] < 0)
textRect.size[0] = 0;
textRect.size[1] = 10;
m_textView.resized(textRect);
m_resizeRTDirty = true;
2015-11-21 23:45:02 +00:00
}
void RootView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods)
{
}
void RootView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods)
{
}
void RootView::mouseMove(const boo::SWindowCoord& coord)
{
}
void RootView::mouseEnter(const boo::SWindowCoord& coord)
{
}
void RootView::mouseLeave(const boo::SWindowCoord& coord)
{
}
void RootView::scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll)
{
}
void RootView::touchDown(const boo::STouchCoord& coord, uintptr_t tid)
{
}
void RootView::touchUp(const boo::STouchCoord& coord, uintptr_t tid)
{
}
void RootView::touchMove(const boo::STouchCoord& coord, uintptr_t tid)
{
}
void RootView::charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat)
{
}
void RootView::charKeyUp(unsigned long charCode, boo::EModifierKey mods)
{
}
void RootView::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat)
{
}
void RootView::specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods)
{
}
void RootView::modKeyDown(boo::EModifierKey mod, bool isRepeat)
{
}
void RootView::modKeyUp(boo::EModifierKey mod)
{
}
void RootView::draw(boo::IGraphicsCommandQueue* gfxQ)
{
2015-11-26 07:35:43 +00:00
if (m_resizeRTDirty)
gfxQ->resizeRenderTexture(m_renderTex, m_rootRect.size[0], m_rootRect.size[1]);
gfxQ->setRenderTarget(m_renderTex);
gfxQ->setViewport(m_rootRect);
2015-11-26 00:24:01 +00:00
View::draw(gfxQ);
2015-11-26 07:35:43 +00:00
m_textView.draw(gfxQ);
gfxQ->resolveDisplay(m_renderTex);
2015-11-21 23:45:02 +00:00
}
}