2016-03-04 23:03:47 +00:00
|
|
|
#include "specter/Icon.hpp"
|
|
|
|
#include "specter/RootView.hpp"
|
2016-01-18 23:32:16 +00:00
|
|
|
|
2018-12-08 05:24:02 +00:00
|
|
|
namespace specter {
|
2016-01-18 23:32:16 +00:00
|
|
|
|
2018-12-08 05:24:02 +00:00
|
|
|
IconView::IconView(ViewResources& res, View& parentView, Icon& icon) : View(res, parentView) {
|
|
|
|
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
|
|
|
buildResources(ctx, res);
|
|
|
|
m_vertexBinding.init(ctx, res, 4, m_viewVertBlockBuf, icon.m_tex);
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
TexShaderVert verts[] = {
|
|
|
|
{{0, 1, 0}, icon.m_uvCoords[0]},
|
|
|
|
{{0, 0, 0}, icon.m_uvCoords[1]},
|
|
|
|
{{1, 1, 0}, icon.m_uvCoords[2]},
|
|
|
|
{{1, 0, 0}, icon.m_uvCoords[3]},
|
|
|
|
};
|
|
|
|
m_vertexBinding.load<decltype(verts)>(verts);
|
2019-02-24 07:16:37 +00:00
|
|
|
setBackground(zeus::skBlue);
|
2016-01-18 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:24:02 +00:00
|
|
|
void IconView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {
|
|
|
|
m_viewVertBlock.setViewRect(root, sub);
|
|
|
|
m_viewVertBlock.m_mv[0][0] *= sub.size[0];
|
|
|
|
m_viewVertBlock.m_mv[1][1] *= sub.size[1];
|
|
|
|
View::resized(m_viewVertBlock, sub);
|
2016-01-18 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:24:02 +00:00
|
|
|
void IconView::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
|
|
|
gfxQ->setShaderDataBinding(m_vertexBinding);
|
|
|
|
gfxQ->draw(0, 4);
|
2016-01-18 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:24:02 +00:00
|
|
|
} // namespace specter
|