diff options
| author | Ray <[email protected]> | 2020-06-23 01:06:05 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-06-23 01:06:05 +0200 |
| commit | be80708d41bcf6805ba2a4031999011f52fdb9ad (patch) | |
| tree | 5bbdd3cf2fde0975ab6c25aa98c9d3a5f7817617 /examples/textures | |
| parent | 38530ebf12420ff3ad77825310bdb4c7c61bf928 (diff) | |
| download | raylib-be80708d41bcf6805ba2a4031999011f52fdb9ad.tar.gz raylib-be80708d41bcf6805ba2a4031999011f52fdb9ad.zip | |
REVIEWED: textures_raw_data #1286
Diffstat (limited to 'examples/textures')
| -rw-r--r-- | examples/textures/textures_raw_data.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/textures/textures_raw_data.c b/examples/textures/textures_raw_data.c index 08269bf7..99afd103 100644 --- a/examples/textures/textures_raw_data.c +++ b/examples/textures/textures_raw_data.c @@ -48,12 +48,16 @@ int main(void) } // Load pixels data into an image structure and create texture - Image checkedIm = LoadImageEx(pixels, width, height); + Image checkedIm = { + .data = pixels, // We can assign pixels directly to data + .width = width, + .height = height, + .format = UNCOMPRESSED_R8G8B8A8, + .mipmaps = 1 + }; + Texture2D checked = LoadTextureFromImage(checkedIm); - UnloadImage(checkedIm); // Unload CPU (RAM) image data - - // Dynamic memory must be freed after using it - free(pixels); // Unload CPU (RAM) pixels data + UnloadImage(checkedIm); // Unload CPU (RAM) image data (pixels) //--------------------------------------------------------------------------------------- // Main game loop |
