QuantumBadger / Speedy2D

Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.
Apache License 2.0
386 stars 42 forks source link

Window Transparency not working #114

Open Airyzz opened 4 months ago

Airyzz commented 4 months ago

I am currently testing latest commit in master (ba5abfc) and window transparency no longer works:

image

Testing the same code but using commit b0f000d it works fine. I think it was introduced in 3159dd1

use speedy2d::color::Color;
use speedy2d::dimen::Vector2;
use speedy2d::window::{WindowCreationOptions, WindowHandler, WindowHelper};
use speedy2d::{Graphics2D, Window};

fn main() {
    let window = Window::new_with_options(
        "Title",
        WindowCreationOptions::new_windowed(
            speedy2d::window::WindowSize::PhysicalPixels(Vector2::new(500, 500)),
            None,
        )
        .with_always_on_top(true)
        .with_transparent(true),
    )
    .unwrap();
    window.run_loop(MyWindowHandler {});
}

struct MyWindowHandler {}

impl WindowHandler for MyWindowHandler {
    fn on_draw(&mut self, helper: &mut WindowHelper, graphics: &mut Graphics2D) {
        graphics.clear_screen(Color::from_rgba(0.0, 0.0, 0.0, 0.0));
        graphics.draw_circle((100.0, 100.0), 75.0, Color::BLUE);
        helper.request_redraw();
    }
}