3ds: move ui7 to bottom screne
This commit is contained in:
@@ -21,6 +21,8 @@ class OsCtx {
|
|||||||
virtual bool Mainloop() { return false; }
|
virtual bool Mainloop() { return false; }
|
||||||
virtual void ClearViewPort() {}
|
virtual void ClearViewPort() {}
|
||||||
virtual void SwapBuffers() {}
|
virtual void SwapBuffers() {}
|
||||||
|
virtual int GetScreenCount() { return 1; }
|
||||||
|
virtual void DrawOnScreen(int s = 0) {}
|
||||||
PD::fvec2 PositionTranslate(PD::fvec2 in) {
|
PD::fvec2 PositionTranslate(PD::fvec2 in) {
|
||||||
return fvec2(in.x * pViewPort.x, in.y * pViewPort.y);
|
return fvec2(in.x * pViewPort.x, in.y * pViewPort.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ class HorizonCtr : public PD::OsCtx {
|
|||||||
bool Mainloop() override;
|
bool Mainloop() override;
|
||||||
void ClearViewPort() override;
|
void ClearViewPort() override;
|
||||||
void SwapBuffers() override;
|
void SwapBuffers() override;
|
||||||
|
int GetScreenCount() override { return 2; }
|
||||||
|
void DrawOnScreen(int s) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
|
|||||||
@@ -208,11 +208,17 @@ int main(int argc, char** argv) {
|
|||||||
RightStick.pColor = "#00ffff";
|
RightStick.pColor = "#00ffff";
|
||||||
PD::UI7::Context ui7;
|
PD::UI7::Context ui7;
|
||||||
ui7.GetIO().Font = &font;
|
ui7.GetIO().Font = &font;
|
||||||
|
#ifdef __3DS__
|
||||||
|
ui7.AddViewPort("Default", PD::ivec4(0, 0, 320, 240));
|
||||||
|
ui7.GetIO().FontScale = 0.5f;
|
||||||
|
#else
|
||||||
ui7.AddViewPort("Default", PD::ivec4(0, 0, 1280, 720));
|
ui7.AddViewPort("Default", PD::ivec4(0, 0, 1280, 720));
|
||||||
|
#endif
|
||||||
ui7.UseViewPort("Default");
|
ui7.UseViewPort("Default");
|
||||||
bool pMetricsWin = true;
|
bool pMetricsWin = true;
|
||||||
while (pOs->Mainloop()) {
|
while (pOs->Mainloop()) {
|
||||||
PD::TT::End("OSCTX::MainLoop");
|
PD::TT::End("OSCTX::MainLoop");
|
||||||
|
pOs->DrawOnScreen(0);
|
||||||
pOs->ClearViewPort();
|
pOs->ClearViewPort();
|
||||||
PD::TT::Scope __st("MainLoop");
|
PD::TT::Scope __st("MainLoop");
|
||||||
PD::TT::Beg("MainRaw");
|
PD::TT::Beg("MainRaw");
|
||||||
@@ -324,7 +330,10 @@ int main(int argc, char** argv) {
|
|||||||
PD::TT::End("UI7::Context::Update");
|
PD::TT::End("UI7::Context::Update");
|
||||||
PD::Gfx::Reset();
|
PD::Gfx::Reset();
|
||||||
PD::TT::Beg("PD::Gfx::Draw");
|
PD::TT::Beg("PD::Gfx::Draw");
|
||||||
|
pOs->DrawOnScreen(1);
|
||||||
|
pOs->ClearViewPort();
|
||||||
PD::Gfx::Draw(ui7.GetDrawData());
|
PD::Gfx::Draw(ui7.GetDrawData());
|
||||||
|
pOs->DrawOnScreen(0);
|
||||||
PD::Gfx::Draw(pList);
|
PD::Gfx::Draw(pList);
|
||||||
PD::TT::End("PD::Gfx::Draw");
|
PD::TT::End("PD::Gfx::Draw");
|
||||||
pList.Clear();
|
pList.Clear();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ struct HorizonCtr::Impl {
|
|||||||
C3D_RenderTarget* Top = nullptr;
|
C3D_RenderTarget* Top = nullptr;
|
||||||
C3D_RenderTarget* Bottom = nullptr;
|
C3D_RenderTarget* Bottom = nullptr;
|
||||||
uint32_t* pSocBuf = nullptr;
|
uint32_t* pSocBuf = nullptr;
|
||||||
|
int CurrentScreen = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void HorizonCtr::Init() {
|
void HorizonCtr::Init() {
|
||||||
@@ -63,13 +64,25 @@ bool HorizonCtr::Mainloop() {
|
|||||||
pViewPort = ivec2(400, 240);
|
pViewPort = ivec2(400, 240);
|
||||||
bool _kill = hidKeysUp() & KEY_START;
|
bool _kill = hidKeysUp() & KEY_START;
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
|
impl->CurrentScreen = 0;
|
||||||
return aptMainLoop() && !_kill;
|
return aptMainLoop() && !_kill;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizonCtr::ClearViewPort() {
|
void HorizonCtr::ClearViewPort() {
|
||||||
|
C3D_RenderTargetClear(impl->CurrentScreen ? impl->Bottom : impl->Top,
|
||||||
|
C3D_CLEAR_ALL, PD::Color(25, 25, 25, 25), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HorizonCtr::DrawOnScreen(int s) {
|
||||||
|
impl->CurrentScreen = s;
|
||||||
|
if (s == 0) {
|
||||||
|
C3D_FrameDrawOn(impl->Top);
|
||||||
|
pViewPort = PD::ivec2(400, 240);
|
||||||
|
} else if (s == 1) {
|
||||||
|
C3D_FrameDrawOn(impl->Bottom);
|
||||||
|
pViewPort = PD::ivec2(320, 240);
|
||||||
|
}
|
||||||
PD::Gfx::SetViewPort(pViewPort);
|
PD::Gfx::SetViewPort(pViewPort);
|
||||||
C3D_FrameDrawOn(impl->Top);
|
|
||||||
C3D_RenderTargetClear(impl->Top, C3D_CLEAR_ALL, PD::Color(25, 25, 25, 25), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizonCtr::SwapBuffers() { C3D_FrameEnd(0); }
|
void HorizonCtr::SwapBuffers() { C3D_FrameEnd(0); }
|
||||||
|
|||||||
Reference in New Issue
Block a user