diff options
| author | raysan5 <raysan5@gmail.com> | 2017-02-05 03:00:35 +0100 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2017-02-05 03:00:35 +0100 |
| commit | c4bd214cf07c68476c4ce972766c24ee54a982f6 (patch) | |
| tree | a9005c0a74aedb6c627ff89d161f913888e3783f /src | |
| parent | 1a879ba08efe1877c26a76bfabd43f282d2b2a97 (diff) | |
| download | raylib-c4bd214cf07c68476c4ce972766c24ee54a982f6.tar.gz raylib-c4bd214cf07c68476c4ce972766c24ee54a982f6.zip | |
Added function SetWindowIcon()
Only DESKTOP platforms (Windows, Linus, OSX)
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 21 | ||||
| -rw-r--r-- | src/raylib.h | 1 |
2 files changed, 21 insertions, 1 deletions
@@ -524,7 +524,7 @@ bool IsWindowMinimized(void) #endif } -// Fullscreen toggle +// Fullscreen toggle (only PLATFORM_DESKTOP) void ToggleFullscreen(void) { #if defined(PLATFORM_DESKTOP) @@ -540,6 +540,25 @@ void ToggleFullscreen(void) #endif } +// Set icon for window (only PLATFORM_DESKTOP) +void SetWindowIcon(Image image) +{ +#if defined(PLATFORM_DESKTOP) + ImageFormat(&image, UNCOMPRESSED_R8G8B8A8); + + GLFWimage icon[1]; + + icon[0].width = image.width; + icon[0].height = image.height; + icon[0].pixels = (unsigned char *)image.data; + + // NOTE: We only support one image icon + glfwSetWindowIcon(window, 1, icon); + + // TODO: Support multi-image icons --> image.mipmaps +#endif +} + // Get current screen width int GetScreenWidth(void) { diff --git a/src/raylib.h b/src/raylib.h index f5b908db..5a1304fc 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -638,6 +638,7 @@ RLAPI void CloseWindow(void); // Close Windo RLAPI bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed RLAPI bool IsWindowMinimized(void); // Detect if window has been minimized (or lost focus) RLAPI void ToggleFullscreen(void); // Fullscreen toggle (only PLATFORM_DESKTOP) +RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP) RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height |
