Rename Support to lower-case to match rest
This commit is contained in:
27
support/include/FontWriter/Type/types.hpp
Normal file
27
support/include/FontWriter/Type/types.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <PSX/File/file_types.hpp>
|
||||
#include <PSX/GPU/gpu_primitives.hpp>
|
||||
#include <PSX/GPU/gpu_types.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
using FontPrimitive = GPU::SPRT::Linked;
|
||||
|
||||
struct FontInfo {
|
||||
GPU::SizeU16 VRAMSize;
|
||||
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};
|
||||
}
|
||||
};
|
||||
}
|
13
support/include/FontWriter/default_font.hpp
Normal file
13
support/include/FontWriter/default_font.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
struct DefaultFont {
|
||||
static constexpr auto Info = FontInfo {
|
||||
.VRAMSize = {64, 80},
|
||||
.FontSize = {12, 16}
|
||||
};
|
||||
|
||||
static void load(uint32_t* work_area, SimpleTIM vram_dst);
|
||||
};
|
||||
}
|
9
support/include/FontWriter/font_writer.hpp
Normal file
9
support/include/FontWriter/font_writer.hpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
struct FontWriter {
|
||||
static void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const FontInfo& font_info);
|
||||
static void render();
|
||||
};
|
||||
}
|
1
support/src/.gitignore
vendored
Normal file
1
support/src/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
FontWriter/src/default_font_data.hpp
|
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);
|
||||
}
|
||||
}
|
6
support/src/Makefile
Normal file
6
support/src/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
FontWriter: always
|
||||
$(MAKE) -C $(JABY_ENGINE_DIR)/Support/src/FontWriter $(MAKECMDGOALS)
|
||||
|
||||
all: FontWriter
|
||||
|
||||
always: ;
|
75
support/src/SupportLibrary.code-workspace
Normal file
75
support/src/SupportLibrary.code-workspace
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"name": "Support",
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"name": "Support Include",
|
||||
"path": "../include"
|
||||
},
|
||||
{
|
||||
"name": "Support Library",
|
||||
"path": "../lib"
|
||||
},
|
||||
],
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "make",
|
||||
"type": "shell",
|
||||
"windows": {
|
||||
"command": "wsl make ${input:target} BUILD_PROFILE=${input:build cfg}",
|
||||
},
|
||||
"linux": {
|
||||
"command": "make ${input:target} BUILD_PROFILE=${input:build cfg}",
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/FontWriter"
|
||||
},
|
||||
"group": "build"
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "build cfg",
|
||||
"type": "pickString",
|
||||
"options": ["debug", "release"],
|
||||
"default": "release",
|
||||
"description": "build configuration"
|
||||
},
|
||||
{
|
||||
"id": "target",
|
||||
"type": "pickString",
|
||||
"options": ["all", "clean", "rebuild"],
|
||||
"default": "all",
|
||||
"description": "build target",
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.default.includePath": [
|
||||
"../include",
|
||||
"../../include"
|
||||
],
|
||||
"C_Cpp.default.compilerPath": "",
|
||||
"C_Cpp.default.cStandard": "c17",
|
||||
"C_Cpp.default.cppStandard": "c++20",
|
||||
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
|
||||
"C_Cpp.default.compilerArgs": [
|
||||
],
|
||||
"C_Cpp.default.defines": [
|
||||
"JABYENGINE_PAL",
|
||||
"__friends=public"
|
||||
],
|
||||
"files.exclude": {
|
||||
"**/*.o": true,
|
||||
"**/*.dep": true
|
||||
},
|
||||
"files.associations": {
|
||||
"stdio.h": "c"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user