Skip to content

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

Merged
raysan5 merged 1 commit intomasterfrom
unknown repository
Oct 21, 2024
Merged

[rcore] [web] Adds SetWindowOpacity() implementation for PLATFORM_WEB#4403
raysan5 merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost 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
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented Oct 21, 2024

@asdqwe oh! nice addition! thanks!

@ghost ghost deleted the add-setwindowopacity-web branch October 21, 2024 11:58
psxdev pushed a commit to raylib4Consoles/raylib that referenced this pull request Nov 18, 2024
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.

1 participant