summaryrefslogtreecommitdiffhomepage
path: root/examples/src/textures/textures_image_drawing.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/textures/textures_image_drawing.c')
-rw-r--r--examples/src/textures/textures_image_drawing.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/src/textures/textures_image_drawing.c b/examples/src/textures/textures_image_drawing.c
index b179612..f5c3c85 100644
--- a/examples/src/textures/textures_image_drawing.c
+++ b/examples/src/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);
//---------------------------------------------------------------------------------------