Prepare Font double buffer
This commit is contained in:
parent
f374642909
commit
386761a795
|
@ -1,10 +1,27 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <PSX/File/file_types.hpp>
|
#include <PSX/File/file_types.hpp>
|
||||||
|
#include <PSX/GPU/gpu_primitives.hpp>
|
||||||
#include <PSX/GPU/gpu_types.hpp>
|
#include <PSX/GPU/gpu_types.hpp>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
|
using FontPrimitive = GPU::SPRT::Linked;
|
||||||
|
|
||||||
struct FontInfo {
|
struct FontInfo {
|
||||||
GPU::SizeU16 VRAMSize;
|
GPU::SizeU16 VRAMSize;
|
||||||
GPU::SizeU16 FontSize;
|
GPU::SizeU16 FontSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FontBufferInfo {
|
||||||
|
FontPrimitive* double_buffer[2];
|
||||||
|
size_t single_buffer_length;
|
||||||
|
|
||||||
|
static constexpr FontBufferInfo empty() {
|
||||||
|
return FontBufferInfo{.double_buffer = {nullptr, nullptr}, .single_buffer_length = 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
static constexpr FontBufferInfo from(FontPrimitive (&buffer)[2][N]) {
|
||||||
|
return FontBufferInfo{.double_buffer = {buffer[0], buffer[1]}, .single_buffer_length = N};
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
struct FontWriter {
|
struct FontWriter {
|
||||||
static void setup(SimpleTIM vram_dst, const FontInfo& font_info);
|
static void setup(const FontBufferInfo& buffer_info, SimpleTIM vram_dst, const FontInfo& font_info);
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -2,7 +2,24 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
void FontWriter :: setup(SimpleTIM vram_dst, const FontInfo& font_info) {
|
struct DoubleBuffer {
|
||||||
|
// Hooks?
|
||||||
|
FontBufferInfo prim_buffer;
|
||||||
|
|
||||||
|
static constexpr DoubleBuffer empty() {
|
||||||
|
return DoubleBuffer{.prim_buffer = FontBufferInfo::empty()};
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(const FontBufferInfo& buffer_info) {
|
||||||
|
this->prim_buffer = buffer_info;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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");
|
printf("Hello Planschi c:\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,12 +13,13 @@ using namespace JabyEngine;
|
||||||
using NewFontWriter = ::JabyEngine::FontWriter;
|
using NewFontWriter = ::JabyEngine::FontWriter;
|
||||||
|
|
||||||
static object::Paco paco;
|
static object::Paco paco;
|
||||||
|
static FontPrimitive font_buffer[2][256];
|
||||||
|
|
||||||
static void setup() {
|
static void setup() {
|
||||||
static constexpr auto FontTIM = SimpleTIM(320, 0, 320, DefaultFont::Info.VRAMSize.height);
|
static constexpr auto FontTIM = SimpleTIM(320, 0, 320, DefaultFont::Info.VRAMSize.height);
|
||||||
|
|
||||||
DefaultFont::load(&__heap_start, FontTIM);
|
DefaultFont::load(&__heap_start, FontTIM);
|
||||||
NewFontWriter::setup(FontTIM, DefaultFont::Info);
|
NewFontWriter::setup(FontBufferInfo::from(font_buffer), FontTIM, DefaultFont::Info);
|
||||||
|
|
||||||
Assets::load_for_main();
|
Assets::load_for_main();
|
||||||
FontWriter::FontWriter::setup();
|
FontWriter::FontWriter::setup();
|
||||||
|
|
Loading…
Reference in New Issue