add debug GUI render mode (F8)

This commit is contained in:
MihailRis 2025-03-10 18:06:39 +03:00
parent a74a4fcf53
commit 5af6b91b22
18 changed files with 93 additions and 29 deletions

View file

@ -142,7 +142,7 @@ void Batch2D::rect(
bool flippedY,
glm::vec4 tint
) {
if (index + 6*B2D_VERTEX_SIZE >= capacity) {
if (index + 6 * B2D_VERTEX_SIZE >= capacity) {
flush();
}
setPrimitive(DrawPrimitive::triangle);
@ -230,6 +230,11 @@ void Batch2D::rect(
}
void Batch2D::lineRect(float x, float y, float w, float h) {
if (index + 8 * B2D_VERTEX_SIZE >= capacity) {
flush();
}
setPrimitive(DrawPrimitive::line);
vertex(x, y, 0.0f, 0.0f, color.r, color.g, color.b, color.a);
vertex(x, y+h, 0.0f, 1.0f, color.r, color.g, color.b, color.a);