Browse Source

SetWindowIcon() redesigned

Now core does not depend on textures module directly, only through text module.
pull/785/head
raysan5 6 years ago
parent
commit
a61d3ad512
1 changed files with 12 additions and 13 deletions
  1. +12
    -13
      src/core.c

+ 12
- 13
src/core.c View File

@ -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);
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 #endif
} }

Loading…
Cancel
Save