diff --git a/src/raylib.h b/src/raylib.h index 70384e281..3fb034759 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -903,6 +903,7 @@ extern "C" { // Prevents name mangling of functions // Window-related functions RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context +RLAPI void InitWindowAt(int width, int height, int x, int y, const char* title); // Initialize window and OpenGL with an instance position (only PLATFORM_DESKTOP) RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed RLAPI void CloseWindow(void); // Close window and unload OpenGL context RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully diff --git a/src/rcore.c b/src/rcore.c index f0652d3bb..5aeabba8b 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -920,6 +920,17 @@ void InitWindow(int width, int height, const char *title) #endif // PLATFORM_DESKTOP || PLATFORM_WEB || PLATFORM_RPI || PLATFORM_DRM } +// Initialize window and OpenGL with an instance position (only PLATFORM_DESKTOP) +void InitWindowAt(int width, int height, int x, int y, const char* title) +{ +#if defined(PLATFORM_DESKTOP) + SetConfigFlags(FLAG_WINDOW_HIDDEN); + InitWindow(width, height, title); + SetWindowPosition(x, y); + glfwShowWindow(CORE.Window.handle); +#endif +} + // Close window and unload OpenGL context void CloseWindow(void) {