Remove ctru / Add pre font work

This commit is contained in:
2025-12-05 19:33:58 +01:00
parent d136e6ac5e
commit c18ef2161a
8 changed files with 109 additions and 39 deletions

View File

@@ -3,7 +3,6 @@
#include <amethyst/app.hpp>
#include <amethyst/assets.hpp>
#include <amethyst/c3d.hpp>
#include <amethyst/ctru.hpp>
#include <amethyst/image.hpp>
#include <amethyst/iron.hpp>
#include <amethyst/renderer.hpp>
@@ -14,5 +13,4 @@ void RegisterCxxExceptionHandler();
}
using Iron = Amy::Iron;
namespace Ctr = Amy::Ctr;
using C3D = Amy::C3D;

View File

@@ -1,17 +0,0 @@
#pragma once
#include <amethyst/types.hpp>
namespace Amy {
namespace Ctr {
enum Services {
Romfs = 1 << 0,
Cfgu = 1 << 1,
Gfx = 1 << 2,
GfxDefault = 1 << 3,
Default = Romfs | GfxDefault,
};
void Init(ui srv = Default);
ull GetTime();
} // namespace Ctr
} // namespace Amy

View File

@@ -52,6 +52,36 @@ class Iron {
int Index = 0;
Texture* Tex = nullptr;
};
class Font {
public:
struct Codepoint {
ui Cp = 0;
fvec4 Uv;
Texture* Tex;
fvec2 Size;
float Offset = 0; // Unused??
bool Valid = true;
};
Font() = default;
~Font() = default;
void LoadTTF(ksr path, int pxh = 32);
void LoadTTF(kvr<uc> data, int pxh = 32);
Codepoint& GetCodepoint(ui c);
fvec2 GetTextBounds(ksr text, float scale);
void CmdTextEx(vec<Command::ref>& cmds, const fvec2& pos, ui color,
float scale, ksr text, ui flags = 0, const fvec2& box = 0);
void pMakeAtlas(bool final, vec<uc>& pixels, int size, Texture* tex);
int PxHeight;
int PxFactor = 24;
vec<Texture*> Textures;
};
class Drawlist {
public:
Drawlist() { DrawSolid(); }