aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2019-03-16 13:00:46 +0100
committerraysan5 <raysan5@gmail.com>2019-03-16 13:00:46 +0100
commita61d3ad5122e860e21211c8bacd30f560d71f3da (patch)
tree45064e08a0fd77469bedd8554973bfb62cfff920 /src
parent29d1323bd12b0c8155d8c2a9c2830a002ebc608b (diff)
downloadraylib-a61d3ad5122e860e21211c8bacd30f560d71f3da.tar.gz
raylib-a61d3ad5122e860e21211c8bacd30f560d71f3da.zip
SetWindowIcon() redesigned
Now core does not depend on textures module directly, only through text module.
Diffstat (limited to 'src')
-rw-r--r--src/core.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core.c b/src/core.c
index 2018b3b0..aab60f13 100644
--- a/src/core.c
+++ b/src/core.c
@@ -780,24 +780,23 @@ void ToggleFullscreen(void)
}
// Set icon for window (only PLATFORM_DESKTOP)
+// NOTE: Image must be in RGBA format, 8bit per channel
void SetWindowIcon(Image image)
{
#if defined(PLATFORM_DESKTOP)
- Image imicon = ImageCopy(image);
- ImageFormat(&imicon, UNCOMPRESSED_R8G8B8A8);
-
- GLFWimage icon[1] = { 0 };
-
- icon[0].width = imicon.width;
- icon[0].height = imicon.height;
- icon[0].pixels = (unsigned char *)imicon.data;
+ if (image.format == UNCOMPRESSED_R8G8B8A8)
+ {
+ GLFWimage icon[1] = { 0 };
- // NOTE 1: We only support one image icon
- // NOTE 2: The specified image data is copied before this function returns
- glfwSetWindowIcon(window, 1, icon);
+ icon[0].width = image.width;
+ icon[0].height = image.height;
+ icon[0].pixels = (unsigned char *)image.data;
- // TODO: Support multi-image icons --> image.mipmaps
- UnloadImage(imicon);
+ // NOTE 1: We only support one image icon
+ // NOTE 2: The specified image data is copied before this function returns
+ glfwSetWindowIcon(window, 1, icon);
+ }
+ else TraceLog(LOG_WARNING, "Window icon image must be in R8G8B8A8 pixel format");
#endif
}