godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.45k stars 20.04k forks source link

Fullscreen mode's border color does not update when transparent background is disabled #93873

Open gokiburikin opened 2 months ago

gokiburikin commented 2 months ago

Tested versions

v4.3.dev6.official [89850d553] v4.3.beta2.official [b75f0485b]

System information

Godot v4.3.dev6 - Windows 10.0.19044 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.5161) - Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (16 Threads)

Issue description

I have transparency and borderless enabled on my main window for a splash screen which I then disable when the game loads, but Fullscreen mode which normally draws a 1 pixel border of clear color draws a transparent border instead despite disabling transparency.

I would expect the 1 pixel border to be the solid default clear color.

Steps to reproduce

1) Enable Transparency, Per Pixel Transparency, Borderless, and a transparent PNG splash screen in the project settings. 2) Run a script that disables Window.transparency and switches Window.mode to Fullscreen when the game loads.

The 1 pixel border is transparent instead of the clear color.

Oddly, if Transparency is disabled in the project settings and enabled when the game loads the border is also transparent even though I'd expect it to be black if it weren't being updated.

Minimal reproduction project (MRP)

transparent-splash-fullscreen-mrp.zip

Calinou commented 2 months ago

Can you check if https://github.com/godotengine/godot/pull/88734 fixes this issue?

gokiburikin commented 1 month ago

It does make the border black when transparent is disabled, but does not fix the issue. The border is still transparent if transparent is enabled in the project settings regardless of when I set it to false during runtime. Tried waiting frames, minimizing, maximizing, switching between modes, etc. It just never seems to draw the border again while in Fullscreen mode.

gokiburikin commented 1 month ago

A bit of an update here. I'm messing around with code I don't understand to try to figure out what might be happening and what I said isn't entirely accurate; a border is being drawn, but it's being drawn in a weird mode perhaps? If I change the black border to not-black it can clearly be seen, but it doesn't draw over stuff? Hard to explain so here are some examples.

My vertical taskbar with a Fullscreen, Transparent = false, Color(0,0,0,0) default clear color Godot window drawn over it CreatePen border with these colors `RGB(0, 0, 255)`, `RGB(255, 0, 0)`, `RGB(31, 63, 31)`, and `RGB(0, 0, 0)` ![mrp_1](https://github.com/godotengine/godot/assets/3820082/50501c86-d766-4513-b394-0343e0be79ab)

The screenshot above shows a transparent window for context, but this is what I see when transparency starts enabled, the default clear color is black, and I disable transparency before making the window Fullscreen:

Visual example of the issue with an RGB(31, 63, 31) border ![mrp_2](https://github.com/godotengine/godot/assets/3820082/a6254819-9e22-4fb8-8867-16c53ca4e23e)
gokiburikin commented 1 month ago

After more testing it appears as though changing HRGN hRgn = CreateRectRgn(0, 0, -1, -1); to HRGN hRgn = CreateRectRgn(0, 0, 0, 0); fixes the issue I'm experiencing. This only seems to work for setting Window.transparent = false though; Window.transparent_bg = false still leaves one of these weird borders.