From 2c5e7f8db6bf276e9a60e93a34689d2fef84671c Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 2 Mar 2026 12:42:55 +0100 Subject: [PATCH] REVIEWED: example: `textures_clipboard_image` --- examples/textures/textures_clipboard_image.c | 57 ++++++++------------ 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/examples/textures/textures_clipboard_image.c b/examples/textures/textures_clipboard_image.c index 5cf87c1c2..aa955da2e 100644 --- a/examples/textures/textures_clipboard_image.c +++ b/examples/textures/textures_clipboard_image.c @@ -4,26 +4,25 @@ * * Example complexity rating: [★☆☆☆] 1/4 * -* Example originally created with raylib 5.5, last time updated with raylib 5.6 +* Example originally created with raylib 6.0, last time updated with raylib 6.0 * * Example contributed by Maicon Santana (@maiconpintoabreu) and reviewed by Ramon Santamaria (@raysan5) * * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software * -* Copyright (c) 2026-2026 Maicon Santana (@maiconpintoabreu) +* Copyright (c) 2026 Maicon Santana (@maiconpintoabreu) * ********************************************************************************************/ -#define RCORE_PLATFORM_RGFW #include "raylib.h" -#define MAX_IAMGE_COLLECTION_AMOUNT 1000 +#define MAX_TEXTURE_COLLECTION 20 -typedef struct ImageCollection { +typedef struct TextureCollection { Texture2D texture; Vector2 position; -} ImageCollection; +} TextureCollection; //------------------------------------------------------------------------------------ // Program main entry point @@ -37,7 +36,7 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [textures] example - clipboard_image"); - ImageCollection collection[MAX_IAMGE_COLLECTION_AMOUNT] = {0}; + TextureCollection collection[MAX_TEXTURE_COLLECTION] = { 0 }; int currentCollectionIndex = 0; SetTargetFPS(60); @@ -48,26 +47,19 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - // TODO: Update variables / Implement example logic at this point - //---------------------------------------------------------------------------------- - - if(IsKeyPressed(KEY_R)) + if (IsKeyPressed(KEY_R)) // Reset image collection { + // Unload textures to avoid memory leaks + for (int i = 0; i < MAX_TEXTURE_COLLECTION; i++) UnloadTexture(collection[i].texture); + currentCollectionIndex = 0; - - // Unload Texture to avoid Memory leak - for (int i=0;i