2013-11-19 02:38:44 +04:00
|
|
|
/*******************************************************************************************
|
|
|
|
*
|
2013-11-23 16:30:54 +04:00
|
|
|
* raylib example 02b - Draw basic shapes 2d (rectangle, circle, line...)
|
2013-11-19 02:38:44 +04:00
|
|
|
*
|
2013-11-23 16:30:54 +04:00
|
|
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
|
|
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
2013-11-19 02:38:44 +04:00
|
|
|
*
|
2013-11-23 16:30:54 +04:00
|
|
|
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
2013-11-19 02:38:44 +04:00
|
|
|
*
|
|
|
|
********************************************************************************************/
|
|
|
|
|
|
|
|
#include "raylib.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2013-11-28 22:59:56 +04:00
|
|
|
// Initialization
|
|
|
|
//--------------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
int screenWidth = 800;
|
|
|
|
int screenHeight = 450;
|
2013-11-28 22:59:56 +04:00
|
|
|
|
2013-11-23 16:30:54 +04:00
|
|
|
InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing");
|
2013-11-28 22:59:56 +04:00
|
|
|
//--------------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
|
2013-11-19 02:38:44 +04:00
|
|
|
// Main game loop
|
2013-11-23 16:30:54 +04:00
|
|
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
2013-11-19 02:38:44 +04:00
|
|
|
{
|
2013-11-23 16:30:54 +04:00
|
|
|
// Update
|
2013-11-28 22:59:56 +04:00
|
|
|
//----------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
// TODO: Update your variables here
|
2013-11-28 22:59:56 +04:00
|
|
|
//----------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
|
|
|
|
// Draw
|
2013-11-28 22:59:56 +04:00
|
|
|
//----------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
BeginDrawing();
|
|
|
|
|
|
|
|
ClearBackground(RAYWHITE);
|
|
|
|
|
|
|
|
// TODO: draw some shapes... with names... :P
|
|
|
|
/*
|
2013-11-24 23:30:05 +04:00
|
|
|
void DrawPixel(int posX, int posY, Color color);
|
|
|
|
void DrawPixelV(Vector2 position, Color color);
|
|
|
|
void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color);
|
|
|
|
void DrawLineV(Vector2 startPos, Vector2 endPos, Color color);
|
|
|
|
void DrawCircle(int centerX, int centerY, float radius, Color color);
|
|
|
|
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2);
|
|
|
|
void DrawCircleV(Vector2 center, float radius, Color color);
|
|
|
|
void DrawCircleLines(int centerX, int centerY, float radius, Color color);
|
|
|
|
void DrawRectangle(int posX, int posY, int width, int height, Color color);
|
|
|
|
void DrawRectangleRec(Rectangle rec, Color color);
|
|
|
|
void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2);
|
|
|
|
void DrawRectangleV(Vector2 position, Vector2 size, Color color);
|
|
|
|
void DrawRectangleLines(int posX, int posY, int width, int height, Color color);
|
|
|
|
void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
|
|
|
|
void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
|
|
|
|
void DrawPoly(Vector2 *points, int numPoints, Color color);
|
|
|
|
void DrawPolyLine(Vector2 *points, int numPoints, Color color);
|
2013-11-23 16:30:54 +04:00
|
|
|
*/
|
|
|
|
DrawRectangle(screenWidth/4 - 50, screenHeight/2 - 100, 100, 100, GOLD);
|
|
|
|
DrawCircle(3*screenWidth/4, screenHeight/2 - 50, 50, MAROON);
|
|
|
|
|
|
|
|
DrawText("_____", 320, 280, 50, 1, BLACK);
|
|
|
|
|
2013-11-19 02:38:44 +04:00
|
|
|
EndDrawing();
|
2013-11-28 22:59:56 +04:00
|
|
|
//----------------------------------------------------------------------------------
|
2013-11-19 02:38:44 +04:00
|
|
|
}
|
|
|
|
|
2013-11-23 16:30:54 +04:00
|
|
|
// De-Initialization
|
2013-11-28 22:59:56 +04:00
|
|
|
//--------------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
CloseWindow(); // Close window and OpenGL context
|
2013-11-28 22:59:56 +04:00
|
|
|
//--------------------------------------------------------------------------------------
|
2013-11-23 16:30:54 +04:00
|
|
|
|
2013-11-19 02:38:44 +04:00
|
|
|
return 0;
|
|
|
|
}
|