From 3a5d9f590c55fc45a0621871487912ed63da9e10 Mon Sep 17 00:00:00 2001 From: Jaby Date: Wed, 20 Mar 2024 17:16:58 -0500 Subject: [PATCH] Add second frame to see something on PS3 --- .../Overlay/ScreenCenter/include/frame.hpp | 37 ++++++++++++------- .../GPU/Primitives/primitive_line_types.hpp | 3 +- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp index 66b34cd7..5a319d6e 100644 --- a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp +++ b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp @@ -43,15 +43,23 @@ namespace ScreenCenter { struct LineBorder : GPU::internal::LinkedElementCreator { GPU::LINE_G_MULTI<5> border; - static constexpr LineBorder::Linked create() { - LineBorder frame; - + static constexpr LineBorder::Linked create(int16_t offset = 0) { + const auto get_color = [](size_t idx, int16_t offset) -> GPU::Color24 { + const GPU::Color24 Colors[4] = {GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Blue(), GPU::Color24::Yellow()}; + + return Colors[(idx + offset)%4]; + }; + const int16_t origin = 0 + offset; + const int16_t width = GPU::Display::Width - 1 - offset; + const int16_t height = GPU::Display::Height - 1 - offset; + LineBorder frame; + frame.border = Make::LINE_G( - GPU::ColorVertex{GPU::Color24::Red(), Make::Vertex(0, 0)}, - GPU::ColorVertex{GPU::Color24::Green(), Make::Vertex(0, GPU::Display::Height - 1)}, - GPU::ColorVertex{GPU::Color24::Blue(), Make::Vertex(GPU::Display::Width - 1, GPU::Display::Height - 1)}, - GPU::ColorVertex{GPU::Color24::Yellow(), Make::Vertex(GPU::Display::Width - 1, 0)}, - GPU::ColorVertex{GPU::Color24::Red(), Make::Vertex(0, 0)} + GPU::ColorVertex{get_color(0, offset), Make::Vertex(origin, origin)}, + GPU::ColorVertex{get_color(1, offset), Make::Vertex(origin, height)}, + GPU::ColorVertex{get_color(2, offset), Make::Vertex(width, height)}, + GPU::ColorVertex{get_color(3, offset), Make::Vertex(width, origin)}, + GPU::ColorVertex{get_color(4, offset), Make::Vertex(origin, origin)} ); return frame.linked(); } @@ -71,7 +79,7 @@ namespace ScreenCenter { TopBorder::Linked top_border; BottomBorder::Linked bottom_border; - LineBorder::Linked line_border; + LineBorder::Linked line_border[2]; LineCross::Linked line_cross; public: static constexpr Frame create() { @@ -80,15 +88,16 @@ namespace ScreenCenter { Frame frame; - frame.top_border = TopBorder::create(BaseColor, Size); - frame.bottom_border = BottomBorder::create(BaseColor, Size); - frame.line_border = LineBorder::create(); - frame.line_cross = LineCross::create(frame.line_border->border); + frame.top_border = TopBorder::create(BaseColor, Size); + frame.bottom_border = BottomBorder::create(BaseColor, Size); + frame.line_border[0] = LineBorder::create(); + frame.line_border[1] = LineBorder::create(1); + frame.line_cross = LineCross::create(frame.line_border[0]->border); return frame; } void setup() { - this->top_border.concat(this->bottom_border.concat(this->line_border.concat(this->line_cross))); + this->top_border.concat(this->bottom_border.concat(this->line_border[0].concat(this->line_border[1].concat(this->line_cross)))); } void render() const { diff --git a/include/PSX/GPU/Primitives/primitive_line_types.hpp b/include/PSX/GPU/Primitives/primitive_line_types.hpp index 3ff8704b..3996c8ab 100644 --- a/include/PSX/GPU/Primitives/primitive_line_types.hpp +++ b/include/PSX/GPU/Primitives/primitive_line_types.hpp @@ -52,7 +52,8 @@ namespace JabyEngine { Vertex value; static constexpr Termination create() { - return {.value = Vertex::create(static_cast(0x5000), static_cast(0x5000))}; + // 0x55555555 is more common then 0x50005000 + return {.value = Vertex::create(static_cast(0x5555), static_cast(0x5555))}; } };