mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
feat(ui): add CGWorldFrame::OnFrameSizeChanged
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
This commit is contained in:
parent
7682dba2c9
commit
e5cc9de486
@ -1,6 +1,8 @@
|
|||||||
#include "ui/game/CGWorldFrame.hpp"
|
#include "ui/game/CGWorldFrame.hpp"
|
||||||
|
#include "gx/Coordinate.hpp"
|
||||||
#include "gx/Shader.hpp"
|
#include "gx/Shader.hpp"
|
||||||
#include "gx/Transform.hpp"
|
#include "gx/Transform.hpp"
|
||||||
|
#include "ui/game/CGCamera.hpp"
|
||||||
#include "ui/game/PlayerName.hpp"
|
#include "ui/game/PlayerName.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
@ -46,6 +48,10 @@ CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
|||||||
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
|
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
this->m_camera = STORM_NEW(CGCamera);
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
||||||
@ -56,6 +62,29 @@ void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGWorldFrame::OnFrameSizeChanged(const CRect& rect) {
|
||||||
|
this->CSimpleFrame::OnFrameSizeChanged(rect);
|
||||||
|
|
||||||
|
// Screen rect (DDC)
|
||||||
|
this->m_screenRect.minX = std::max(this->m_rect.minX, 0.0f);
|
||||||
|
this->m_screenRect.minY = std::max(this->m_rect.minY, 0.0f);
|
||||||
|
this->m_screenRect.maxX = std::min(this->m_rect.maxX, NDCToDDCWidth(1.0f));
|
||||||
|
this->m_screenRect.maxY = std::min(this->m_rect.maxY, NDCToDDCHeight(1.0f));
|
||||||
|
|
||||||
|
// Camera aspect ratio
|
||||||
|
if (this->m_camera) {
|
||||||
|
this->m_camera->SetScreenAspect(this->m_screenRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Viewport (NDC)
|
||||||
|
DDCToNDC(this->m_rect.minX, this->m_rect.minY, &this->m_viewport.minX, &this->m_viewport.minY);
|
||||||
|
DDCToNDC(this->m_rect.maxX, this->m_rect.maxY, &this->m_viewport.maxX, &this->m_viewport.maxY);
|
||||||
|
this->m_viewport.minX = std::max(this->m_viewport.minX, 0.0f);
|
||||||
|
this->m_viewport.minY = std::max(this->m_viewport.minY, 0.0f);
|
||||||
|
this->m_viewport.maxX = std::min(this->m_viewport.maxX, 1.0f);
|
||||||
|
this->m_viewport.maxY = std::min(this->m_viewport.maxY, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
void CGWorldFrame::OnWorldRender() {
|
void CGWorldFrame::OnWorldRender() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include "ui/simple/CSimpleFrame.hpp"
|
#include "ui/simple/CSimpleFrame.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
class CGCamera;
|
||||||
|
|
||||||
class CGWorldFrame : public CSimpleFrame {
|
class CGWorldFrame : public CSimpleFrame {
|
||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
@ -15,11 +17,22 @@ class CGWorldFrame : public CSimpleFrame {
|
|||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
||||||
|
// TODO
|
||||||
|
virtual void OnFrameSizeChanged(const CRect& rect);
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
CGWorldFrame(CSimpleFrame* parent);
|
CGWorldFrame(CSimpleFrame* parent);
|
||||||
void OnWorldRender();
|
void OnWorldRender();
|
||||||
void OnWorldUpdate();
|
void OnWorldUpdate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Private member variables
|
||||||
|
// TODO
|
||||||
|
CRect m_screenRect;
|
||||||
|
CRect m_viewport;
|
||||||
|
// TODO
|
||||||
|
CGCamera* m_camera;
|
||||||
|
// TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user