2025-11-19 22:20:27 +01:00
|
|
|
#include <amethyst.hpp>
|
2025-12-01 22:10:18 +01:00
|
|
|
#include <iostream>
|
2025-11-19 22:20:27 +01:00
|
|
|
|
2025-11-30 21:57:01 +01:00
|
|
|
class Example : public Amy::App {
|
2025-12-01 22:10:18 +01:00
|
|
|
public:
|
2025-11-30 21:57:01 +01:00
|
|
|
Example() {
|
2025-12-08 18:37:12 +01:00
|
|
|
Amy::GTrace::Scope s("Init");
|
2025-12-05 19:33:58 +01:00
|
|
|
gfxInitDefault();
|
|
|
|
|
romfsInit();
|
2025-12-01 22:39:39 +01:00
|
|
|
C3D::Init();
|
|
|
|
|
Top = C3D::CreateScreen(GFX_TOP);
|
2025-12-01 22:10:18 +01:00
|
|
|
Mgr = new Amy::AssetMgr();
|
2025-12-01 22:39:39 +01:00
|
|
|
Iron::Init();
|
2025-12-08 18:37:12 +01:00
|
|
|
Mgr->AutoLoad("icon", "romfs:/icon.png");
|
|
|
|
|
Mgr->AutoLoad("font", "romfs:/ComicNeue.ttf");
|
2025-12-01 22:39:39 +01:00
|
|
|
dl = new Iron::Drawlist();
|
2025-12-08 18:37:12 +01:00
|
|
|
dl->SetFont(Mgr->Get<Iron::Font>("font"));
|
2025-12-01 22:10:18 +01:00
|
|
|
}
|
2025-12-07 23:20:15 +01:00
|
|
|
|
2025-12-01 22:10:18 +01:00
|
|
|
~Example() {
|
|
|
|
|
delete Top;
|
|
|
|
|
delete dl;
|
|
|
|
|
delete Mgr;
|
2025-12-01 22:39:39 +01:00
|
|
|
Iron::Exit();
|
|
|
|
|
C3D::Deinit();
|
2025-12-05 19:33:58 +01:00
|
|
|
romfsExit();
|
|
|
|
|
gfxExit();
|
2025-11-30 21:57:01 +01:00
|
|
|
}
|
2025-11-27 13:32:44 +01:00
|
|
|
|
2025-11-30 21:57:01 +01:00
|
|
|
void Main() {
|
2025-12-01 22:39:39 +01:00
|
|
|
hidScanInput();
|
|
|
|
|
if (hidKeysDown() & KEY_START) {
|
|
|
|
|
Exit();
|
|
|
|
|
}
|
2025-12-08 18:37:12 +01:00
|
|
|
std::string stats = std::format(
|
|
|
|
|
"Delta: {:.3} -> {:.3} FPS\nTime: {}\nLinearRam: {}\nVIT: "
|
|
|
|
|
"[{}/{}/{}]\nAssets: {}\nMain: {}",
|
|
|
|
|
this->Delta(), 1000.0 / this->Delta(),
|
|
|
|
|
Amy::Utils::FormatMillis(this->Time() * 1000.f),
|
|
|
|
|
Amy::Utils::FormatBytes(linearSpaceFree()), Amy::Iron::VerticesDrawn(),
|
|
|
|
|
Amy::Iron::IndicesDrawn(), Amy::Iron::IndicesDrawn() / 3,
|
|
|
|
|
Mgr->CountAll(),
|
|
|
|
|
Amy::Utils::FormatNanos(
|
|
|
|
|
Amy::GTrace::GetTraceRef("Main")->GetLastDiff()));
|
2025-12-01 22:39:39 +01:00
|
|
|
C3D::StartFrame();
|
2025-12-08 18:37:12 +01:00
|
|
|
Amy::GTrace::Beg("Main");
|
2025-11-30 21:57:01 +01:00
|
|
|
Top->Clear();
|
|
|
|
|
Top->Use();
|
2025-12-01 22:10:18 +01:00
|
|
|
dl->DrawTex(Mgr->Get<Amy::Texture>("icon"));
|
2025-12-07 18:08:36 +01:00
|
|
|
dl->DrawRectFilled(Amy::fvec2(50, 0), 48, Amy::Color(255, 255, 255, 160));
|
|
|
|
|
// Color only at runtime...yet (Palladium 0.6.0 dev is targeting this)
|
|
|
|
|
dl->DrawCircleFilled(Amy::fvec2(200, 120), 50, Amy::Color("#ffffff"), 40);
|
2025-12-01 22:10:18 +01:00
|
|
|
dl->DrawSolid();
|
2025-12-07 18:08:36 +01:00
|
|
|
dl->DrawRectFilled(0, 50, Amy::Color(0.f, 1.f, 0.f, 1.f));
|
2025-12-08 18:37:12 +01:00
|
|
|
dl->DrawText(Amy::fvec2(5, 50), stats, Amy::Color(255, 0, 255));
|
2025-12-01 22:10:18 +01:00
|
|
|
|
2025-12-01 22:39:39 +01:00
|
|
|
Iron::NewFrame();
|
|
|
|
|
Iron::DrawOn(Top);
|
|
|
|
|
Iron::Draw(*dl);
|
2025-12-01 22:10:18 +01:00
|
|
|
dl->Clear();
|
2025-12-01 22:39:39 +01:00
|
|
|
C3D::EndFrame();
|
2025-12-08 18:37:12 +01:00
|
|
|
Amy::GTrace::End("Main");
|
2025-11-19 22:20:27 +01:00
|
|
|
}
|
2025-11-24 10:02:22 +01:00
|
|
|
|
2025-12-01 22:39:39 +01:00
|
|
|
C3D::Screen* Top;
|
2025-12-01 22:10:18 +01:00
|
|
|
Amy::AssetMgr* Mgr;
|
2025-12-01 22:39:39 +01:00
|
|
|
Iron::Drawlist* dl;
|
2025-11-24 10:02:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int main() {
|
2025-12-01 22:10:18 +01:00
|
|
|
Amy::RegisterCxxExceptionHandler();
|
2025-11-30 21:57:01 +01:00
|
|
|
Example App;
|
|
|
|
|
App.Run();
|
2025-11-19 22:20:27 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|