Added Retina support

Closes https://github.com/AngryLawyer/rust-sdl2/issues/164
This commit is contained in:
Sven Nilsen
2014-08-16 10:11:34 +02:00
parent e195ada381
commit b0557762c9
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -20,3 +20,5 @@ src/sdl2/generated/
src/demo/main
doc/
target/
Cargo.lock
+8
View File
@@ -165,6 +165,7 @@ pub mod ll {
pub fn SDL_IsScreenSaverEnabled() -> SDL_bool;
pub fn SDL_EnableScreenSaver();
pub fn SDL_DisableScreenSaver();
pub fn SDL_GL_GetDrawableSize(window: *const SDL_Window, w: *const c_int, h: *const c_int);
pub fn SDL_GL_LoadLibrary(path: *const c_char) -> c_int;
pub fn SDL_GL_GetProcAddress(procname: *const c_char) -> Option<extern "system" fn()>;
pub fn SDL_GL_UnloadLibrary();
@@ -469,6 +470,13 @@ impl Window {
(w as int, h as int)
}
pub fn get_drawable_size(&self) -> (int, int) {
let w: c_int = 0;
let h: c_int = 0;
unsafe { ll::SDL_GL_GetDrawableSize(self.raw, &w, &h) };
(w as int, h as int)
}
pub fn set_minimum_size(&self, w: int, h: int) {
unsafe { ll::SDL_SetWindowMinimumSize(self.raw, w as c_int, h as c_int) }
}