Fix inconsistent EOL
This commit is contained in:
@@ -1,59 +1,59 @@
|
||||
#pragma once
|
||||
#include <PSX/File/file_types.hpp>
|
||||
#include <PSX/GPU/gpu_types.hpp>
|
||||
#include <PSX/GPU/make_gpu_primitives.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
using FontPrimitive = GPU::SPRT::Linked;
|
||||
|
||||
struct FontInfo {
|
||||
struct RenderInfo {
|
||||
GPU::SizeU8 font_size;
|
||||
GPU::SizeU8 kern_size;
|
||||
|
||||
static constexpr RenderInfo empty() {
|
||||
return RenderInfo{.font_size = Make::SizeU8(), .kern_size = Make::SizeU8()};
|
||||
}
|
||||
};
|
||||
|
||||
GPU::SizeU16 texture_size;
|
||||
RenderInfo render_info;
|
||||
|
||||
static constexpr FontInfo create(GPU::SizeU16 texture_size, GPU::SizeU8 font_size, GPU::SizeU8 kern_size) {
|
||||
return FontInfo{.texture_size = texture_size, .render_info = {.font_size = font_size, .kern_size = kern_size}};
|
||||
}
|
||||
|
||||
static constexpr FontInfo create(GPU::SizeU16 texture_size, GPU::SizeU8 font_size) {
|
||||
return FontInfo::create(texture_size, font_size, font_size);
|
||||
}
|
||||
|
||||
constexpr GPU::SizeU16 get_font_size() const {
|
||||
return GPU::SizeU16::from(this->render_info.font_size);
|
||||
}
|
||||
|
||||
constexpr GPU::SizeU16 get_kern_size() const {
|
||||
return GPU::SizeU16::from(this->render_info.kern_size);
|
||||
}
|
||||
|
||||
template<size_t Size>
|
||||
constexpr size_t estimate_str_render_length(const char (&str)[Size]) const {
|
||||
return (Size - 1)*FontInfo::get_kern_size().width;
|
||||
}
|
||||
};
|
||||
|
||||
struct Cursor {
|
||||
GPU::PositionI16 pos;
|
||||
uint8_t wiggle_count;
|
||||
|
||||
static constexpr Cursor create(GPU::PositionI16 pos, uint8_t wiggle_count = 0) {
|
||||
return Cursor{.pos = pos, .wiggle_count = wiggle_count};
|
||||
}
|
||||
|
||||
constexpr Cursor& change_position(GPU::PositionI16 pos) {
|
||||
this->pos = pos;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
using Wiggle = GPU::PositionI8[8];
|
||||
}
|
||||
#pragma once
|
||||
#include <PSX/File/file_types.hpp>
|
||||
#include <PSX/GPU/gpu_types.hpp>
|
||||
#include <PSX/GPU/make_gpu_primitives.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
using FontPrimitive = GPU::SPRT::Linked;
|
||||
|
||||
struct FontInfo {
|
||||
struct RenderInfo {
|
||||
GPU::SizeU8 font_size;
|
||||
GPU::SizeU8 kern_size;
|
||||
|
||||
static constexpr RenderInfo empty() {
|
||||
return RenderInfo{.font_size = Make::SizeU8(), .kern_size = Make::SizeU8()};
|
||||
}
|
||||
};
|
||||
|
||||
GPU::SizeU16 texture_size;
|
||||
RenderInfo render_info;
|
||||
|
||||
static constexpr FontInfo create(GPU::SizeU16 texture_size, GPU::SizeU8 font_size, GPU::SizeU8 kern_size) {
|
||||
return FontInfo{.texture_size = texture_size, .render_info = {.font_size = font_size, .kern_size = kern_size}};
|
||||
}
|
||||
|
||||
static constexpr FontInfo create(GPU::SizeU16 texture_size, GPU::SizeU8 font_size) {
|
||||
return FontInfo::create(texture_size, font_size, font_size);
|
||||
}
|
||||
|
||||
constexpr GPU::SizeU16 get_font_size() const {
|
||||
return GPU::SizeU16::from(this->render_info.font_size);
|
||||
}
|
||||
|
||||
constexpr GPU::SizeU16 get_kern_size() const {
|
||||
return GPU::SizeU16::from(this->render_info.kern_size);
|
||||
}
|
||||
|
||||
template<size_t Size>
|
||||
constexpr size_t estimate_str_render_length(const char (&str)[Size]) const {
|
||||
return (Size - 1)*FontInfo::get_kern_size().width;
|
||||
}
|
||||
};
|
||||
|
||||
struct Cursor {
|
||||
GPU::PositionI16 pos;
|
||||
uint8_t wiggle_count;
|
||||
|
||||
static constexpr Cursor create(GPU::PositionI16 pos, uint8_t wiggle_count = 0) {
|
||||
return Cursor{.pos = pos, .wiggle_count = wiggle_count};
|
||||
}
|
||||
|
||||
constexpr Cursor& change_position(GPU::PositionI16 pos) {
|
||||
this->pos = pos;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
using Wiggle = GPU::PositionI8[8];
|
||||
}
|
||||
|
@@ -1,62 +1,62 @@
|
||||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
#include <stdarg.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
class FontWriter {
|
||||
private:
|
||||
#define __write_impl(start, color, wiggle) \
|
||||
va_list list; \
|
||||
va_start(list, start); \
|
||||
FontWriter::write(cursor, str, color, wiggle, list); \
|
||||
va_end(list)
|
||||
|
||||
GPU::TexPage::Linked tex_page[2];
|
||||
FontInfo::RenderInfo render_info;
|
||||
GPU::PageClut clut;
|
||||
GPU::Link* last_primitive;
|
||||
|
||||
public:
|
||||
static constexpr FontWriter empty() {
|
||||
FontWriter instance;
|
||||
|
||||
instance.tex_page[0] = {0};
|
||||
instance.tex_page[1] = {0};
|
||||
instance.render_info = FontInfo::RenderInfo::empty();
|
||||
instance.clut = Make::PageClut();
|
||||
instance.last_primitive = nullptr;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void setup(const SimpleTIM& vram_dst, const FontInfo::RenderInfo& font_render_info);
|
||||
|
||||
void setup(const SimpleTIM& vram_dst, const FontInfo& font_info) {
|
||||
FontWriter::setup(vram_dst, font_info.render_info);
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
void write(Cursor& cursor, const char* str, ...) {
|
||||
__write_impl(str, GPU::Color24::Grey(), nullptr);
|
||||
}
|
||||
void write(Cursor& cursor, const char* str, GPU::Color24 color, ...) {
|
||||
__write_impl(color, color, nullptr);
|
||||
}
|
||||
void write(Cursor& cursor, const char* str, GPU::Color24 color, const Wiggle* wiggle, ...) {
|
||||
__write_impl(wiggle, color, wiggle);
|
||||
}
|
||||
void write(Cursor& cursor, const char* str, GPU::Color24 color, const Wiggle* wiggle, va_list list);
|
||||
void render();
|
||||
|
||||
#undef __write_impl
|
||||
};
|
||||
|
||||
struct GlobalFontPrimitivePool {
|
||||
static void setup(FontPrimitive* start, size_t length);
|
||||
|
||||
template<size_t Size>
|
||||
static void setup(FontPrimitive (&buffer)[Size]) {
|
||||
GlobalFontPrimitivePool::setup(buffer, Size);
|
||||
}
|
||||
};
|
||||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
#include <stdarg.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
class FontWriter {
|
||||
private:
|
||||
#define __write_impl(start, color, wiggle) \
|
||||
va_list list; \
|
||||
va_start(list, start); \
|
||||
FontWriter::write(cursor, str, color, wiggle, list); \
|
||||
va_end(list)
|
||||
|
||||
GPU::TexPage::Linked tex_page[2];
|
||||
FontInfo::RenderInfo render_info;
|
||||
GPU::PageClut clut;
|
||||
GPU::Link* last_primitive;
|
||||
|
||||
public:
|
||||
static constexpr FontWriter empty() {
|
||||
FontWriter instance;
|
||||
|
||||
instance.tex_page[0] = {0};
|
||||
instance.tex_page[1] = {0};
|
||||
instance.render_info = FontInfo::RenderInfo::empty();
|
||||
instance.clut = Make::PageClut();
|
||||
instance.last_primitive = nullptr;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void setup(const SimpleTIM& vram_dst, const FontInfo::RenderInfo& font_render_info);
|
||||
|
||||
void setup(const SimpleTIM& vram_dst, const FontInfo& font_info) {
|
||||
FontWriter::setup(vram_dst, font_info.render_info);
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
void write(Cursor& cursor, const char* str, ...) {
|
||||
__write_impl(str, GPU::Color24::Grey(), nullptr);
|
||||
}
|
||||
void write(Cursor& cursor, const char* str, GPU::Color24 color, ...) {
|
||||
__write_impl(color, color, nullptr);
|
||||
}
|
||||
void write(Cursor& cursor, const char* str, GPU::Color24 color, const Wiggle* wiggle, ...) {
|
||||
__write_impl(wiggle, color, wiggle);
|
||||
}
|
||||
void write(Cursor& cursor, const char* str, GPU::Color24 color, const Wiggle* wiggle, va_list list);
|
||||
void render();
|
||||
|
||||
#undef __write_impl
|
||||
};
|
||||
|
||||
struct GlobalFontPrimitivePool {
|
||||
static void setup(FontPrimitive* start, size_t length);
|
||||
|
||||
template<size_t Size>
|
||||
static void setup(FontPrimitive (&buffer)[Size]) {
|
||||
GlobalFontPrimitivePool::setup(buffer, Size);
|
||||
}
|
||||
};
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
#include <PSX/GPU/gpu_auto_load_font.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
struct DefaultFont {
|
||||
static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 80), Make::SizeU8(12, 16));
|
||||
|
||||
static void load(uint32_t* work_area, SimpleTIM vram_dst);
|
||||
};
|
||||
|
||||
struct BIOSFont {
|
||||
static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 96), Make::SizeU8(16, 16), Make::SizeU8(12, 16));
|
||||
static constexpr auto TIM = SimpleTIM::create(JabyEngine::GPU::BIOS_Font::TextureLoadPos.x, JabyEngine::GPU::BIOS_Font::TextureLoadPos.y, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.x, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.y);
|
||||
};
|
||||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
#include <PSX/GPU/gpu_auto_load_font.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
struct DefaultFont {
|
||||
static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 80), Make::SizeU8(12, 16));
|
||||
|
||||
static void load(uint32_t* work_area, SimpleTIM vram_dst);
|
||||
};
|
||||
|
||||
struct BIOSFont {
|
||||
static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 96), Make::SizeU8(16, 16), Make::SizeU8(12, 16));
|
||||
static constexpr auto TIM = SimpleTIM::create(JabyEngine::GPU::BIOS_Font::TextureLoadPos.x, JabyEngine::GPU::BIOS_Font::TextureLoadPos.y, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.x, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.y);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user