1/*******************************************************************************************
2*
3* raylib [shapes] example - Draw basic shapes 2d (rectangle, circle, line...)
4*
5* This example has been created using raylib 1.0 (www.raylib.com)
6* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7*
8* Copyright (c) 2014 Ramon Santamaria (@raysan5)
9*
10********************************************************************************************/
11
12#include "raylib.h"
13
14int main(void)
15{
16 // Initialization
17 //--------------------------------------------------------------------------------------
18 const int screenWidth = 800;
19 const int screenHeight = 450;
20
21 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
22
23 SetTargetFPS(60); // Set our game to run at 60 frames-per-second
24 //--------------------------------------------------------------------------------------
25
26 // Main game loop
27 while (!WindowShouldClose()) // Detect window close button or ESC key
28 {
29 // Update
30 //----------------------------------------------------------------------------------
31 // TODO: Update your variables here
32 //----------------------------------------------------------------------------------
33
34 // Draw
35 //----------------------------------------------------------------------------------
36 BeginDrawing();
37
38 ClearBackground(RAYWHITE);
39
40 DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);
41
42 DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
43
44 DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
45 DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
46 DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
47
48 DrawTriangle((Vector2){screenWidth/4*3, 80},
49 (Vector2){screenWidth/4*3 - 60, 150},
50 (Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
51
52 DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
53
54 DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE);
55
56 // NOTE: We draw all LINES based shapes together to optimize internal drawing,
57 // this way, all LINES are rendered in a single draw pass
58 DrawLine(18, 42, screenWidth - 18, 42, BLACK);
59 DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);
60 DrawTriangleLines((Vector2){screenWidth/4*3, 160},
61 (Vector2){screenWidth/4*3 - 20, 230},
62 (Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
63 EndDrawing();
64 //----------------------------------------------------------------------------------
65 }
66
67 // De-Initialization
68 //--------------------------------------------------------------------------------------
69 CloseWindow(); // Close window and OpenGL context
70 //--------------------------------------------------------------------------------------
71
72 return 0;
73}