Skip to content

Instantly share code, notes, and snippets.

@brendanzab
Forked from dpc/Makefile
Created February 12, 2013 20:55
Show Gist options
  • Save brendanzab/4773313 to your computer and use it in GitHub Desktop.
Save brendanzab/4773313 to your computer and use it in GitHub Desktop.
extern mod glfw3;
use glfw3;
use glfw3::*;
extern mod glfw;
fn os_thread() {
if (!glfw3::init()) {
die!(~"glfwInit() failed\n");
}
// Open a window and create its OpenGL context
let window = Window::create(800, 600, "Title", Windowed);
// Ensure we can capture the escape key being pressed below
window.set_input_mode(STICKY_KEYS, 1);
while ( window.get_key(KEY_ESC ) != PRESS && window.get_param(SHOULD_CLOSE) == 0 ) {
// Draw nothing, see you in tutorial 2 !
glfw3::poll_events();
// Swap buffers
window.swap_buffers();
}
}
fn main() {
do task::task().sched_mode(task::PlatformThread).spawn { os_thread(); }
}
RUSTC ?= rustc
#LOG_FLAGS ?= RUST_LOG=rustc::metadata::creader
all: glhex
run: all
./glhex
glhex: main.rs *.rs
$(LOG_FLAGS) $(RUSTC) -L glfw3/lib -o $@ $<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment