Last active
December 12, 2015 12:38
-
-
Save dpc/4773161 to your computer and use it in GitHub Desktop.
This file contains 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"); | |
} | |
window_hint(SAMPLES, 4); // 4x antialiasing | |
window_hint(CONTEXT_VERSION_MAJOR, VERSION_MAJOR); | |
window_hint(CONTEXT_VERSION_MINOR, VERSION_MINOR); | |
window_hint(OPENGL_PROFILE, OPENGL_CORE_PROFILE); //We don't want the old OpenGL | |
// Open a window and create its OpenGL context | |
let window = Window::create(800, 600, "Title", Windowed); | |
/* | |
// Initialize GLEW | |
glewExperimental=true; // Needed in core profile | |
if (glewInit() != GLEW_OK) { | |
die!("glewInit() failed\n"); | |
} | |
*/ | |
// window.set_title("Tutorial 01"); | |
// 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(OPENED) ) { | |
while (window.get_key(KEY_ESC) != PRESS) { | |
// Draw nothing, see you in tutorial 2 ! | |
// Swap buffers | |
window.swap_buffers(); | |
} // Check if the ESC key was pressed or the window was closed | |
} | |
fn main() { | |
do task::task().sched_mode(task::PlatformThread).spawn { os_thread(); } | |
} | |
This file contains 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