aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2017-02-16 00:19:03 +0100
committerRay <raysan5@gmail.com>2017-02-16 00:19:03 +0100
commit177af272f0713ee42bdb32201b1fff3aa75e345f (patch)
treeb872e48113d955177fb0ba9aaba26b57ebb324be /src
parent4cb3e4a240d342a08a97cb4659c18c34d8dccdc8 (diff)
downloadraylib-177af272f0713ee42bdb32201b1fff3aa75e345f.tar.gz
raylib-177af272f0713ee42bdb32201b1fff3aa75e345f.zip
Added function DrawRectanglePro()
Diffstat (limited to 'src')
-rw-r--r--src/shapes.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/shapes.c b/src/shapes.c
index 8c6c4be0..83b80182 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -4,11 +4,17 @@
*
* Basic functions to draw 2d Shapes and check collisions
*
-* External libs:
+* DEPENDENCIES:
* rlgl - raylib OpenGL abstraction layer
*
-* Module Configuration Flags:
-* ...
+* CONFIGURATION:
+*
+* #define SUPPORT_QUADS_ONLY
+*
+ #define SUPPORT_TRIANGLES_ONLY
+*
+*
+* LICENSE: zlib/libpng
*
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
*
@@ -190,6 +196,29 @@ void DrawRectangleRec(Rectangle rec, Color color)
DrawRectangle(rec.x, rec.y, rec.width, rec.height, color);
}
+void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
+{
+ rlEnableTexture(GetDefaultTexture().id);
+
+ rlPushMatrix();
+ rlTranslatef((float)rec.x, (float)rec.y, 0);
+ rlRotatef(rotation, 0, 0, 1);
+ rlTranslatef(-origin.x, -origin.y, 0);
+
+ rlBegin(RL_QUADS);
+ rlColor4ub(color.r, color.g, color.b, color.a);
+ rlNormal3f(0.0f, 0.0f, 1.0f); // Normal vector pointing towards viewer
+
+ rlVertex2f(0.0f, 0.0f);
+ rlVertex2f(0.0f, (float)rec.height);
+ rlVertex2f((float)rec.width, (float)rec.height);
+ rlVertex2f((float)rec.width, 0.0f);
+ rlEnd();
+ rlPopMatrix();
+
+ rlDisableTexture();
+}
+
// Draw a gradient-filled rectangle
// NOTE: Gradient goes from bottom (color1) to top (color2)
void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2)