Преглед на файлове

[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.
pull/3224/head
vitopigno преди 1 година
committed by GitHub
родител
ревизия
d3058fe589
No known key found for this signature in database GPG ключ ID: 4AEE18F83AFDEB23
променени са 2 файла, в които са добавени 10 реда и са изтрити 2 реда
  1. +1
    -1
      src/raylib.h
  2. +9
    -1
      src/rcore.c

+ 1
- 1
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)

+ 9
- 1
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)

Зареждане…
Отказ
Запис