diff --git a/Cargo.toml b/Cargo.toml index 89c1b36a..f46151da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "sdl2_ttf" description = "SDL2_ttf bindings for Rust" repository = "https://github.com/andelf/rust-sdl2_ttf" -version = "0.5.0" +version = "0.6.0" license = "MIT" readme = "README.md" authors = ["ShuYu Wang "] @@ -14,8 +14,8 @@ path = "src/sdl2_ttf/lib.rs" [dependencies] bitflags = "0.2" -sdl2 = "0.5" -sdl2-sys = "0.5" +sdl2 = "0.6" +sdl2-sys = "0.6" libc = "0.1" # [dependencies.sdl2] diff --git a/src/demo/video.rs b/examples/demo.rs similarity index 100% rename from src/demo/video.rs rename to examples/demo.rs diff --git a/src/demo/main.rs b/src/demo/main.rs deleted file mode 100755 index 60357077..00000000 --- a/src/demo/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![crate_type = "bin"] - -extern crate sdl2; -extern crate sdl2_ttf; - -use std::env; -use std::path::Path; - -mod video; - -fn main() { - - let args: Vec<_> = env::args().collect(); - - println!("linked sdl2_ttf: {}", sdl2_ttf::get_linked_version()); - - if args.len() < 2 { - println!("Usage: ./demo font.[ttf|ttc|fon]") - } else { - let path: &Path = Path::new(&args[1]); - video::main(path); - } -} diff --git a/src/sdl2_ttf/lib.rs b/src/sdl2_ttf/lib.rs index 7dfd3882..a24d18f3 100644 --- a/src/sdl2_ttf/lib.rs +++ b/src/sdl2_ttf/lib.rs @@ -358,10 +358,10 @@ impl Font { unsafe { let ctext = CString::new(text).unwrap().as_ptr(); let raw = ffi::TTF_RenderText_Solid(self.raw, ctext, color_to_c_color(fg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -371,10 +371,10 @@ impl Font { unsafe { let ctext = CString::new(text.as_bytes()).unwrap(); let raw = ffi::TTF_RenderUTF8_Solid(self.raw, ctext.as_ptr(), color_to_c_color(fg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -383,10 +383,10 @@ impl Font { //! Draw a UNICODE glyph in solid mode. unsafe { let raw = ffi::TTF_RenderGlyph_Solid(self.raw, ch as u16, color_to_c_color(fg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -396,10 +396,10 @@ impl Font { unsafe { let ctext = CString::new(text).unwrap().as_ptr(); let raw = ffi::TTF_RenderText_Shaded(self.raw, ctext, color_to_c_color(fg), color_to_c_color(bg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -409,10 +409,10 @@ impl Font { unsafe { let ctext = CString::new(text.as_bytes()).unwrap(); let raw = ffi::TTF_RenderUTF8_Shaded(self.raw, ctext.as_ptr(), color_to_c_color(fg), color_to_c_color(bg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -421,10 +421,10 @@ impl Font { //! Draw a UNICODE glyph in shaded mode. unsafe { let raw = ffi::TTF_RenderGlyph_Shaded(self.raw, ch as u16, color_to_c_color(fg), color_to_c_color(bg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -434,10 +434,10 @@ impl Font { unsafe { let ctext = CString::new(text).unwrap().as_ptr(); let raw = ffi::TTF_RenderText_Blended(self.raw, ctext, color_to_c_color(fg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -447,10 +447,10 @@ impl Font { unsafe { let ctext = CString::new(text.as_bytes()).unwrap(); let raw = ffi::TTF_RenderUTF8_Blended(self.raw, ctext.as_ptr(), color_to_c_color(fg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -459,10 +459,10 @@ impl Font { //! Draw a UNICODE glyph in blended mode. unsafe { let raw = ffi::TTF_RenderGlyph_Blended(self.raw, ch as u16, color_to_c_color(fg)); - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { - Ok(Surface::from_ll(raw, true)) + Ok(Surface::from_ll(raw)) } } } @@ -482,7 +482,7 @@ impl<'a> LoaderRWops for RWops<'a> { let raw = unsafe { ffi::TTF_OpenFontRW(self.raw(), 0, ptsize as c_int) }; - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { Ok(Font::from_ll(raw, true)) @@ -492,7 +492,7 @@ impl<'a> LoaderRWops for RWops<'a> { let raw = unsafe { ffi::TTF_OpenFontIndexRW(self.raw(), 0, ptsize as c_int, index as c_long) }; - if raw.is_null() { + if (raw as *mut ()).is_null() { Err(get_error()) } else { Ok(Font::from_ll(raw, true))