jabyengine/examples/PoolBox/application/src/FontWriter/font_writer.hpp

51 lines
1.2 KiB
C++

#ifndef __FONT_WRITER_HPP__
#define __FONT_WRITER_HPP__
#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);
};
}
#endif //!__FONT_WRITER_HPP__