diff options
| author | Ray <[email protected]> | 2017-03-05 15:49:19 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-03-05 15:49:19 +0100 |
| commit | bb7b9adb371f89f3c8677bdca5418013fe73d9c1 (patch) | |
| tree | 99f1dd9b8c42afb190dc30937dfe2ccc3458ff77 /src/shapes.c | |
| parent | b16f11845259205b484c3633b9b9375a69a917ae (diff) | |
| parent | 203d1a154eb5b78fc5f56e9dead04c3a89bcd39e (diff) | |
| download | raylib-bb7b9adb371f89f3c8677bdca5418013fe73d9c1.tar.gz raylib-bb7b9adb371f89f3c8677bdca5418013fe73d9c1.zip | |
Merge pull request #236 from raysan5/develop
Integrate Develop branch
Diffstat (limited to 'src/shapes.c')
| -rw-r--r-- | src/shapes.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/shapes.c b/src/shapes.c index 8c6c4be0..a42b0551 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -1,14 +1,17 @@ /********************************************************************************************** * -* raylib.shapes +* raylib.shapes - Basic functions to draw 2d Shapes and check collisions * -* Basic functions to draw 2d Shapes and check collisions +* CONFIGURATION: * -* External libs: -* rlgl - raylib OpenGL abstraction layer +* #define SUPPORT_QUADS_ONLY +* Draw shapes using only QUADS, vertex are accumulated in QUADS arrays (like textures) * -* Module Configuration Flags: -* ... +* #define SUPPORT_TRIANGLES_ONLY +* Draw shapes using only TRIANGLES, vertex are accumulated in TRIANGLES arrays +* +* +* LICENSE: zlib/libpng * * Copyright (c) 2014-2016 Ramon Santamaria (@raysan5) * @@ -190,6 +193,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) |
