Commit 6a25f348 authored by Steven vanZyl's avatar Steven vanZyl Committed by Jeremy Soller

Added get_display_size (#16)

parent 203e5575
......@@ -15,6 +15,10 @@ pub use window::Window;
pub mod color;
pub mod event;
//TODO replace this with a mod.rs file
#[path="orbital/display.rs"]
pub mod display;
#[cfg(target_os = "redox")]
#[path="orbital/window.rs"]
pub mod window;
......
#[cfg(target_os = "redox")]
pub fn get_display_size() -> (i32, i32) {
match File::open("display:") {
Ok(display) => {
let path = display.path().map(|path| path.into_os_string().into_string().unwrap_or(String::new())).unwrap_or(String::new());
let res = path.split(":").nth(1).unwrap_or("");
let width = res.split("/").nth(0).unwrap_or("").parse::<i32>().unwrap_or(0);
let height = res.split("/").nth(1).unwrap_or("").parse::<i32>().unwrap_or(0);
(width, height)
},
Err(err) => panic!("launcher: failed to get display size: {}", err)
}
}
#[cfg(not(target_os = "redox"))]
pub fn get_display_size() -> (i32, i32) {
panic!("launcher: failed to get display size")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment