diff --git a/examples/PoolBox/application/src/main.cpp b/examples/PoolBox/application/src/main.cpp index e2675cb3..6a914f76 100644 --- a/examples/PoolBox/application/src/main.cpp +++ b/examples/PoolBox/application/src/main.cpp @@ -87,11 +87,9 @@ static constexpr const auto rectangle5 = JabyEngine::GPU::POLY_GT4( JabyEngine::GPU::Color24::White()} ).set_semi_transparent(true); -static constexpr const JabyEngine::GPU::LINE_F line1[] = { - JabyEngine::GPU::LINE_F::new_line(LineColor, false), - JabyEngine::GPU::LINE_F::new_point({0, 0}), - JabyEngine::GPU::LINE_F::new_point({JabyEngine::GPU::Display::Width, JabyEngine::GPU::Display::Height}) -}; +static constexpr const auto line1 = JabyEngine::GPU::LineMaker::new_line_f(LineColor, { + {0, 0}, + {JabyEngine::GPU::Display::Width, JabyEngine::GPU::Display::Height}}); static void load_assets() { static const JabyEngine::CDFile Assets[] = { diff --git a/include/PSX/GPU/Primitives/primitive_line_types.hpp b/include/PSX/GPU/Primitives/primitive_line_types.hpp index 9c002124..b9cf74e5 100644 --- a/include/PSX/GPU/Primitives/primitive_line_types.hpp +++ b/include/PSX/GPU/Primitives/primitive_line_types.hpp @@ -50,6 +50,8 @@ namespace JabyEngine { Code code = IdentityCode; }; + typedef Vertex Body; + union { Head head; Vertex vertex; @@ -67,6 +69,19 @@ namespace JabyEngine { return {.vertex = {static_cast(0xF000), static_cast(0xF000u)}}; } }; + + struct LineMaker { + // Make this it's own outside type?? + template + struct Type { + T head; + T body[N]; + }; + + static constexpr Type new_line_f(const Color24& color, const Vertex (&vertices)[2]) { + return Type{.head = LINE_F::new_line(color, false), .body = {LINE_F::new_point(vertices[0]), LINE_F::new_point(vertices[1])}}; + } + }; } } diff --git a/include/PSX/GPU/gpu.hpp b/include/PSX/GPU/gpu.hpp index f11e449a..17630838 100644 --- a/include/PSX/GPU/gpu.hpp +++ b/include/PSX/GPU/gpu.hpp @@ -50,6 +50,11 @@ namespace JabyEngine { internal::render(reinterpret_cast(&line), N); } + template + static void render(const LineMaker::Type& line_type) { + internal::render(reinterpret_cast(&line_type), sizeof(line_type)/sizeof(uint32_t)); + } + uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true); } }