From e197665e1dc3ec895b14b901884fee058dc1b4e9 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Tue, 2 May 2017 15:04:32 +0200 Subject: [PATCH] Added function to set window minimum dimensions... useful when using FLAG_WINDOW_RESIZABLE. --- src/core.c | 9 +++++++++ src/raylib.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/core.c b/src/core.c index 1bad2369..d7cf1f79 100644 --- a/src/core.c +++ b/src/core.c @@ -629,6 +629,15 @@ void SetWindowMonitor(int monitor) #endif } +// Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) +void SetWindowMinSize(int width, int height) +{ +#if defined(PLATFORM_DESKTOP) + const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + glfwSetWindowSizeLimits(window, width, height, mode->width, mode->height); +#endif +} + // Get current screen width int GetScreenWidth(void) { diff --git a/src/raylib.h b/src/raylib.h index 6f510f9f..3107661f 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -667,6 +667,7 @@ RLAPI void ToggleFullscreen(void); // Fullscreen RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP) 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 (fullscreen mode) +RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height