From b0557762c964221f73758b263a59bcaaead79c9f Mon Sep 17 00:00:00 2001 From: Sven Nilsen Date: Sat, 16 Aug 2014 10:11:34 +0200 Subject: [PATCH 1/2] 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) } } From e525c4164563c2b3d7e3937d852fc39fd56c61f0 Mon Sep 17 00:00:00 2001 From: Sven Nilsen Date: Sat, 16 Aug 2014 14:12:35 +0200 Subject: [PATCH 2/2] Updated to latest Rust --- src/sdl2/audio.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index b2402174..057eb609 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -353,6 +353,7 @@ impl AudioCVT { pub fn convert(&self, src: CVec) -> SdlResult> { //! Convert audio data to a desired audio format. + use std::slice::Slice; unsafe { if (*self.raw).needed != 1 { return Err("no convertion needed!".into_string())