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

[rcore] [web] Adds SetWindowOpacity() implementation for PLATFORM_WEB #4403

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

asdqwe
Copy link
Contributor

@asdqwe asdqwe commented Oct 21, 2024

This implementation matches the desktop behavior: the whole canvas ("window") gets the opacity effect. It can be tested with:

#include "raylib.h"
int main(void) {
    InitWindow(800, 450, "test");
    SetTargetFPS(60);
    while (!WindowShouldClose()) {

        if (IsKeyPressed(KEY_ONE)) SetWindowOpacity(0.0f);
        if (IsKeyPressed(KEY_TWO)) SetWindowOpacity(0.5f);
        if (IsKeyPressed(KEY_THREE)) SetWindowOpacity(1.0f);

        BeginDrawing();
        ClearBackground(RAYWHITE);
        DrawText("test", 20, 20, 20, RED);
        EndDrawing();
    }
    CloseWindow();
    return 0;
}

@raysan5 raysan5 merged commit 9d0b1f0 into raysan5:master Oct 21, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Oct 21, 2024

@asdqwe oh! nice addition! thanks!

@asdqwe asdqwe deleted the add-setwindowopacity-web branch October 21, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants