Start refactor of FontWriter
This commit is contained in:
@@ -1,17 +1,51 @@
|
||||
#ifndef __FONT_WRITER_HPP__
|
||||
#define __FONT_WRITER_HPP__
|
||||
#include <PSX/GPU/gpu_types.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;
|
||||
|
||||
static constexpr auto TextBufferSize = 1024;
|
||||
class FontWriter {
|
||||
private:
|
||||
class Pool {
|
||||
private:
|
||||
struct Buffer {
|
||||
static constexpr auto BufferSize = 1024;
|
||||
|
||||
void setup();
|
||||
GPU::TexPage::Linked page;
|
||||
GPU::SPRT_16::Linked text_buffer[BufferSize];
|
||||
|
||||
Position write(Position pos, const char* text);
|
||||
void render();
|
||||
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__
|
||||
Reference in New Issue
Block a user