add debug GUI render mode (F8)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -48,10 +48,14 @@ public:
|
||||
void sprite(float x, float y, float w, float h, float skew, int atlasRes, int index, glm::vec4 tint);
|
||||
void point(float x, float y, float r, float g, float b, float a);
|
||||
|
||||
void setColor(glm::vec4 color) {
|
||||
void setColor(const glm::vec4& color) {
|
||||
this->color = color;
|
||||
}
|
||||
|
||||
void setColor(int r, int g, int b, int a=255) {
|
||||
this->color = glm::vec4(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
}
|
||||
|
||||
void resetColor() {
|
||||
this->color = glm::vec4(1.0f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user