diff --git a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp index 05a6153d..1de7b08b 100644 --- a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp +++ b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp @@ -7,10 +7,12 @@ namespace ScreenCenter { class Frame : public GPU::internal::LinkedElementCreator { private: - GPU::TILE top_left[2]; - GPU::TILE top_right[2]; - GPU::TILE bottom_left[2]; - GPU::TILE bottom_right[2]; + GPU::TILE top_left[2]; + GPU::TILE top_right[2]; + GPU::TILE bottom_left[2]; + GPU::TILE bottom_right[2]; + GPU::LINE_G_MULTI<5> border; + GPU::LINE_G_SINGLE cross[2]; public: static constexpr Frame::Linked create() { @@ -30,6 +32,17 @@ namespace ScreenCenter { frame.bottom_right[0] = Make::TILE(Make::AreaI16(GPU::Display::Width - Size.height, GPU::Display::Height - Size.width, Size.height, Size.width), BaseColor); frame.bottom_right[1] = Make::TILE(Make::AreaI16(GPU::Display::Width - Size.width, GPU::Display::Height - Size.height, Size.width, Size.height), BaseColor); + + 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)} + ); + + frame.cross[0] = Make::LINE_G(frame.border[0], frame.border[2]); + frame.cross[1] = Make::LINE_G(frame.border[3], frame.border[1]); return frame.linked(); } }; diff --git a/include/PSX/GPU/Primitives/primitive_line_types.hpp b/include/PSX/GPU/Primitives/primitive_line_types.hpp index ac1c6361..96d337b2 100644 --- a/include/PSX/GPU/Primitives/primitive_line_types.hpp +++ b/include/PSX/GPU/Primitives/primitive_line_types.hpp @@ -69,6 +69,22 @@ namespace JabyEngine { Vertex start_point; Body points[N]; Termination end; + + template + constexpr typename enable_if::value, Vertex>::type operator[](size_t idx) const { + if(idx == 0) { + return this->start_point; + } + return this->points[idx - 1]; + } + + template + constexpr typename enable_if::value, ColorVertex>::type operator[](size_t idx) const { + if(idx == 0) { + return ColorVertex::create(this->head.color, this->start_point); + } + return this->points[idx - 1]; + } }; } @@ -105,5 +121,13 @@ namespace JabyEngine { return {.head = LineHead::create(start_point.color, IdentityCode, true), .start_point = start_point.position, .points = {rest...}, .end = Termination::create()}; } }; + + using LINE_F_SINGLE = internal::SingleLine; + template + using LINE_F_MULTI = internal::MultiLine; + + using LINE_G_SINGLE = internal::SingleLine; + template + using LINE_G_MULTI = internal::MultiLine; } } \ No newline at end of file diff --git a/include/PSX/GPU/make_gpu_primitives.hpp b/include/PSX/GPU/make_gpu_primitives.hpp index ff6761ef..c359e699 100644 --- a/include/PSX/GPU/make_gpu_primitives.hpp +++ b/include/PSX/GPU/make_gpu_primitives.hpp @@ -187,21 +187,21 @@ namespace JabyEngine { // ################################################################### - static constexpr GPU::internal::SingleLine LINE_F(const GPU::Color24& color, const GPU::Vertex& start_point, const GPU::Vertex& end_point) { + static constexpr GPU::LINE_F_SINGLE LINE_F(const GPU::Color24& color, const GPU::Vertex& start_point, const GPU::Vertex& end_point) { return GPU::LINE_F::create(color, start_point, end_point); } template - static constexpr GPU::internal::MultiLine LINE_F(const GPU::Color24& color, const GPU::Vertex& start_point, const ARGS&...rest) { + static constexpr GPU::LINE_F_MULTI LINE_F(const GPU::Color24& color, const GPU::Vertex& start_point, const ARGS&...rest) { return GPU::LINE_F::create(color, start_point, rest...); } - static constexpr GPU::internal::SingleLine LINE_G(const GPU::ColorVertex& start_point, const GPU::ColorVertex& end_point) { + static constexpr GPU::LINE_G_SINGLE LINE_G(const GPU::ColorVertex& start_point, const GPU::ColorVertex& end_point) { return GPU::LINE_G::create(start_point, end_point); } template - static constexpr GPU::internal::MultiLine LINE_G(const GPU::ColorVertex& start_point, const ARGS&...rest) { + static constexpr GPU::LINE_G_MULTI LINE_G(const GPU::ColorVertex& start_point, const ARGS&...rest) { return GPU::LINE_G::create(start_point, rest...); }