aboutsummaryrefslogtreecommitdiff
path: root/src/shapes.c
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2014-04-19 16:36:49 +0200
committerraysan5 <raysan5@gmail.com>2014-04-19 16:36:49 +0200
commitf06a15ac8b3fe92d101ae795225fbf56fa670dba (patch)
treecdfba90ee24fd078a15c89d8753ee3e11d8e229b /src/shapes.c
parent650a8f7f159d3ce2addb1b0fdb31c3f460005391 (diff)
downloadraylib-f06a15ac8b3fe92d101ae795225fbf56fa670dba.tar.gz
raylib-f06a15ac8b3fe92d101ae795225fbf56fa670dba.zip
raylib 1.1
View CHANGELOG for a detailed list of changes
Diffstat (limited to 'src/shapes.c')
-rw-r--r--src/shapes.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/shapes.c b/src/shapes.c
index 42496351..2c589512 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -112,6 +112,7 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co
rlVertex2i(centerX, centerY);
rlColor4ub(color2.r, color2.g, color2.b, color2.a);
rlVertex2f(centerX + sin(DEG2RAD*i) * radius, centerY + cos(DEG2RAD*i) * radius);
+ rlColor4ub(color2.r, color2.g, color2.b, color2.a);
rlVertex2f(centerX + sin(DEG2RAD*(i+2)) * radius, centerY + cos(DEG2RAD*(i+2)) * radius);
}
rlEnd();
@@ -149,17 +150,10 @@ void DrawCircleLines(int centerX, int centerY, float radius, Color color)
// Draw a color-filled rectangle
void DrawRectangle(int posX, int posY, int width, int height, Color color)
{
- rlBegin(RL_QUADS);
- rlColor4ub(color.r, color.g, color.b, color.a);
- rlTexCoord2f(0.0f, 0.0f);
- rlVertex2i(posX, posY);
- rlTexCoord2f(0.0f, 1.0f);
- rlVertex2i(posX, posY + height);
- rlTexCoord2f(1.0f, 1.0f);
- rlVertex2i(posX + width, posY + height);
- rlTexCoord2f(1.0f, 0.0f);
- rlVertex2i(posX + width, posY);
- rlEnd();
+ Vector2 position = { (float)posX, (float)posY };
+ Vector2 size = { (float)width, (float)height };
+
+ DrawRectangleV(position, size, color);
}
// Draw a color-filled rectangle
@@ -172,26 +166,29 @@ void DrawRectangleRec(Rectangle rec, Color color)
// NOTE: Gradient goes from bottom (color1) to top (color2)
void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2)
{
- rlBegin(RL_QUADS);
- rlColor4ub(color1.r, color1.g, color1.b, color1.a);
- rlVertex2i(posX, posY);
- rlColor4ub(color1.r, color1.g, color1.b, color1.a);
- rlVertex2i(posX, posY + height);
- rlColor4ub(color2.r, color2.g, color2.b, color2.a);
- rlVertex2i(posX + width, posY + height);
- rlColor4ub(color2.r, color2.g, color2.b, color2.a);
- rlVertex2i(posX + width, posY);
+ rlBegin(RL_TRIANGLES);
+ rlColor4ub(color1.r, color1.g, color1.b, color1.a); rlVertex2i(posX, posY);
+ rlColor4ub(color2.r, color2.g, color2.b, color2.a); rlVertex2i(posX, posY + height);
+ rlColor4ub(color2.r, color2.g, color2.b, color2.a); rlVertex2i(posX + width, posY + height);
+
+ rlColor4ub(color1.r, color1.g, color1.b, color1.a); rlVertex2i(posX, posY);
+ rlColor4ub(color2.r, color2.g, color2.b, color2.a); rlVertex2i(posX + width, posY + height);
+ rlColor4ub(color1.r, color1.g, color1.b, color1.a); rlVertex2i(posX + width, posY);
rlEnd();
}
// Draw a color-filled rectangle (Vector version)
void DrawRectangleV(Vector2 position, Vector2 size, Color color)
{
- rlBegin(RL_QUADS);
+ rlBegin(RL_TRIANGLES);
rlColor4ub(color.r, color.g, color.b, color.a);
+
rlVertex2i(position.x, position.y);
rlVertex2i(position.x, position.y + size.y);
rlVertex2i(position.x + size.x, position.y + size.y);
+
+ rlVertex2i(position.x, position.y);
+ rlVertex2i(position.x + size.x, position.y + size.y);
rlVertex2i(position.x + size.x, position.y);
rlEnd();
}