rust_minifb/examples/transparent.rs
Antonino Siena d2fe8c0469
Transparency (#164)
* Add transparency field to WindowOptions

* Add transparency example

* Implement transparency on Wayland

* Improvements

* [WIP] X11 transparency

* Restructure

* Redox implement transparency

* Update src/lib.rs

Co-Authored-By: Cole Helbling <cole.e.helbling@outlook.com>

* Rust-2018 changes

* Fixed issue

* cargo fmt

* [WIP] Implement alpha transparency for windows

* Staging Windows code

* Transparency is currently unimplemented on Windows

* Add note

* Dont use assertions

* Correction

Co-authored-by: Antonino Siena <a.siena@gmx.de>
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2020-04-15 15:11:23 +02:00

25 lines
617 B
Rust

use minifb::{Key, ScaleMode, Window, WindowOptions};
fn main() {
// Allocate the output buffer.
let buf = vec![0x00AAFF33; 320 * 480];
let mut window = Window::new(
"Press ESC to exit",
320,
480,
WindowOptions {
resize: true,
scale_mode: ScaleMode::Center,
borderless: true,
transparency: true,
..WindowOptions::default()
},
)
.expect("Unable to open Window");
while window.is_open() && !window.is_key_down(Key::Escape) {
window.update_with_buffer(&buf, 320, 480).unwrap();
}
}