Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Added SetWindowOpacity(float opacity) #2254

Merged
merged 4 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/raylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ 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 SetWindowOpacity(float opacity); // Set window opacity, value opacity is between 0.0 and 1.0 (only PLATFORM_DESKTOP)
RLAPI void *GetWindowHandle(void); // Get native window handle
RLAPI int GetScreenWidth(void); // Get current screen width
RLAPI int GetScreenHeight(void); // Get current screen height
Expand Down
10 changes: 10 additions & 0 deletions src/rcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,16 @@ void SetWindowSize(int width, int height)
#endif
}

// Set window opacity, value opacity is between 0.0 and 1.0
void SetWindowOpacity (float opacity)
raysan5 marked this conversation as resolved.
Show resolved Hide resolved
{
#if defined(PLATFORM_DESKTOP)
if (opacity >= 1.0) opacity = 1.0;
raysan5 marked this conversation as resolved.
Show resolved Hide resolved
else if (opacity <= 0.0) opacity = 0.0;
glfwSetWindowOpacity(CORE.Window.handle, opacity);
#endif
}

// Get current screen width
int GetScreenWidth(void)
{
Expand Down