aboutsummaryrefslogtreecommitdiff
path: root/examples/textures_raw_data.c
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2015-09-01 22:59:16 +0200
committerraysan5 <raysan5@gmail.com>2015-09-01 22:59:16 +0200
commite5fe2c216ec92d6ec2205fac10023b5a304f6f26 (patch)
treec4d3927e89ae40ebbeabbfffdaed80e9d7ab0968 /examples/textures_raw_data.c
parente93475d854279a99dc2cf296f8c9827bc2c36c09 (diff)
downloadraylib-e5fe2c216ec92d6ec2205fac10023b5a304f6f26.tar.gz
raylib-e5fe2c216ec92d6ec2205fac10023b5a304f6f26.zip
Added some comments to examples
Diffstat (limited to 'examples/textures_raw_data.c')
-rw-r--r--examples/textures_raw_data.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/textures_raw_data.c b/examples/textures_raw_data.c
index a4ff71b3..d1922180 100644
--- a/examples/textures_raw_data.c
+++ b/examples/textures_raw_data.c
@@ -35,6 +35,7 @@ int main()
int width = 1024;
int height = 1024;
+ // Dynamic memory allocation to store pixels data (Color type)
Color *pixels = (Color *)malloc(width*height*sizeof(Color));
for (int y = 0; y < height; y++)
@@ -50,6 +51,8 @@ int main()
Image checkedIm = LoadImageEx(pixels, width, height);
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
//---------------------------------------------------------------------------------------