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

Bug fixes and CAutoMapper mouse events

This commit is contained in:
Jack Andersen
2019-01-22 21:52:19 -10:00
parent aeb6a9a147
commit 137968ecc7
38 changed files with 275 additions and 118 deletions

View File

@@ -74,20 +74,19 @@ void CGuiSys::OnViewportResize() {
}
void CGuiSys::ViewportResizeFrame(CGuiFrame* frame) {
float vpAspectRatio = g_Viewport.x8_width / float(g_Viewport.xc_height);
if (frame->m_aspectConstraint > 0.f) {
float hPad, vPad;
if (vpAspectRatio >= frame->m_aspectConstraint) {
hPad = frame->m_aspectConstraint / vpAspectRatio;
if (g_Viewport.aspect >= frame->m_aspectConstraint) {
hPad = frame->m_aspectConstraint / g_Viewport.aspect;
vPad = frame->m_aspectConstraint / 1.38f;
} else {
hPad = 1.f;
vPad = vpAspectRatio / 1.38f;
vPad = g_Viewport.aspect / 1.38f;
}
frame->m_aspectTransform = zeus::CTransform::Scale({hPad, 1.f, vPad});
} else if (frame->m_maxAspect > 0.f) {
if (vpAspectRatio > frame->m_maxAspect)
frame->m_aspectTransform = zeus::CTransform::Scale({frame->m_maxAspect / vpAspectRatio, 1.f, 1.f});
if (g_Viewport.aspect > frame->m_maxAspect)
frame->m_aspectTransform = zeus::CTransform::Scale({frame->m_maxAspect / g_Viewport.aspect, 1.f, 1.f});
else
frame->m_aspectTransform = zeus::CTransform::Identity();
}