Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
8 changed files with 66 additions and 14 deletions
Showing only changes of commit a7096ac92c - Show all commits

View File

@ -1,5 +1,8 @@
#include "../include/asset_mgr.hpp"
#include "include/font_writer.hpp"
#include "include/paco.hpp"
#include <FontWriter/fonts.hpp>
#include <FontWriter/font_writer.hpp>
#include <stdio.h>
using namespace JabyEngine;
@ -10,14 +13,22 @@ static object::Paco paco;
static void setup() {
Assets::Main::load();
FontWriter::setup();
paco.setup();
}
static void update() {
static const char Title[] = "Pool Box";
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.font_size.width;
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16));
paco.update();
FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Yellow(), &FontWriter::wiggle);
}
static void render() {
FontWriter::new_font_writer.render();
paco.render();
}

View File

@ -0,0 +1,35 @@
#include "include/font_writer.hpp"
#include <FontWriter/fonts.hpp>
#include <PSX/File/Processor/cd_file_processor.hpp> //< only for __heap_start D:
#include <PSX/Timer/frame_timer.hpp>
namespace FontWriter {
using namespace JabyEngine;
static constexpr auto LibraryFontTIM = SimpleTIM(320, 0, 320, DefaultFont::Info.texture_size.height);
static FontPrimitive font_buffer[2*256];
Wiggle wiggle = {Make::PositionI8(0, 0), Make::PositionI8(1, -2), Make::PositionI8(0, -4), Make::PositionI8(-1, -2), Make::PositionI8(0, 0), Make::PositionI8(1, 2), Make::PositionI8(0, 4), Make::PositionI8(-1, 2)};
JabyEngine::FontWriter new_font_writer = JabyEngine::FontWriter::empty();
JabyEngine::FontWriter bios_font_writer = JabyEngine::FontWriter::empty();
static SimpleTimer<uint8_t> timer;
uint8_t wiggle_count = 0;
void setup() {
JabyEngine::DefaultFont::load(&__heap_start, LibraryFontTIM);
JabyEngine::GlobalFontPrimitivePool::setup(font_buffer);
new_font_writer.setup(LibraryFontTIM, JabyEngine::DefaultFont::Info);
bios_font_writer.setup(JabyEngine::BIOSFont::TIM, JabyEngine::BIOSFont::Info);
timer.reset();
}
State update(const GPU::PositionI16& start) {
if(timer.is_expired_for(50_ms)) {
timer.reset();
wiggle_count++;
}
return State::create(start, wiggle_count);
}
}

View File

@ -0,0 +1,14 @@
#pragma once
#include <FontWriter/Type/types.hpp>
#include <FontWriter/font_writer.hpp>
namespace FontWriter {
using namespace JabyEngine;
extern Wiggle wiggle;
extern JabyEngine::FontWriter new_font_writer;
extern JabyEngine::FontWriter bios_font_writer;
void setup();
State update(const GPU::PositionI16& start);
}

View File

@ -8,6 +8,7 @@ namespace object {
class Paco {
private:
static constexpr auto Size = Make::SizeI16(120, 128);
static const GPU::Color24 Colors[];
GPU::TexPage::Linked tex_page;
@ -21,7 +22,7 @@ namespace object {
Assets::Main::PacoTIM.get_texture_x(), Assets::Main::PacoTIM.get_texture_y()),
GPU::TexturePageColor::$4bit).linked()),
sprite(Make::SPRT(
Make::AreaI16(Make::PositionI16(0, 100), Make::SizeI16(120, 128)),
Make::AreaI16(Make::PositionI16(GPU::Display::Width - Size.width, GPU::Display::Height - Size.height), Size),
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(Assets::Main::PacoTIM.get_clut_x(), Assets::Main::PacoTIM.get_clut_y())),
GPU::Color24::Blue()).linked()),
timer(),

View File

@ -4,15 +4,6 @@ namespace object {
const GPU::Color24 Paco :: Colors[] = {GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Blue(), GPU::Color24::Yellow()};
void Paco :: setup() {
/*this->tex_page = Make::TexPage(Make::PositionU16(
Assets::Main::PacoTIM.get_texture_x(), Assets::Main::PacoTIM.get_texture_y()),
GPU::TexturePageColor::$4bit).linked();
this->sprite = Make::SPRT(
Make::AreaI16(Make::PositionI16(0, 100), Make::SizeI16(120, 128)),
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(Assets::Main::PacoTIM.get_clut_x(), Assets::Main::PacoTIM.get_clut_y())),
GPU::Color24::Blue()).linked();*/
this->timer.reset();
this->tex_page.concat(this->sprite);
}

View File

@ -40,10 +40,10 @@ namespace JabyEngine {
void write(State& state, const char* str, GPU::Color24 color, ...) {
__write_impl(color, color, nullptr);
}
void write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle, ...) {
void write(State& state, const char* str, GPU::Color24 color, const Wiggle* wiggle, ...) {
__write_impl(wiggle, color, wiggle);
}
void write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle, va_list list);
void write(State& state, const char* str, GPU::Color24 color, const Wiggle* wiggle, va_list list);
void render();
#undef __write_impl

View File

@ -21,7 +21,7 @@ LIB_OBJS = $(filter-out $(MAIN_BOOT_OBJ) $(OVERLAY_BOOT_OBJ),$(OBJS))
#$(info $$var2 is [${LIB_OBJS}])
$(DEFAULT_FONT_IMAGE): ressources/DefaultFont.png
jaby_engine_fconv --lz4 $< simple-tim clut4 --color-trans | cpp_out --name default_font_data -o $@
jaby_engine_fconv --lz4 $< simple-tim clut4 --semi-trans --color-trans | cpp_out --name default_font_data -o $@
#Linking rule
$(TARGET).a: $(LIB_OBJS)

View File

@ -63,7 +63,7 @@ namespace JabyEngine {
this->last_primitive = nullptr;
}
void FontWriter :: write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle, va_list list) {
void FontWriter :: write(State& state, const char* str, GPU::Color24 color, const Wiggle* wiggle, va_list list) {
static const auto exchang_str = [](const char* str, const char* new_str) -> pair<const char*, const char*> {
return {str + 1, new_str};
};