mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-18 01:08:17 +00:00
[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.
This commit is contained in:
10
src/rcore.c
10
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)
|
||||
|
Reference in New Issue
Block a user