summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorvitopigno <[email protected]>2023-08-04 12:04:19 +0200
committerGitHub <[email protected]>2023-08-04 12:04:19 +0200
commitd3058fe58972b80684591237c6358104f9e28ba0 (patch)
tree5d43abc9c967c2c20575d70c0871d18b016a4b1b /src
parent5b4aaf4eb1b848d023b3bac0ce7a8e34faab9ba1 (diff)
downloadraylib-d3058fe58972b80684591237c6358104f9e28ba0.tar.gz
raylib-d3058fe58972b80684591237c6358104f9e28ba0.zip
[CORE] Support for SetWindowTitle and InitWindow for web (#3222)
* Update raylib.h Changed SetWindowTitle's description * Update rcore.c SetWindowTitle now works on web * Update rcore.c InitWindow title now works with web platform too.
Diffstat (limited to 'src')
-rw-r--r--src/raylib.h2
-rw-r--r--src/rcore.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/raylib.h b/src/raylib.h
index 45a6120f..8b5a8070 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -954,7 +954,7 @@ RLAPI void MinimizeWindow(void); // Set window
RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
RLAPI void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
RLAPI void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
-RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP)
+RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window
RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
diff --git a/src/rcore.c b/src/rcore.c
index d5addad4..344e851f 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -1736,13 +1736,16 @@ void SetWindowIcons(Image *images, int count)
#endif
}
-// Set title for window (only PLATFORM_DESKTOP)
+// Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
void SetWindowTitle(const char *title)
{
CORE.Window.title = title;
#if defined(PLATFORM_DESKTOP)
glfwSetWindowTitle(CORE.Window.handle, title);
#endif
+#if defined(PLATFORM_WEB)
+ emscripten_set_window_title(title);
+#endif
}
// Set window position on screen (windowed mode)
@@ -4433,6 +4436,11 @@ static bool InitGraphicsDevice(int width, int height)
return false;
}
+// glfwCreateWindow title doesn't work with emscripten.
+#if defined(PLATFORM_WEB)
+ emscripten_set_window_title((CORE.Window.title != 0)? CORE.Window.title : " ");
+#endif
+
// Set window callback events
glfwSetWindowSizeCallback(CORE.Window.handle, WindowSizeCallback); // NOTE: Resizing not allowed by default!
#if !defined(PLATFORM_WEB)