From b0557762c964221f73758b263a59bcaaead79c9f Mon Sep 17 00:00:00 2001 From: Sven Nilsen Date: Sat, 16 Aug 2014 10:11:34 +0200 Subject: [PATCH] Added Retina support Closes https://github.com/AngryLawyer/rust-sdl2/issues/164 --- .gitignore | 2 ++ src/sdl2/video.rs | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index d37ed6db..d2717f5c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ src/sdl2/generated/ src/demo/main doc/ target/ + +Cargo.lock diff --git a/src/sdl2/video.rs b/src/sdl2/video.rs index 4674a9f2..a2f1f63b 100644 --- a/src/sdl2/video.rs +++ b/src/sdl2/video.rs @@ -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; 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) } }