summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorRay <[email protected]>2022-09-05 18:23:25 +0200
committerRay <[email protected]>2022-09-05 18:23:25 +0200
commite59442bfabfb33de3cdee0907ce34ea3b3b92819 (patch)
treea656825ac610b9d8076342469f5cccdddfee029d /examples
parent9996e328cb036b9bc63249bab77de5499ad2e4e8 (diff)
downloadraylib-e59442bfabfb33de3cdee0907ce34ea3b3b92819.tar.gz
raylib-e59442bfabfb33de3cdee0907ce34ea3b3b92819.zip
REMOVED: `rlPushMatrix()`/`rlPopMatrix()` from `rshapes`
This simplification will allow the usage of `rshapes` as STANDALONE mode in a future. Only a small set of `rlgl` functions are required and they can be "more" easely replaced if no `rlPushMatrix()`/`rlPopMatrix()` are involved. More simplification planned for the future, maybe the textures dependencies.
Diffstat (limited to 'examples')
-rw-r--r--examples/shapes/shapes_basic_shapes.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/examples/shapes/shapes_basic_shapes.c b/examples/shapes/shapes_basic_shapes.c
index 5b02a549..d06c2ee1 100644
--- a/examples/shapes/shapes_basic_shapes.c
+++ b/examples/shapes/shapes_basic_shapes.c
@@ -2,7 +2,7 @@
*
* raylib [shapes] example - Draw basic shapes 2d (rectangle, circle, line...)
*
-* Example originally created with raylib 1.0, last time updated with raylib 4.0
+* Example originally created with raylib 1.0, last time updated with raylib 4.2
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
@@ -25,6 +25,8 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
+ float rotation = 0.0f;
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -33,7 +35,7 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
- // TODO: Update your variables here
+ rotation += 0.2f;
//----------------------------------------------------------------------------------
// Draw
@@ -55,17 +57,18 @@ int main(void)
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
// Triangle shapes and lines
- DrawTriangle((Vector2){screenWidth/4.0f *3.0f, 80.0f},
- (Vector2){screenWidth/4.0f *3.0f - 60.0f, 150.0f},
- (Vector2){screenWidth/4.0f *3.0f + 60.0f, 150.0f}, VIOLET);
+ DrawTriangle((Vector2){ screenWidth/4.0f *3.0f, 80.0f },
+ (Vector2){ screenWidth/4.0f *3.0f - 60.0f, 150.0f },
+ (Vector2){ screenWidth/4.0f *3.0f + 60.0f, 150.0f }, VIOLET);
- DrawTriangleLines((Vector2){screenWidth/4.0f*3.0f, 160.0f},
- (Vector2){screenWidth/4.0f*3.0f - 20.0f, 230.0f},
- (Vector2){screenWidth/4.0f*3.0f + 20.0f, 230.0f}, DARKBLUE);
+ DrawTriangleLines((Vector2){ screenWidth/4.0f*3.0f, 160.0f },
+ (Vector2){ screenWidth/4.0f*3.0f - 20.0f, 230.0f },
+ (Vector2){ screenWidth/4.0f*3.0f + 20.0f, 230.0f }, DARKBLUE);
// Polygon shapes and lines
- DrawPoly((Vector2){screenWidth/4.0f*3, 320}, 6, 80, 0, BROWN);
- DrawPolyLinesEx((Vector2){screenWidth/4.0f*3, 320}, 6, 80, 0, 6, BEIGE);
+ DrawPoly((Vector2){ screenWidth/4.0f*3, 330 }, 6, 80, rotation, BROWN);
+ DrawPolyLines((Vector2){ screenWidth/4.0f*3, 330 }, 6, 90, rotation, BROWN);
+ DrawPolyLinesEx((Vector2){ screenWidth/4.0f*3, 330 }, 6, 85, rotation, 6, BEIGE);
// NOTE: We draw all LINES based shapes together to optimize internal drawing,
// this way, all LINES are rendered in a single draw pass