Add RenderPolyLinesEx routine (#1758)

Co-authored-by: Lambert Wang <lambert.ww@gmail.com>
This commit is contained in:
Lambert Wang 2021-05-10 11:08:58 -07:00 committed by GitHub
parent 5d831f3f18
commit e39e45824d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 20 deletions

View file

@ -39,27 +39,32 @@ int main(void)
DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);
DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
// Circle shapes and lines
DrawCircle(screenWidth/5, 120, 35, DARKBLUE);
DrawCircleGradient(screenWidth/5, 220, 60, GREEN, SKYBLUE);
DrawCircleLines(screenWidth/5, 340, 80, DARKBLUE);
// Rectangle shapes and ines
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
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);
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
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);
DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE);
// Polygon shapes and lines
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
DrawPolyLinesEx((Vector2){screenWidth/4*3, 320}, 6, 80, 0, 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
DrawLine(18, 42, screenWidth - 18, 42, BLACK);
DrawCircleLines(screenWidth/4, 340, 80, 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);
EndDrawing();
//----------------------------------------------------------------------------------
}