From df0c95952304efdc7740e4f2ce559ccedb203e76 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 23 Nov 2013 19:08:59 +0100 Subject: Renamed ex02b and added image placeholder --- examples/ex02b_basic_shapes.c | 73 ++++++++++++++++++++++++++++++++++++++++ examples/ex02b_basic_shapes.png | Bin 0 -> 3913 bytes examples/ex02b_shapes.c | 73 ---------------------------------------- examples/ex04a_textures.c | 5 +-- 4 files changed, 76 insertions(+), 75 deletions(-) create mode 100644 examples/ex02b_basic_shapes.c create mode 100644 examples/ex02b_basic_shapes.png delete mode 100644 examples/ex02b_shapes.c (limited to 'examples') diff --git a/examples/ex02b_basic_shapes.c b/examples/ex02b_basic_shapes.c new file mode 100644 index 00000000..5b9ad560 --- /dev/null +++ b/examples/ex02b_basic_shapes.c @@ -0,0 +1,73 @@ +/******************************************************************************************* +* +* raylib example 02b - Draw basic shapes 2d (rectangle, circle, line...) +* +* 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) +* +* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) +* +********************************************************************************************/ + +#include "raylib.h" + +int main() +{ + int screenWidth = 800; + int screenHeight = 450; + + // Initialization + //--------------------------------------------------------- + InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing"); + //---------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //----------------------------------------------------- + // TODO: Update your variables here + //----------------------------------------------------- + + // Draw + //----------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + // TODO: draw some shapes... with names... :P +/* + void DrawPixel(int posX, int posY, Color color); // Draw a pixel + void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version) + void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line + void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version) + void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle + void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle + void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) + void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline + void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle + void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle + void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle + void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) + void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline + void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle + void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline + void DrawPoly(Vector2 *points, int numPoints, Color color); // Draw a closed polygon defined by points + void DrawPolyLine(Vector2 *points, int numPoints, Color color); // Draw polygon lines +*/ + 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); + + EndDrawing(); + //----------------------------------------------------- + } + + // De-Initialization + //--------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //---------------------------------------------------------- + + return 0; +} \ No newline at end of file diff --git a/examples/ex02b_basic_shapes.png b/examples/ex02b_basic_shapes.png new file mode 100644 index 00000000..f18ae044 Binary files /dev/null and b/examples/ex02b_basic_shapes.png differ diff --git a/examples/ex02b_shapes.c b/examples/ex02b_shapes.c deleted file mode 100644 index 5b9ad560..00000000 --- a/examples/ex02b_shapes.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************************* -* -* raylib example 02b - Draw basic shapes 2d (rectangle, circle, line...) -* -* 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) -* -* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - int screenWidth = 800; - int screenHeight = 450; - - // Initialization - //--------------------------------------------------------- - InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing"); - //---------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - // Update - //----------------------------------------------------- - // TODO: Update your variables here - //----------------------------------------------------- - - // Draw - //----------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - // TODO: draw some shapes... with names... :P -/* - void DrawPixel(int posX, int posY, Color color); // Draw a pixel - void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version) - void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line - void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version) - void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle - void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle - void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) - void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline - void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle - void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle - void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle - void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) - void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline - void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle - void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline - void DrawPoly(Vector2 *points, int numPoints, Color color); // Draw a closed polygon defined by points - void DrawPolyLine(Vector2 *points, int numPoints, Color color); // Draw polygon lines -*/ - 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); - - EndDrawing(); - //----------------------------------------------------- - } - - // De-Initialization - //--------------------------------------------------------- - CloseWindow(); // Close window and OpenGL context - //---------------------------------------------------------- - - return 0; -} \ No newline at end of file diff --git a/examples/ex04a_textures.c b/examples/ex04a_textures.c index e0457c0a..3a751322 100644 --- a/examples/ex04a_textures.c +++ b/examples/ex04a_textures.c @@ -38,7 +38,8 @@ int main() ClearBackground(RAYWHITE); - DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE); + DrawTexture(texture, screenWidth/2 - texture.width/2, + screenHeight/2 - texture.height/2, WHITE); DrawText("this IS a texture!", 360, 370, 10, 1, GRAY); @@ -48,7 +49,7 @@ int main() // De-Initialization //--------------------------------------------------------- - UnloadTexture(texture); // Texture unloading + UnloadTexture(texture); // Texture unloading CloseWindow(); // Close window and OpenGL context //---------------------------------------------------------- -- cgit v1.2.3