diff --git a/Cargo.toml b/Cargo.toml index 6bbccfc1..da74ccfa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ name = "sdl2" description = "SDL2 bindings for Rust" repository = "https://github.com/AngryLawyer/rust-sdl2" documentation = "http://angrylawyer.github.io/rust-sdl2/sdl2/" -version = "0.23.0" +version = "0.23.1" license = "MIT" authors = [ "Tony Aldridge " ] keywords = ["SDL", "windowing", "graphics"] diff --git a/sdl2-sys/Cargo.toml b/sdl2-sys/Cargo.toml index eec80d35..3d8b1d62 100644 --- a/sdl2-sys/Cargo.toml +++ b/sdl2-sys/Cargo.toml @@ -3,7 +3,7 @@ name = "sdl2-sys" description = "Raw SDL2 bindings for Rust, used internally rust-sdl2" repository = "https://github.com/AngryLawyer/rust-sdl2" -version = "0.23.0" +version = "0.23.1" authors = ["Tony Aldridge "] license = "MIT" links = "SDL2" diff --git a/sdl2-sys/src/clipboard.rs b/sdl2-sys/src/clipboard.rs index df35d4d4..baf9d3bc 100644 --- a/sdl2-sys/src/clipboard.rs +++ b/sdl2-sys/src/clipboard.rs @@ -1,6 +1,5 @@ use libc::{c_int, c_char}; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; extern "C" { pub fn SDL_SetClipboardText(text: *const c_char) -> c_int; diff --git a/sdl2-sys/src/controller.rs b/sdl2-sys/src/controller.rs index 503c8b67..6d2de287 100644 --- a/sdl2-sys/src/controller.rs +++ b/sdl2-sys/src/controller.rs @@ -3,8 +3,7 @@ use core::prelude::*; use libc::{c_int, c_char, c_uchar, c_uint, c_void, int16_t, uint8_t}; use joystick::{SDL_Joystick, SDL_JoystickGUID}; use super::rwops::SDL_RWops; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; pub type SDL_GameController = c_void; diff --git a/sdl2-sys/src/cpuinfo.rs b/sdl2-sys/src/cpuinfo.rs index 12990c8f..fb6e6933 100644 --- a/sdl2-sys/src/cpuinfo.rs +++ b/sdl2-sys/src/cpuinfo.rs @@ -1,6 +1,5 @@ use libc::{c_int}; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; // SDL_cpuinfo.h extern "C" { diff --git a/sdl2-sys/src/event.rs b/sdl2-sys/src/event.rs index 76f3921a..d493e536 100644 --- a/sdl2-sys/src/event.rs +++ b/sdl2-sys/src/event.rs @@ -6,16 +6,16 @@ use gesture::SDL_GestureID; use keyboard::SDL_Keysym; use touch::SDL_FingerID; use touch::SDL_TouchID; +use sdl::SDL_bool; + #[cfg(feature = "no_std")] use core::prelude::*; -pub type SDL_bool = c_int; - // SDL_events.h -pub type SDL_EventState = uint8_t; -pub const SDL_DISABLE: SDL_EventState = 0; -pub const SDL_ENABLE: SDL_EventState = 1; -pub const SDL_QUERY: SDL_EventState = 0xFF; +pub type SDL_State = c_int; +pub const SDL_DISABLE: SDL_State = 0; +pub const SDL_ENABLE: SDL_State = 1; +pub const SDL_QUERY: SDL_State = -1; pub type SDL_SysWMmsg = c_void; @@ -466,6 +466,6 @@ extern "C" { pub fn SDL_AddEventWatch(filter: SDL_EventFilter, userdata: *mut c_void); pub fn SDL_DelEventWatch(filter: SDL_EventFilter, userdata: *mut c_void); pub fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *mut c_void); - pub fn SDL_EventState(type_: uint32_t, state: SDL_EventState) -> SDL_EventState; + pub fn SDL_EventState(type_: uint32_t, state: SDL_State) -> SDL_State; pub fn SDL_RegisterEvents(numevents: c_int) -> uint32_t; } diff --git a/sdl2-sys/src/hint.rs b/sdl2-sys/src/hint.rs index db8d48a5..68fb0cca 100644 --- a/sdl2-sys/src/hint.rs +++ b/sdl2-sys/src/hint.rs @@ -1,6 +1,5 @@ -use libc::{c_int, c_char}; - -pub type SDL_bool = c_int; +use libc::c_char; +use sdl::SDL_bool; #[derive(Copy, Clone)] #[repr(C)] diff --git a/sdl2-sys/src/joystick.rs b/sdl2-sys/src/joystick.rs index 388b6714..690bcbad 100644 --- a/sdl2-sys/src/joystick.rs +++ b/sdl2-sys/src/joystick.rs @@ -1,6 +1,5 @@ use libc::{c_int, c_char, c_void, int32_t, int16_t, int8_t, uint8_t}; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; pub type SDL_Joystick = c_void; diff --git a/sdl2-sys/src/keyboard.rs b/sdl2-sys/src/keyboard.rs index 6bee6059..a0d7090d 100644 --- a/sdl2-sys/src/keyboard.rs +++ b/sdl2-sys/src/keyboard.rs @@ -4,8 +4,7 @@ use rect::SDL_Rect; use video::SDL_Window; use scancode::SDL_Scancode; use keycode::{SDL_Keycode, SDL_Keymod}; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; // SDL_keyboard.h #[derive(Copy, Clone)] diff --git a/sdl2-sys/src/lib.rs b/sdl2-sys/src/lib.rs index a988c095..bc093957 100644 --- a/sdl2-sys/src/lib.rs +++ b/sdl2-sys/src/lib.rs @@ -32,3 +32,29 @@ pub mod sdl; pub mod timer; pub mod version; pub mod hint; + +pub use scancode::*; +pub use keycode::*; +pub use audio::*; +pub use clipboard::*; +pub use controller::*; +pub use cpuinfo::*; +pub use event::*; +pub use filesystem::*; +pub use haptic::*; +pub use gesture::*; +pub use joystick::*; +pub use keyboard::*; +pub use messagebox::*; +pub use rect::*; +pub use pixels::*; +pub use render::*; +pub use rwops::*; +pub use surface::*; +pub use touch::*; +pub use video::*; +pub use mouse::*; +pub use sdl::*; +pub use timer::*; +pub use version::*; +pub use hint::*; diff --git a/sdl2-sys/src/mouse.rs b/sdl2-sys/src/mouse.rs index 130ca22f..56437b6d 100644 --- a/sdl2-sys/src/mouse.rs +++ b/sdl2-sys/src/mouse.rs @@ -1,8 +1,9 @@ use libc::{c_int, c_uint, c_void, uint8_t, uint32_t}; use surface::SDL_Surface; use video::SDL_Window; +use sdl::SDL_bool; +use event::SDL_State; -pub type SDL_bool = c_int; pub type SDL_Cursor = c_void; pub type SDL_SystemCursor = c_uint; @@ -20,10 +21,7 @@ pub const SDL_SYSTEM_CURSOR_NO: SDL_SystemCursor = 10; pub const SDL_SYSTEM_CURSOR_HAND: SDL_SystemCursor = 11; pub const SDL_NUM_SYSTEM_CURSORS: SDL_SystemCursor = 12; -pub type SDL_MouseState = c_int; -pub const SDL_DISABLE: SDL_MouseState = 0; -pub const SDL_ENABLE: SDL_MouseState = 1; -pub const SDL_QUERY: SDL_MouseState = -1; + pub const SDL_BUTTON_LEFT: u8 = 1; pub const SDL_BUTTON_MIDDLE: u8 = 2; @@ -54,5 +52,5 @@ extern "C" { pub fn SDL_GetCursor() -> *mut SDL_Cursor; pub fn SDL_GetDefaultCursor() -> *mut SDL_Cursor; pub fn SDL_FreeCursor(cursor: *mut SDL_Cursor); - pub fn SDL_ShowCursor(toggle: SDL_MouseState) -> SDL_MouseState; + pub fn SDL_ShowCursor(toggle: SDL_State) -> SDL_State; } diff --git a/sdl2-sys/src/pixels.rs b/sdl2-sys/src/pixels.rs index 9ed6c60d..e9138231 100644 --- a/sdl2-sys/src/pixels.rs +++ b/sdl2-sys/src/pixels.rs @@ -1,6 +1,5 @@ use libc::{c_int, uint8_t, uint32_t}; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; //SDL_pixels.h #[derive(Copy, Clone)] diff --git a/sdl2-sys/src/rect.rs b/sdl2-sys/src/rect.rs index db2a014d..75b5564d 100644 --- a/sdl2-sys/src/rect.rs +++ b/sdl2-sys/src/rect.rs @@ -1,4 +1,5 @@ use libc::c_int; +use sdl::SDL_bool; /// A structure that defines a two dimensional point. #[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)] @@ -18,8 +19,6 @@ pub struct SDL_Rect { pub h: c_int } -pub type SDL_bool = c_int; - extern "C" { pub fn SDL_HasIntersection(A: *const SDL_Rect, B: *const SDL_Rect) -> SDL_bool; pub fn SDL_IntersectRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *mut SDL_Rect) -> SDL_bool; diff --git a/sdl2-sys/src/render.rs b/sdl2-sys/src/render.rs index c3396250..704bb501 100644 --- a/sdl2-sys/src/render.rs +++ b/sdl2-sys/src/render.rs @@ -1,11 +1,9 @@ use libc::{c_int, c_uint, c_char, c_void, c_float, c_double}; use libc::{uint8_t, uint32_t}; use rect::{SDL_Point, SDL_Rect}; - use surface::SDL_Surface; use video::SDL_Window; - -pub type SDL_bool = c_int; +use sdl::SDL_bool; //SDL_render.h pub type SDL_RendererFlags = c_uint; diff --git a/sdl2-sys/src/rwops.rs b/sdl2-sys/src/rwops.rs index ec2f0d0c..1c936808 100644 --- a/sdl2-sys/src/rwops.rs +++ b/sdl2-sys/src/rwops.rs @@ -1,5 +1,6 @@ use libc::{c_uchar, uint32_t, c_char, FILE, c_void}; use libc::{c_int, int64_t, size_t}; +use sdl::SDL_bool; #[allow(dead_code)] #[repr(C)] @@ -7,8 +8,6 @@ struct SDL_RWops_Anon { data: [c_uchar; 24], } -pub type SDL_bool = c_int; - pub static RW_SEEK_SET: c_int = 0; pub static RW_SEEK_CUR: c_int = 1; pub static RW_SEEK_END: c_int = 2; diff --git a/sdl2-sys/src/sdl.rs b/sdl2-sys/src/sdl.rs index 0a54b497..88157aed 100644 --- a/sdl2-sys/src/sdl.rs +++ b/sdl2-sys/src/sdl.rs @@ -18,6 +18,8 @@ mod others { extern {} } +pub type SDL_bool = c_int; + pub type SDL_errorcode = c_uint; pub const SDL_ENOMEM: SDL_errorcode = 0; pub const SDL_EFREAD: SDL_errorcode = 1; @@ -50,7 +52,4 @@ extern "C" { pub fn SDL_QuitSubSystem(flags: SDL_InitFlag); pub fn SDL_WasInit(flags: SDL_InitFlag) -> SDL_InitFlag; pub fn SDL_Quit(); - - //SDL_timer.h - pub fn SDL_GetTicks() -> uint32_t; } diff --git a/sdl2-sys/src/surface.rs b/sdl2-sys/src/surface.rs index b3705800..719299ab 100644 --- a/sdl2-sys/src/surface.rs +++ b/sdl2-sys/src/surface.rs @@ -3,9 +3,8 @@ use pixels::SDL_Palette; use rwops::SDL_RWops; use rect::SDL_Rect; use libc::{c_int, c_void, uint32_t, uint8_t}; -pub use render::SDL_BlendMode; - -pub type SDL_bool = c_int; +use render::SDL_BlendMode; +use sdl::SDL_bool; pub type SDL_SurfaceFlag = uint32_t; diff --git a/sdl2-sys/src/video.rs b/sdl2-sys/src/video.rs index 4c782adc..ec1b4c74 100644 --- a/sdl2-sys/src/video.rs +++ b/sdl2-sys/src/video.rs @@ -1,12 +1,11 @@ use rect::SDL_Rect; use surface::SDL_Surface; +use sdl::SDL_bool; #[cfg(feature = "no_std")] use core::prelude::*; use libc::{c_void, c_int, c_float, c_char, uint16_t, uint32_t}; -pub type SDL_bool = c_int; - //SDL_video.h #[allow(missing_copy_implementations)] #[repr(C)] diff --git a/src/sdl2/mouse.rs b/src/sdl2/mouse.rs index 5ec476de..3f61417e 100644 --- a/src/sdl2/mouse.rs +++ b/src/sdl2/mouse.rs @@ -210,7 +210,7 @@ impl MouseUtil { } pub fn is_cursor_showing(&self) -> bool { - unsafe { ll::SDL_ShowCursor(ll::SDL_QUERY) == 1 } + unsafe { ll::SDL_ShowCursor(::sys::SDL_QUERY) == 1 } } pub fn show_cursor(&self, show: bool) { diff --git a/src/sdl2/surface.rs b/src/sdl2/surface.rs index c675b0d2..b3ba8663 100644 --- a/src/sdl2/surface.rs +++ b/src/sdl2/surface.rs @@ -453,7 +453,7 @@ impl SurfaceRef { } pub fn blend_mode(&self) -> BlendMode { - let mut mode: ll::SDL_BlendMode = 0; + let mut mode: ::sys::SDL_BlendMode = 0; let result = unsafe { ll::SDL_GetSurfaceBlendMode(self.raw(), &mut mode) };