Sketch setup of Font
This commit is contained in:
parent
e101657ed7
commit
d897cfe52b
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace JabyEngine {
|
||||
struct FontWriter {
|
||||
static void setup(const FontBufferInfo& buffer_info, SimpleTIM vram_dst, const FontInfo& font_info);
|
||||
static void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const FontInfo& font_info);
|
||||
static void render();
|
||||
};
|
||||
}
|
|
@ -1,25 +1,56 @@
|
|||
#include <PSX/GPU/gpu.hpp>
|
||||
#include <FontWriter/font_writer.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <PSX/Auxiliary/mem_dump.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
struct DoubleBuffer {
|
||||
// Hooks?
|
||||
FontBufferInfo prim_buffer;
|
||||
GPU::TexPage::Linked tex_page;
|
||||
GPU::SPRT::Linked* cur_sprt_ptr;
|
||||
FontBufferInfo prim_buffer;
|
||||
|
||||
GPU::SPRT_16::Linked planschi;
|
||||
|
||||
static constexpr DoubleBuffer empty() {
|
||||
return DoubleBuffer{.prim_buffer = FontBufferInfo::empty()};
|
||||
return DoubleBuffer{.tex_page = {0}, .cur_sprt_ptr = nullptr, .prim_buffer = FontBufferInfo::empty()};
|
||||
}
|
||||
|
||||
void setup(const FontBufferInfo& buffer_info) {
|
||||
void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const GPU::SizeI16& font_size) {
|
||||
this->tex_page = GPU::TexPage::create(vram_dst.get_texture_position(), GPU::TexturePageColor::$4bit).linked();
|
||||
this->prim_buffer = buffer_info;
|
||||
|
||||
this->planschi = GPU::SPRT_16::create(
|
||||
GPU::PositionI16::create(0, 0),
|
||||
GPU::PagePositionClut::create(GPU::PagePosition::create(0, 0), GPU::PageClut::create(vram_dst.get_clut_position()))
|
||||
).linked();
|
||||
|
||||
for(size_t buffer_id = 0; buffer_id < 2; buffer_id++) {
|
||||
for(size_t buffer_element_id = 0; buffer_element_id < buffer_info.single_buffer_length; buffer_element_id++) {
|
||||
this->prim_buffer.double_buffer[buffer_id][buffer_element_id] = GPU::SPRT::create(
|
||||
GPU::AreaI16::create(GPU::PositionI16::create(0, 0), font_size),
|
||||
GPU::PagePositionClut::create(GPU::PagePosition::create(0, 0), GPU::PageClut::create(vram_dst.get_clut_position()))
|
||||
).linked();
|
||||
|
||||
this->prim_buffer.double_buffer[buffer_id][buffer_element_id]->set_identitiy();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static auto double_buffer = DoubleBuffer::empty();
|
||||
|
||||
void FontWriter :: setup(const FontBufferInfo& buffer_info, SimpleTIM vram_dst, const FontInfo& font_info) {
|
||||
double_buffer.setup(buffer_info);
|
||||
|
||||
printf("Hello Planschi c:\n");
|
||||
void FontWriter :: setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const FontInfo& font_info) {
|
||||
printf("Hello Planschi c: @0x%p @0x%p\n", buffer_info.double_buffer[0], buffer_info.double_buffer[1]);
|
||||
double_buffer.setup(buffer_info, vram_dst, GPU::SizeI16::create(font_info.FontSize.width, font_info.FontSize.height));
|
||||
|
||||
//TMP
|
||||
double_buffer.prim_buffer.double_buffer[0][0].terminate();
|
||||
double_buffer.tex_page.concat(double_buffer.prim_buffer.double_buffer[0][0]);
|
||||
//TMP-END
|
||||
}
|
||||
|
||||
void FontWriter :: render() {
|
||||
GPU::render(double_buffer.tex_page);
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ static void render() {
|
|||
GPU::swap_buffers_vsync(1);
|
||||
FontWriter::FontWriter::render();
|
||||
paco.render();
|
||||
NewFontWriter::render();
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -72,6 +72,10 @@ namespace JabyEngine {
|
|||
static constexpr PageClut create(uint16_t x, uint16_t y) {
|
||||
return PageClut{static_cast<uint16_t>((y << 6) | ((x >> 4) & 0x3f))};
|
||||
}
|
||||
|
||||
static constexpr PageClut create(const PositionU16& clut_pos) {
|
||||
return PageClut::create(clut_pos.x, clut_pos.y);
|
||||
}
|
||||
};
|
||||
|
||||
struct TPage {
|
||||
|
|
Loading…
Reference in New Issue