Created
April 26, 2014 15:12
-
-
Save larsbergstrom/11322558 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
| pub extern "C" fn display_callback() { | |
| local_data::get(display_tls_key, |callback| { | |
| callback.as_ref().map(|&ref cb| { | |
| cb.call(); | |
| }); | |
| }); | |
| } | |
| pub fn display_func(callback: ~DisplayCallback) { | |
| local_data::set(display_tls_key, callback); | |
| unsafe { | |
| glutDisplayFunc(display_callback); | |
| } | |
| } |
Author
larsbergstrom
commented
Apr 26, 2014
Author
pub trait DisplayCallback { fn call(&self); }
local_data_key!(display_tls_key: ~DisplayCallback)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment