1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| #include "raylib.h"
int main(void) { InitWindow(800, 450, "raylib rshapes example"); SetTargetFPS(60);
while (!WindowShouldClose()) { BeginDrawing(); ClearBackground(RAYWHITE);
// 1. 画线 DrawLine(50, 50, 200, 50, BLACK);
// 2. 画矩形(实心) DrawRectangle(50, 100, 120, 60, BLUE);
// 3. 画矩形(空心) DrawRectangleLines(50, 180, 120, 60, DARKBLUE);
// 4. 画圆 DrawCircle(350, 150, 50, RED);
// 5. 画圆(空心) DrawCircleLines(350, 260, 40, MAROON);
// 6. 画三角形 DrawTriangle( (Vector2){500, 100}, (Vector2){450, 200}, (Vector2){550, 200}, GREEN );
// 7. 画多边形(正六边形) DrawPoly((Vector2){650, 150}, 6, 50, 0, PURPLE);
// 8. 文本说明 DrawText("Basic shapes drawn with rshapes module", 10, 10, 20, DARKGRAY);
EndDrawing(); }
CloseWindow(); return 0; }
|