summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarco Lizza <[email protected]>2019-01-10 14:55:19 +0100
committerMarco Lizza <[email protected]>2019-01-10 14:55:19 +0100
commita15251bcdbcf5f89af3a5b2189aafcc8444948ab (patch)
tree96803613c382551976b73f41dea4195185c88a76
parent5adcc30a2e3984d2df59e228c9360edf47f63c7a (diff)
downloadraylib-a15251bcdbcf5f89af3a5b2189aafcc8444948ab.tar.gz
raylib-a15251bcdbcf5f89af3a5b2189aafcc8444948ab.zip
Adding window visibility functions.
-rw-r--r--src/core.c18
-rw-r--r--src/raylib.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index b34afeff..36d71fd7 100644
--- a/src/core.c
+++ b/src/core.c
@@ -831,6 +831,24 @@ void SetWindowSize(int width, int height)
#endif
}
+// Set window visibility
+void SetWindowVisible(bool visible)
+{
+#if defined(PLATFORM_DESKTOP)
+ if (visible) glfwShowWindow(window);
+ else glfwHideWindow(window);
+#endif
+}
+
+// Set window visibility
+bool IsWindowVisible()
+{
+#if defined(PLATFORM_DESKTOP)
+ return glfwGetWindowAttrib(window, GLFW_VISIBLE) != GL_FALSE;
+#endif
+ return true;
+}
+
// Get current screen width
int GetScreenWidth(void)
{
diff --git a/src/raylib.h b/src/raylib.h
index 9e254f97..0eda48c3 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -827,6 +827,8 @@ RLAPI void SetWindowPosition(int x, int y); // Set window
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 void SetWindowSize(int width, int height); // Set window dimensions
+RLAPI void SetWindowVisible(bool visible); // Set window visibility
+RLAPI bool IsWindowVisible(); // Check if window is currently visible
RLAPI int GetScreenWidth(void); // Get current screen width
RLAPI int GetScreenHeight(void); // Get current screen height
RLAPI void *GetWindowHandle(void); // Get native window handle