Skip to content

Commit

Permalink
Catch up rust update
Browse files Browse the repository at this point in the history
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
  • Loading branch information
simnalamburt committed Dec 3, 2014
1 parent 2506b2b commit 8be888e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

extern crate gl;
extern crate glfw;
extern crate native;

use std::mem;
use std::ptr;
Expand Down Expand Up @@ -57,22 +56,16 @@ static FS_SRC: &'static str = r#"
"#;


#[start]
fn start(argc: int, argv: *const *const u8) -> int {
// Run GLFW on the main thread
native::start(argc, argv, main)
}

fn main() {
let glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();

// Choose a GL profile
glfw.window_hint(glfw::ContextVersion(3, 2));
glfw.window_hint(glfw::OpenglForwardCompat(true));
glfw.window_hint(glfw::OpenglProfile(glfw::OpenGlCoreProfile));
glfw.window_hint(glfw::WindowHint::ContextVersion(3, 2));
glfw.window_hint(glfw::WindowHint::OpenglForwardCompat(true));
glfw.window_hint(glfw::WindowHint::OpenglProfile(glfw::OpenGlProfileHint::Core));

// Create Window
let (window, events) = glfw.create_window(1024, 768, "Stainless", glfw::Windowed)
let (window, events) = glfw.create_window(1024, 768, "Stainless", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");

// Window configuration
Expand Down Expand Up @@ -215,7 +208,7 @@ fn link_program(vs: GLuint, fs: GLuint) -> GLuint {
fn handle_window_event(window: &glfw::Window, event: glfw::WindowEvent) {
println!("{}", event);
match event {
glfw::KeyEvent(glfw::KeyEscape, _, glfw::Press, _) => {
glfw::WindowEvent::Key(glfw::Key::Escape, _, glfw::Action::Press, _) => {
window.set_should_close(true)
}
_ => {}
Expand Down

0 comments on commit 8be888e

Please sign in to comment.