mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Rename crate to glutin
This commit is contained in:
parent
3ac5f6d115
commit
02ba9d33d7
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "gl_init"
|
name = "glutin"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["tomaka <pierre.krieger1708@gmail.com>"]
|
authors = ["tomaka <pierre.krieger1708@gmail.com>"]
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ cargo test
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate init = "gl-init-rs";
|
extern crate glutin;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate gl;
|
extern crate gl;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let window = init::Window::new().unwrap();
|
let window = glutin::Window::new().unwrap();
|
||||||
|
|
||||||
unsafe { window.make_current() };
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#[phase(plugin, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate android_glue;
|
extern crate android_glue;
|
||||||
|
|
||||||
extern crate gl_init;
|
extern crate glutin;
|
||||||
|
|
||||||
use std::io::stdio::stdin;
|
use std::io::stdio::stdin;
|
||||||
|
|
||||||
|
@ -17,21 +17,21 @@ android_start!(main)
|
||||||
fn main() {
|
fn main() {
|
||||||
// enumerating monitors
|
// enumerating monitors
|
||||||
let monitor = {
|
let monitor = {
|
||||||
for (num, monitor) in gl_init::get_available_monitors().enumerate() {
|
for (num, monitor) in glutin::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 = gl_init::get_available_monitors().nth(num).expect("Please enter a valid ID");
|
let monitor = glutin::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 = gl_init::WindowBuilder::new()
|
let window = glutin::WindowBuilder::new()
|
||||||
.with_title("Hello world!".to_string())
|
.with_title("Hello world!".to_string())
|
||||||
.with_fullscreen(monitor)
|
.with_fullscreen(monitor)
|
||||||
.build()
|
.build()
|
||||||
|
@ -46,6 +46,6 @@ fn main() {
|
||||||
context.draw_frame((0.0, 1.0, 0.0, 1.0));
|
context.draw_frame((0.0, 1.0, 0.0, 1.0));
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
|
|
||||||
println!("{}", window.wait_events().collect::<Vec<gl_init::Event>>());
|
println!("{}", window.wait_events().collect::<Vec<glutin::Event>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#[phase(plugin, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate android_glue;
|
extern crate android_glue;
|
||||||
|
|
||||||
extern crate gl_init;
|
extern crate glutin;
|
||||||
|
|
||||||
mod support;
|
mod support;
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ mod support;
|
||||||
android_start!(main)
|
android_start!(main)
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let window1 = gl_init::Window::new().unwrap();
|
let window1 = glutin::Window::new().unwrap();
|
||||||
let window2 = gl_init::Window::new().unwrap();
|
let window2 = glutin::Window::new().unwrap();
|
||||||
let window3 = gl_init::Window::new().unwrap();
|
let window3 = glutin::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));
|
||||||
|
@ -30,7 +30,7 @@ fn main() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(window: gl_init::Window, color: (f32, f32, f32, f32)) {
|
fn run(window: glutin::Window, color: (f32, f32, f32, f32)) {
|
||||||
unsafe { window.make_current() };
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
let context = support::load(&window);
|
let context = support::load(&window);
|
||||||
|
@ -39,6 +39,6 @@ fn run(window: gl_init::Window, color: (f32, f32, f32, f32)) {
|
||||||
context.draw_frame(color);
|
context.draw_frame(color);
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
|
|
||||||
window.wait_events().collect::<Vec<gl_init::Event>>();
|
window.wait_events().collect::<Vec<glutin::Event>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#[phase(plugin)]
|
#[phase(plugin)]
|
||||||
extern crate gl_generator;
|
extern crate gl_generator;
|
||||||
|
|
||||||
use gl_init;
|
use glutin;
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
mod gl {
|
mod gl {
|
||||||
|
@ -18,7 +18,7 @@ pub struct Context {
|
||||||
gl: gl::Gl
|
gl: gl::Gl
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(window: &gl_init::Window) -> Context {
|
pub fn load(window: &glutin::Window) -> Context {
|
||||||
let gl = gl::Gl::load_with(|symbol| window.get_proc_address(symbol));
|
let gl = gl::Gl::load_with(|symbol| window.get_proc_address(symbol));
|
||||||
|
|
||||||
let version = {
|
let version = {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#[phase(plugin, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate android_glue;
|
extern crate android_glue;
|
||||||
|
|
||||||
extern crate gl_init;
|
extern crate glutin;
|
||||||
|
|
||||||
mod support;
|
mod support;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ mod support;
|
||||||
android_start!(main)
|
android_start!(main)
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let window = gl_init::Window::new().unwrap();
|
let window = glutin::Window::new().unwrap();
|
||||||
|
|
||||||
unsafe { window.make_current() };
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
|
@ -23,6 +23,6 @@ fn main() {
|
||||||
context.draw_frame((0.0, 1.0, 0.0, 1.0));
|
context.draw_frame((0.0, 1.0, 0.0, 1.0));
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
|
|
||||||
println!("{}", window.wait_events().collect::<Vec<gl_init::Event>>());
|
println!("{}", window.wait_events().collect::<Vec<glutin::Event>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue