mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
d2fe8c0469
* 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>
43 lines
951 B
Rust
43 lines
951 B
Rust
use minifb::{Key, Scale, Window, WindowOptions};
|
|
|
|
fn main() {
|
|
let width = 640;
|
|
let height = 320;
|
|
let mut buffer = vec![0u32; width * height];
|
|
let mut double = Window::new(
|
|
"Larger",
|
|
width,
|
|
height,
|
|
WindowOptions {
|
|
scale: Scale::X2,
|
|
..WindowOptions::default()
|
|
},
|
|
)
|
|
.unwrap();
|
|
|
|
let mut orig = Window::new(
|
|
"Smaller",
|
|
width,
|
|
height,
|
|
WindowOptions {
|
|
..WindowOptions::default()
|
|
},
|
|
)
|
|
.unwrap();
|
|
|
|
let mut pos = 13;
|
|
|
|
while orig.is_open()
|
|
&& double.is_open()
|
|
&& !orig.is_key_down(Key::Escape)
|
|
&& !double.is_key_down(Key::Escape)
|
|
{
|
|
orig.update_with_buffer(&buffer, width, height).unwrap();
|
|
double.update_with_buffer(&buffer, width, height).unwrap();
|
|
pos += 7;
|
|
pos *= 13;
|
|
pos %= buffer.len();
|
|
buffer[pos] = 0xff_ff_ff;
|
|
}
|
|
}
|