Skip to content

Commit 8be888e

Browse files
committed
Catch up rust update
1. `libnative` has been removed from the rust standard library Please consult rust-lang/rfcs#230 2. Updated project dependencies 3. Apply `glfw-rs` API update
1 parent 2506b2b commit 8be888e

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

Cargo.lock

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
extern crate gl;
44
extern crate glfw;
5-
extern crate native;
65

76
use std::mem;
87
use std::ptr;
@@ -57,22 +56,16 @@ static FS_SRC: &'static str = r#"
5756
"#;
5857

5958

60-
#[start]
61-
fn start(argc: int, argv: *const *const u8) -> int {
62-
// Run GLFW on the main thread
63-
native::start(argc, argv, main)
64-
}
65-
6659
fn main() {
6760
let glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
6861

6962
// Choose a GL profile
70-
glfw.window_hint(glfw::ContextVersion(3, 2));
71-
glfw.window_hint(glfw::OpenglForwardCompat(true));
72-
glfw.window_hint(glfw::OpenglProfile(glfw::OpenGlCoreProfile));
63+
glfw.window_hint(glfw::WindowHint::ContextVersion(3, 2));
64+
glfw.window_hint(glfw::WindowHint::OpenglForwardCompat(true));
65+
glfw.window_hint(glfw::WindowHint::OpenglProfile(glfw::OpenGlProfileHint::Core));
7366

7467
// Create Window
75-
let (window, events) = glfw.create_window(1024, 768, "Stainless", glfw::Windowed)
68+
let (window, events) = glfw.create_window(1024, 768, "Stainless", glfw::WindowMode::Windowed)
7669
.expect("Failed to create GLFW window.");
7770

7871
// Window configuration
@@ -215,7 +208,7 @@ fn link_program(vs: GLuint, fs: GLuint) -> GLuint {
215208
fn handle_window_event(window: &glfw::Window, event: glfw::WindowEvent) {
216209
println!("{}", event);
217210
match event {
218-
glfw::KeyEvent(glfw::KeyEscape, _, glfw::Press, _) => {
211+
glfw::WindowEvent::Key(glfw::Key::Escape, _, glfw::Action::Press, _) => {
219212
window.set_should_close(true)
220213
}
221214
_ => {}

0 commit comments

Comments
 (0)