-
-
Save brendanzab/4773313 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); } | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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