#include "Runtime/GuiSys/CGuiPane.hpp" #include "Runtime/GuiSys/CGuiWidgetDrawParms.hpp" #include "Runtime/Graphics/CGraphics.hpp" #include namespace metaforce { CGuiPane::CGuiPane(const CGuiWidgetParms& parms, const zeus::CVector2f& dim, const zeus::CVector3f& scaleCenter) : CGuiWidget(parms), xb8_dim(dim), xc8_scaleCenter(scaleCenter) { CGuiPane::InitializeBuffers(); } void CGuiPane::Draw(const CGuiWidgetDrawParms& parms) { CGraphics::SetModelMatrix(x34_worldXF * zeus::CTransform::Translate(xc8_scaleCenter)); if (GetIsVisible()) { auto col = xa8_color2; col.a() = parms.x0_alphaMod * xa8_color2.a(); aurora::shaders::queue_colored_quad_verts(aurora::shaders::CameraFilterType::Blend, aurora::shaders::ZTest::Always, false, col, {xc0_verts.data(), xc0_verts.size()}); } CGuiWidget::Draw(parms); } void CGuiPane::ScaleDimensions(const zeus::CVector3f& scale) { InitializeBuffers(); for (auto& vert : xc0_verts) { vert -= xc8_scaleCenter; vert *= scale; vert += xc8_scaleCenter; } } void CGuiPane::SetDimensions(const zeus::CVector2f& dim, bool initBuffers) { xb8_dim = dim; if (initBuffers) InitializeBuffers(); } zeus::CVector2f CGuiPane::GetDimensions() const { return xb8_dim; } void CGuiPane::InitializeBuffers() { #if 0 if (xc0_verts == nullptr) { xc0_verts = new float[3 * 4]; } #endif xc0_verts[0].assign(-xb8_dim.x() * 0.5f, 0.f, xb8_dim.y() * 0.5f); xc0_verts[1].assign(-xb8_dim.x() * 0.5f, 0.f, -xb8_dim.y() * 0.5f); xc0_verts[2].assign(xb8_dim.x() * 0.5f, 0.f, xb8_dim.y() * 0.5f); xc0_verts[3].assign(xb8_dim.x() * 0.5f, 0.f, -xb8_dim.y() * 0.5f); } void CGuiPane::WriteData(COutputStream& out, bool flag) const {} std::shared_ptr CGuiPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); zeus::CVector2f dim = zeus::CVector2f::ReadBig(in); zeus::CVector3f scaleCenter = zeus::CVector3f::ReadBig(in); std::shared_ptr ret = std::make_shared(parms, dim, scaleCenter); ret->ParseBaseInfo(frame, in, parms); return ret; } } // namespace metaforce