Rename Support to lower-case to match rest
This commit is contained in:
41
support/src/FontWriter/Makefile
Normal file
41
support/src/FontWriter/Makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
JABY_ENGINE_DIR = ../../..
|
||||
include $(JABY_ENGINE_DIR)/mkfile/RebuildTarget.mk
|
||||
|
||||
ARTIFACT = libFontWriter
|
||||
BUILD_DIR = bin
|
||||
|
||||
DEFAULT_FONT_IMAGE = src/default_font_data.hpp
|
||||
|
||||
CCFLAGS += -I../../include -I$(JABY_ENGINE_DIR)/include
|
||||
CCFLAGS += -save-temps=obj
|
||||
|
||||
include $(JABY_ENGINE_DIR)/mkfile/Wildcard.mk
|
||||
SRCS = $(call rwildcard, src, c cpp s)
|
||||
|
||||
include $(JABY_ENGINE_DIR)/mkfile/Makefile
|
||||
LIB_DIR = ../../lib/$(CONFIG_NAME)
|
||||
|
||||
LIB_OBJS = $(filter-out $(MAIN_BOOT_OBJ) $(OVERLAY_BOOT_OBJ),$(OBJS))
|
||||
|
||||
#$(info $$var is [${MAIN_BOOT_OBJ}])
|
||||
#$(info $$var2 is [${LIB_OBJS}])
|
||||
|
||||
$(DEFAULT_FONT_IMAGE): ressources/DefaultFont.png
|
||||
jaby_engine_fconv --lz4 $< simple-tim clut4 | cpp_out --name default_font_data -o $@
|
||||
|
||||
#Linking rule
|
||||
$(TARGET).a: $(LIB_OBJS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(AR) rcs $(TARGET).a $(LIB_OBJS)
|
||||
|
||||
#Copy rules
|
||||
$(LIB_DIR)/$(ARTIFACT).a: $(TARGET).a
|
||||
@mkdir -p $(LIB_DIR)
|
||||
cp $(TARGET).a $(LIB_DIR)/$(ARTIFACT).a
|
||||
|
||||
#Rules section for default compilation and linking
|
||||
all: $(DEFAULT_FONT_IMAGE) $(LIB_DIR)/$(ARTIFACT).a
|
||||
|
||||
clean:
|
||||
rm -fr $(OUTPUT_DIR)
|
||||
rm -fr $(LIB_DIR)/$(ARTIFACT).a
|
||||
BIN
support/src/FontWriter/ressources/DefaultFont.png
(Stored with Git LFS)
Normal file
BIN
support/src/FontWriter/ressources/DefaultFont.png
(Stored with Git LFS)
Normal file
Binary file not shown.
24
support/src/FontWriter/src/default_font.cpp
Normal file
24
support/src/FontWriter/src/default_font.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "default_font_data.hpp"
|
||||
#include <FontWriter/default_font.hpp>
|
||||
#include <PSX/File/Processor/file_processor.hpp>
|
||||
#include <PSX/Auxiliary/lz4_decompressor.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
static size_t decompress_font(uint32_t* work_area) {
|
||||
LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(work_area));
|
||||
|
||||
const auto [progress, bytes_ready] = lz4_decomp.process(ArrayRange(default_font_data, sizeof(default_font_data)), true);
|
||||
if(progress == Progress::Error) {
|
||||
return 0;
|
||||
}
|
||||
return bytes_ready;
|
||||
}
|
||||
|
||||
void DefaultFont :: load(uint32_t* work_area, SimpleTIM vram_dst) {
|
||||
const auto bytes_ready = decompress_font(work_area);
|
||||
|
||||
auto processor = FileProcessor::create(work_area, vram_dst);
|
||||
processor.process(bytes_ready);
|
||||
}
|
||||
}
|
||||
57
support/src/FontWriter/src/font_writer.cpp
Normal file
57
support/src/FontWriter/src/font_writer.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include <PSX/GPU/gpu.hpp>
|
||||
#include <PSX/GPU/gpu_primitives.hpp>
|
||||
#include <FontWriter/font_writer.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <PSX/Auxiliary/mem_dump.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
struct DoubleBuffer {
|
||||
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{.tex_page = {0}, .cur_sprt_ptr = nullptr, .prim_buffer = FontBufferInfo::empty()};
|
||||
}
|
||||
|
||||
void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const GPU::SizeI16& font_size) {
|
||||
this->tex_page = Make::TexPage(vram_dst.get_texture_position(), GPU::TexturePageColor::$4bit).linked();
|
||||
this->prim_buffer = buffer_info;
|
||||
|
||||
this->planschi = Make::SPRT_16(
|
||||
Make::PositionI16(0, 0),
|
||||
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(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] = Make::SPRT(
|
||||
Make::AreaI16(Make::PositionI16(0, 0), font_size),
|
||||
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(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, 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, Make::SizeI16(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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user