greenfork / nimraylib_now

The Ultimate Raylib gaming library wrapper for Nim
MIT License
149 stars 16 forks source link

Black Window with `WINDOW_TRANSPARENT` #77

Open qb-0 opened 2 years ago

qb-0 commented 2 years ago

Heya,

I don't get a transparent framebuffer with the window state. Not sure if it's a issue on my end, a issue with raylib itself or with the wrapper.

echo isWindowState(WINDOW_TRANSPARENT) returns false

import nimraylib_now

const screenWidth = 1000
const screenHeight = 1000

setWindowState(WINDOW_TRANSPARENT)
initWindow screenWidth, screenHeight, "Window"

while not windowShouldClose():
    drawLine 500, 0, 500, getScreenHeight(), fade(LIGHTGRAY, 0.6)
    echo isWindowState(WINDOW_TRANSPARENT)
    clearBackground Blank
    endDrawing()
closeWindow()

Bildschirmfoto vom 2022-06-04 07-09-07

greenfork commented 2 years ago

You can use core_window_flags example as a reference https://github.com/greenfork/nimraylib_now/blob/3207f457be0f3204df15a1367111159d3c888c4c/examples/core/core_window_flags.nim#L37

adding or WindowTransparent to the list activates transparency. For me it is also black screen.

You can check the C version as well https://github.com/raysan5/raylib/blob/0851960397f02a477d80eda2239f90fae14dec64/examples/core/core_window_flags.c#L39

adding | FLAG_WINDOW_TRANSPARENT will activate transparency. Compiles with gcc -lraylib -lm core_window_flags.c on Linux. For me same effect - black screen.

I suppose this is a question for a general topic on discord, I saw that you asked it in a Nim-specific channel.