aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2017-02-05 03:00:35 +0100
committerraysan5 <raysan5@gmail.com>2017-02-05 03:00:35 +0100
commitc4bd214cf07c68476c4ce972766c24ee54a982f6 (patch)
treea9005c0a74aedb6c627ff89d161f913888e3783f /src
parent1a879ba08efe1877c26a76bfabd43f282d2b2a97 (diff)
downloadraylib-c4bd214cf07c68476c4ce972766c24ee54a982f6.tar.gz
raylib-c4bd214cf07c68476c4ce972766c24ee54a982f6.zip
Added function SetWindowIcon()
Only DESKTOP platforms (Windows, Linus, OSX)
Diffstat (limited to 'src')
-rw-r--r--src/core.c21
-rw-r--r--src/raylib.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index 4ce32a05..04dd0540 100644
--- a/src/core.c
+++ b/src/core.c
@@ -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