diff options
| author | raysan5 <raysan5@gmail.com> | 2019-03-16 13:00:46 +0100 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2019-03-16 13:00:46 +0100 |
| commit | a61d3ad5122e860e21211c8bacd30f560d71f3da (patch) | |
| tree | 45064e08a0fd77469bedd8554973bfb62cfff920 /src | |
| parent | 29d1323bd12b0c8155d8c2a9c2830a002ebc608b (diff) | |
| download | raylib-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.c | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -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 } |
