summaryrefslogtreecommitdiffhomepage
path: root/examples/textures/textures_image_drawing.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-20 16:36:42 +0200
committerRay <[email protected]>2019-05-20 16:36:42 +0200
commitb525039e0ab8bcaa2fd6bde34c72a6405f88ae49 (patch)
tree08f1c79bfe693643564ed78202c9474b7eb83a79 /examples/textures/textures_image_drawing.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/textures/textures_image_drawing.c')
-rw-r--r--examples/textures/textures_image_drawing.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/textures/textures_image_drawing.c b/examples/textures/textures_image_drawing.c
index b179612d..f5c3c85d 100644
--- a/examples/textures/textures_image_drawing.c
+++ b/examples/textures/textures_image_drawing.c
@@ -13,12 +13,12 @@
#include "raylib.h"
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image drawing");
@@ -28,26 +28,26 @@ int main()
ImageCrop(&cat, (Rectangle){ 100, 10, 280, 380 }); // Crop an image piece
ImageFlipHorizontal(&cat); // Flip cropped image horizontally
ImageResize(&cat, 150, 200); // Resize flipped-cropped image
-
+
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
-
+
// Draw one image over the other with a scaling of 1.5f
ImageDraw(&parrots, cat, (Rectangle){ 0, 0, cat.width, cat.height }, (Rectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f });
ImageCrop(&parrots, (Rectangle){ 0, 50, parrots.width, parrots.height - 100 }); // Crop resulting image
-
+
UnloadImage(cat); // Unload image from RAM
-
+
// Load custom font for frawing on image
Font font = LoadFont("resources/custom_jupiter_crash.png");
-
+
// Draw over image using custom font
ImageDrawTextEx(&parrots, (Vector2){ 300, 230 }, font, "PARROTS & CAT", font.baseSize, -2, WHITE);
-
+
UnloadFont(font); // Unload custom spritefont (already drawn used on image)
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
-
+
SetTargetFPS(60);
//---------------------------------------------------------------------------------------