SetWindowIcon() redesigned
Now core does not depend on textures module directly, only through text module.
This commit is contained in:
parent
29d1323bd1
commit
a61d3ad512
17
src/core.c
17
src/core.c
@ -780,24 +780,23 @@ void ToggleFullscreen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set icon for window (only PLATFORM_DESKTOP)
|
// Set icon for window (only PLATFORM_DESKTOP)
|
||||||
|
// NOTE: Image must be in RGBA format, 8bit per channel
|
||||||
void SetWindowIcon(Image image)
|
void SetWindowIcon(Image image)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
Image imicon = ImageCopy(image);
|
if (image.format == UNCOMPRESSED_R8G8B8A8)
|
||||||
ImageFormat(&imicon, UNCOMPRESSED_R8G8B8A8);
|
{
|
||||||
|
|
||||||
GLFWimage icon[1] = { 0 };
|
GLFWimage icon[1] = { 0 };
|
||||||
|
|
||||||
icon[0].width = imicon.width;
|
icon[0].width = image.width;
|
||||||
icon[0].height = imicon.height;
|
icon[0].height = image.height;
|
||||||
icon[0].pixels = (unsigned char *)imicon.data;
|
icon[0].pixels = (unsigned char *)image.data;
|
||||||
|
|
||||||
// NOTE 1: We only support one image icon
|
// NOTE 1: We only support one image icon
|
||||||
// NOTE 2: The specified image data is copied before this function returns
|
// NOTE 2: The specified image data is copied before this function returns
|
||||||
glfwSetWindowIcon(window, 1, icon);
|
glfwSetWindowIcon(window, 1, icon);
|
||||||
|
}
|
||||||
// TODO: Support multi-image icons --> image.mipmaps
|
else TraceLog(LOG_WARNING, "Window icon image must be in R8G8B8A8 pixel format");
|
||||||
UnloadImage(imicon);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user