Bound line type
This commit is contained in:
parent
8679932d73
commit
4f11903ed2
|
@ -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[] = {
|
||||
|
|
|
@ -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<short>(0xF000), static_cast<short>(0xF000u)}};
|
||||
}
|
||||
};
|
||||
|
||||
struct LineMaker {
|
||||
// Make this it's own outside type??
|
||||
template<typename T, size_t N>
|
||||
struct Type {
|
||||
T head;
|
||||
T body[N];
|
||||
};
|
||||
|
||||
static constexpr Type<LINE_F, 2> new_line_f(const Color24& color, const Vertex (&vertices)[2]) {
|
||||
return Type<LINE_F, 2>{.head = LINE_F::new_line(color, false), .body = {LINE_F::new_point(vertices[0]), LINE_F::new_point(vertices[1])}};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,11 @@ namespace JabyEngine {
|
|||
internal::render(reinterpret_cast<const uint32_t*>(&line), N);
|
||||
}
|
||||
|
||||
template<size_t N>
|
||||
static void render(const LineMaker::Type<LINE_F, N>& line_type) {
|
||||
internal::render(reinterpret_cast<const uint32_t*>(&line_type), sizeof(line_type)/sizeof(uint32_t));
|
||||
}
|
||||
|
||||
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue