mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Rust format
This commit is contained in:
parent
0b2911ca30
commit
e89cb04189
|
@ -12,7 +12,12 @@ fn main() {
|
||||||
|
|
||||||
let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
|
let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
|
||||||
|
|
||||||
let mut window = Window::new("Noise Test - Press ESC to exit", WIDTH, HEIGHT, Scale::X1, Vsync::No).unwrap();
|
let mut window = Window::new("Noise Test - Press ESC to exit",
|
||||||
|
WIDTH,
|
||||||
|
HEIGHT,
|
||||||
|
Scale::X1,
|
||||||
|
Vsync::No)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
while window.update(&buffer) {
|
while window.update(&buffer) {
|
||||||
for i in buffer.iter_mut() {
|
for i in buffer.iter_mut() {
|
||||||
|
|
|
@ -9,8 +9,6 @@ use Scale;
|
||||||
use Vsync;
|
use Vsync;
|
||||||
use Key;
|
use Key;
|
||||||
|
|
||||||
//use Keys;
|
|
||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::os::windows::ffi::OsStrExt;
|
use std::os::windows::ffi::OsStrExt;
|
||||||
|
@ -261,7 +259,12 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(name: &str, width: usize, height: usize, scale: Scale, vsync: Vsync) -> Result<Window, &str> {
|
pub fn new(name: &str,
|
||||||
|
width: usize,
|
||||||
|
height: usize,
|
||||||
|
scale: Scale,
|
||||||
|
vsync: Vsync)
|
||||||
|
-> Result<Window, &str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let handle = Self::open_window(name, width, height, scale, vsync);
|
let handle = Self::open_window(name, width, height, scale, vsync);
|
||||||
|
|
||||||
|
@ -270,7 +273,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
let window = Window {
|
let window = Window {
|
||||||
dc: Some(user32::GetDC(handle)),
|
dc: Some(user32::GetDC(handle)),
|
||||||
window: Some(handle),
|
window: Some(handle),
|
||||||
keys: [false; 512],
|
keys: [false; 512],
|
||||||
buffer: Vec::new(),
|
buffer: Vec::new(),
|
||||||
|
|
Loading…
Reference in a new issue