2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 17:47:43 +00:00

FRME bug fixes and shader adjustments

This commit is contained in:
Jack Andersen
2017-01-29 18:16:20 -10:00
parent 1fbd08b7c6
commit 83176b41a9
39 changed files with 424 additions and 179 deletions

View File

@@ -15,6 +15,7 @@
#include "CTextParser.hpp"
#include "CSimplePool.hpp"
#include "CTextExecuteBuffer.hpp"
#include "CGuiFrame.hpp"
namespace urde
{
@@ -68,4 +69,30 @@ CGuiSys::CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode)
g_TextParser = x10_textParser.get();
}
void CGuiSys::OnViewportResize()
{
for (CGuiFrame* frame : m_registeredFrames)
ViewportResizeFrame(frame);
}
void CGuiSys::ViewportResizeFrame(CGuiFrame* frame)
{
float vpAspectRatio = CGraphics::g_ViewportResolution.x / float(CGraphics::g_ViewportResolution.y);
if (frame->m_aspectConstraint > 0.f)
{
float hPad, vPad;
if (vpAspectRatio >= frame->m_aspectConstraint)
{
hPad = frame->m_aspectConstraint / vpAspectRatio;
vPad = frame->m_aspectConstraint / 1.36f;
}
else
{
hPad = 1.f;
vPad = vpAspectRatio / 1.36f;
}
frame->m_aspectTransform = zeus::CTransform::Scale({hPad, 1.f, vPad});
}
}
}