48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#pragma once
|
|
#include "../assets.hpp"
|
|
#include <PSX/GPU/gpu.hpp>
|
|
#include <stdint.h>
|
|
|
|
#pragma GCC warning "Remove this namespace and integrate to \"Objects\" folder?"
|
|
namespace FontWriter {
|
|
using namespace JabyEngine;
|
|
using Position = JabyEngine::GPU::PositionI16;
|
|
|
|
class FontWriter {
|
|
private:
|
|
class Pool {
|
|
private:
|
|
struct Buffer {
|
|
static constexpr auto BufferSize = 1024;
|
|
|
|
GPU::TexPage::Linked page;
|
|
GPU::SPRT_16::Linked text_buffer[BufferSize];
|
|
|
|
void setup();
|
|
};
|
|
|
|
static Buffer buffer[2];
|
|
static GPU::Link* last_link;
|
|
static GPU::SPRT_16::Linked* text_ptr;
|
|
|
|
static void reset_links();
|
|
|
|
public:
|
|
static void setup();
|
|
static void render();
|
|
|
|
friend class FontWriter;
|
|
};
|
|
|
|
public:
|
|
static void setup() {
|
|
Pool::setup();
|
|
}
|
|
|
|
static void render() {
|
|
Pool::render();
|
|
}
|
|
|
|
Position write(Position pos, const char* text);
|
|
};
|
|
} |