mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 05:21:31 +11:00
parent
cd3fc3075a
commit
ca83db39c7
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "gl-init-rs"
|
name = "gl_init"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["tomaka <pierre.krieger1708@gmail.com>"]
|
authors = ["tomaka <pierre.krieger1708@gmail.com>"]
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
extern crate init = "gl-init-rs";
|
|
||||||
extern crate libc;
|
|
||||||
extern crate gl;
|
extern crate gl;
|
||||||
|
extern crate gl_init;
|
||||||
|
extern crate libc;
|
||||||
|
|
||||||
use std::io::stdio::stdin;
|
use std::io::stdio::stdin;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// enumerating monitors
|
// enumerating monitors
|
||||||
let monitor = {
|
let monitor = {
|
||||||
for (num, monitor) in init::get_available_monitors().enumerate() {
|
for (num, monitor) in gl_init::get_available_monitors().enumerate() {
|
||||||
println!("Monitor #{}: {}", num, monitor.get_name());
|
println!("Monitor #{}: {}", num, monitor.get_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
print!("Please write the number of the monitor to use: ");
|
print!("Please write the number of the monitor to use: ");
|
||||||
let num = from_str(stdin().read_line().unwrap().as_slice().trim())
|
let num = from_str(stdin().read_line().unwrap().as_slice().trim())
|
||||||
.expect("Plase enter a number");
|
.expect("Plase enter a number");
|
||||||
let monitor = init::get_available_monitors().nth(num).expect("Please enter a valid ID");
|
let monitor = gl_init::get_available_monitors().nth(num).expect("Please enter a valid ID");
|
||||||
|
|
||||||
println!("Using {}", monitor.get_name());
|
println!("Using {}", monitor.get_name());
|
||||||
|
|
||||||
monitor
|
monitor
|
||||||
};
|
};
|
||||||
|
|
||||||
let window = init::WindowBuilder::new()
|
let window = gl_init::WindowBuilder::new()
|
||||||
.with_title("Hello world!".to_string())
|
.with_title("Hello world!".to_string())
|
||||||
.with_fullscreen(monitor)
|
.with_fullscreen(monitor)
|
||||||
.build()
|
.build()
|
||||||
|
@ -49,6 +49,6 @@ fn main() {
|
||||||
gl::Clear(gl::COLOR_BUFFER_BIT);
|
gl::Clear(gl::COLOR_BUFFER_BIT);
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
|
|
||||||
println!("{}", window.wait_events().collect::<Vec<init::Event>>());
|
println!("{}", window.wait_events().collect::<Vec<gl_init::Event>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
extern crate init = "gl-init-rs";
|
|
||||||
extern crate libc;
|
|
||||||
extern crate gl;
|
extern crate gl;
|
||||||
|
extern crate gl_init;
|
||||||
|
extern crate libc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let window1 = init::Window::new().unwrap();
|
let window1 = gl_init::Window::new().unwrap();
|
||||||
let window2 = init::Window::new().unwrap();
|
let window2 = gl_init::Window::new().unwrap();
|
||||||
let window3 = init::Window::new().unwrap();
|
let window3 = gl_init::Window::new().unwrap();
|
||||||
|
|
||||||
spawn(proc() {
|
spawn(proc() {
|
||||||
run(window1, (0.0, 1.0, 0.0, 1.0));
|
run(window1, (0.0, 1.0, 0.0, 1.0));
|
||||||
|
@ -20,7 +20,7 @@ fn main() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(window: init::Window, color: (f32, f32, f32, f32)) {
|
fn run(window: gl_init::Window, color: (f32, f32, f32, f32)) {
|
||||||
unsafe { window.make_current() };
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
gl::load_with(|symbol| window.get_proc_address(symbol));
|
gl::load_with(|symbol| window.get_proc_address(symbol));
|
||||||
|
@ -36,6 +36,6 @@ fn run(window: init::Window, color: (f32, f32, f32, f32)) {
|
||||||
gl::Clear(gl::COLOR_BUFFER_BIT);
|
gl::Clear(gl::COLOR_BUFFER_BIT);
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
|
|
||||||
window.wait_events().collect::<Vec<init::Event>>();
|
window.wait_events().collect::<Vec<gl_init::Event>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
extern crate init = "gl-init-rs";
|
|
||||||
extern crate libc;
|
|
||||||
extern crate gl;
|
extern crate gl;
|
||||||
|
extern crate gl_init;
|
||||||
|
extern crate libc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let window = init::Window::new().unwrap();
|
let window = gl_init::Window::new().unwrap();
|
||||||
|
|
||||||
unsafe { window.make_current() };
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ fn main() {
|
||||||
gl::Clear(gl::COLOR_BUFFER_BIT);
|
gl::Clear(gl::COLOR_BUFFER_BIT);
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
|
|
||||||
println!("{}", window.wait_events().collect::<Vec<init::Event>>());
|
println!("{}", window.wait_events().collect::<Vec<gl_init::Event>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue