2016-03-12 04:58:56 +00:00
|
|
|
#include "CGuiPane.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2017-01-22 01:40:12 +00:00
|
|
|
CGuiPane::CGuiPane(const CGuiWidgetParms& parms, const zeus::CVector2f& dim,
|
2016-03-17 22:19:25 +00:00
|
|
|
const zeus::CVector3f& scaleCenter)
|
2017-01-30 04:16:20 +00:00
|
|
|
: CGuiWidget(parms), xb8_dim(dim), xc8_scaleCenter(scaleCenter)
|
2016-03-12 04:58:56 +00:00
|
|
|
{
|
|
|
|
InitializeBuffers();
|
|
|
|
}
|
|
|
|
|
2016-03-16 20:49:35 +00:00
|
|
|
void CGuiPane::ScaleDimensions(const zeus::CVector3f& scale)
|
|
|
|
{
|
2016-03-17 22:19:25 +00:00
|
|
|
InitializeBuffers();
|
|
|
|
|
2017-01-30 04:16:20 +00:00
|
|
|
for (specter::View::TexShaderVert& v : xc0_verts)
|
2016-03-17 22:19:25 +00:00
|
|
|
{
|
2017-01-30 04:16:20 +00:00
|
|
|
v.m_pos -= xc8_scaleCenter;
|
2016-03-17 22:19:25 +00:00
|
|
|
v.m_pos *= scale;
|
2017-01-30 04:16:20 +00:00
|
|
|
v.m_pos += xc8_scaleCenter;
|
2016-03-17 22:19:25 +00:00
|
|
|
}
|
2016-03-16 20:49:35 +00:00
|
|
|
}
|
|
|
|
|
2016-03-17 22:19:25 +00:00
|
|
|
void CGuiPane::SetDimensions(const zeus::CVector2f& dim, bool initVBO)
|
2016-03-16 20:49:35 +00:00
|
|
|
{
|
2017-01-22 01:40:12 +00:00
|
|
|
xb8_dim = dim;
|
2016-03-17 22:19:25 +00:00
|
|
|
if (initVBO)
|
|
|
|
InitializeBuffers();
|
2016-03-16 20:49:35 +00:00
|
|
|
}
|
|
|
|
|
2016-03-17 22:19:25 +00:00
|
|
|
zeus::CVector2f CGuiPane::GetDimensions() const
|
2016-03-16 20:49:35 +00:00
|
|
|
{
|
2017-01-22 01:40:12 +00:00
|
|
|
return xb8_dim;
|
2016-03-16 20:49:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGuiPane::InitializeBuffers()
|
|
|
|
{
|
2017-01-30 04:16:20 +00:00
|
|
|
if (xc0_verts.size() < 4)
|
|
|
|
xc0_verts.resize(4);
|
2016-03-17 22:19:25 +00:00
|
|
|
|
2017-01-30 04:16:20 +00:00
|
|
|
xc0_verts[0].m_pos.assign(-xb8_dim.x * 0.5f, 0.f, xb8_dim.y * 0.5f);
|
|
|
|
xc0_verts[1].m_pos.assign(-xb8_dim.x * 0.5f, 0.f, -xb8_dim.y * 0.5f);
|
|
|
|
xc0_verts[2].m_pos.assign(xb8_dim.x * 0.5f, 0.f, xb8_dim.y * 0.5f);
|
|
|
|
xc0_verts[3].m_pos.assign(xb8_dim.x * 0.5f, 0.f, -xb8_dim.y * 0.5f);
|
2016-03-16 20:49:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGuiPane::WriteData(COutputStream& out, bool flag) const
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-22 01:40:12 +00:00
|
|
|
std::shared_ptr<CGuiWidget> CGuiPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp)
|
2016-03-12 04:58:56 +00:00
|
|
|
{
|
2017-01-22 01:40:12 +00:00
|
|
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
|
|
|
|
zeus::CVector2f dim = zeus::CVector2f::ReadBig(in);
|
|
|
|
zeus::CVector3f scaleCenter = zeus::CVector3f::ReadBig(in);
|
|
|
|
std::shared_ptr<CGuiWidget> ret = std::make_shared<CGuiPane>(parms, dim, scaleCenter);
|
|
|
|
ret->ParseBaseInfo(frame, in, parms);
|
|
|
|
return ret;
|
2016-03-12 04:58:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|