diff --git a/examples/PoolBox/application/src/Overlay/ScreenCenter/screen_center.cpp b/examples/PoolBox/application/src/Overlay/ScreenCenter/screen_center.cpp index 963f117f..473e0084 100644 --- a/examples/PoolBox/application/src/Overlay/ScreenCenter/screen_center.cpp +++ b/examples/PoolBox/application/src/Overlay/ScreenCenter/screen_center.cpp @@ -1,7 +1,29 @@ +#include "../../../include/shared.hpp" +#include #include namespace ScreenCenter { + using namespace JabyEngine; + + static const char*const ASCII = "!\"#$%&'()*+,-./0\n123456789:;<=>?@\nABCDEFGHIJKLMNOP\nQRSTUVWXYZ[\\]^_`\nabcdefghijklmnop\nqrstuvwxyz{|}~"; + + static void setup() {} + static void update() { + auto cursor = FontWriter::update(Make::PositionI16(8, 8)); + + FontWriter::bios_font_writer.write(cursor, ASCII); + } + static void render() { + FontWriter::bios_font_writer.render(); + } + void main() { - printf("BlubbBlubbBlubbBlubb\n"); + setup(); + + while(true) { + update(); + GPU::swap_buffers_vsync(1); + render(); + } } } \ No newline at end of file diff --git a/examples/PoolBox/application/src/application.cpp b/examples/PoolBox/application/src/application.cpp index f0a23fca..df6232b9 100644 --- a/examples/PoolBox/application/src/application.cpp +++ b/examples/PoolBox/application/src/application.cpp @@ -81,7 +81,7 @@ static void setup() { namespace NormalScene { static void update() { static const char Title[] = "Pool Box"; - static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.font_size.width; + static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.get_font_size().width; Periphery::query_controller(); auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16)); @@ -108,7 +108,7 @@ namespace NormalScene { namespace LoadingScene { static void update() { static const char Title[] = "Loading..."; - static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.font_size.width; + static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.get_font_size().width; auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, (GPU::Display::Height-16)/2)); FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Blue(0xD0)); diff --git a/include/PSX/GPU/gpu_types.hpp b/include/PSX/GPU/gpu_types.hpp index 22183077..2d52f176 100644 --- a/include/PSX/GPU/gpu_types.hpp +++ b/include/PSX/GPU/gpu_types.hpp @@ -198,6 +198,7 @@ namespace JabyEngine { using PositionU8 = Position; using PositionI16 = Position; using PositionU16 = Position; + using Vertex = PositionI16; template struct Size { @@ -208,12 +209,17 @@ namespace JabyEngine { return Size{w, h}; } + template + static constexpr Size from(const Size& size) { + return Size::create(static_cast(size.width), static_cast(size.height)); + } + auto operator<=>(const Size&) const = default; }; - typedef Size SizeI16; - typedef Size SizeU16; - // Type used for primitives - typedef PositionI16 Vertex; + using SizeI8 = Size; + using SizeU8 = Size; + using SizeI16 = Size; + using SizeU16 = Size; template static constexpr T tile_id_for(S id, S row_count, Size size) { diff --git a/include/PSX/GPU/make_gpu_primitives.hpp b/include/PSX/GPU/make_gpu_primitives.hpp index e9ea094b..ff6761ef 100644 --- a/include/PSX/GPU/make_gpu_primitives.hpp +++ b/include/PSX/GPU/make_gpu_primitives.hpp @@ -13,6 +13,24 @@ namespace JabyEngine { // ################################################################### + static constexpr GPU::SizeI8 SizeI8() { + return creator_template(0_i8, 0_i8); + } + static constexpr GPU::SizeI8 SizeI8(int8_t x, int8_t y) { + return creator_template(x, y); + } + + // ################################################################### + + static constexpr GPU::SizeU8 SizeU8() { + return creator_template(0_u8, 0_u8); + } + static constexpr GPU::SizeU8 SizeU8(uint8_t x, uint8_t y) { + return creator_template(x, y); + } + + // ################################################################### + static constexpr GPU::SizeI16 SizeI16() { return creator_template(0_i16, 0_i16); }