Skip to content

Commit 819c0ff

Browse files
authored
Merge pull request #1 from AngryLawyer/master
Updating
2 parents 418fdf2 + 62e08b3 commit 819c0ff

22 files changed

+66
-58
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "sdl2"
44
description = "SDL2 bindings for Rust"
55
repository = "https://github.com/AngryLawyer/rust-sdl2"
66
documentation = "http://angrylawyer.github.io/rust-sdl2/sdl2/"
7-
version = "0.23.0"
7+
version = "0.24.0"
88
license = "MIT"
99
authors = [ "Tony Aldridge <[email protected]>" ]
1010
keywords = ["SDL", "windowing", "graphics"]
@@ -29,7 +29,7 @@ lazy_static="0.2"
2929
[dependencies.sdl2-sys]
3030

3131
path = "sdl2-sys"
32-
version = "0.23.0"
32+
version = "0.24.0"
3333

3434
[features]
3535

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ http://www.libsdl.org/ (SDL2-devel-2.0.x-mingw.tar.gz).
108108
3. Copy all lib files from
109109
> SDL2-devel-2.0.x-mingw\SDL2-2.0.x\x86_64-w64-mingw32\lib
110110
111-
to (for Rust 1.6 and above)
111+
to (for Rust 1.6 and above)
112112
> C:\Program Files\Rust\\**lib**\rustlib\x86_64-pc-windows-gnu\lib
113113
114114
or to (for Rust versions 1.5 and below)
115115
> C:\Program Files\Rust\\**bin**\rustlib\x86_64-pc-windows-gnu\lib
116-
116+
117117
or to your library folder of choice, and ensure you have a system environment variable of
118118
> LIBRARY_PATH = C:\your\rust\library\folder
119119
@@ -132,7 +132,7 @@ download through Crates.io:
132132

133133
```toml
134134
[dependencies]
135-
sdl2 = "0.23"
135+
sdl2 = "0.24"
136136
```
137137

138138
Alternatively, pull it from GitHub

sdl2-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name = "sdl2-sys"
44
description = "Raw SDL2 bindings for Rust, used internally rust-sdl2"
55
repository = "https://github.com/AngryLawyer/rust-sdl2"
6-
version = "0.23.0"
6+
version = "0.24.0"
77
authors = ["Tony Aldridge <[email protected]>"]
88
license = "MIT"
99
links = "SDL2"

sdl2-sys/src/clipboard.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use libc::{c_int, c_char};
2-
3-
pub type SDL_bool = c_int;
2+
use sdl::SDL_bool;
43

54
extern "C" {
65
pub fn SDL_SetClipboardText(text: *const c_char) -> c_int;

sdl2-sys/src/controller.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use core::prelude::*;
33
use libc::{c_int, c_char, c_uchar, c_uint, c_void, int16_t, uint8_t};
44
use joystick::{SDL_Joystick, SDL_JoystickGUID};
55
use super::rwops::SDL_RWops;
6-
7-
pub type SDL_bool = c_int;
6+
use sdl::SDL_bool;
87

98
pub type SDL_GameController = c_void;
109

sdl2-sys/src/cpuinfo.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use libc::{c_int};
2-
3-
pub type SDL_bool = c_int;
2+
use sdl::SDL_bool;
43

54
// SDL_cpuinfo.h
65
extern "C" {

sdl2-sys/src/event.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ use gesture::SDL_GestureID;
66
use keyboard::SDL_Keysym;
77
use touch::SDL_FingerID;
88
use touch::SDL_TouchID;
9+
use sdl::SDL_bool;
10+
911
#[cfg(feature = "no_std")]
1012
use core::prelude::*;
1113

12-
pub type SDL_bool = c_int;
13-
1414
// SDL_events.h
15-
pub type SDL_EventState = uint8_t;
16-
pub const SDL_DISABLE: SDL_EventState = 0;
17-
pub const SDL_ENABLE: SDL_EventState = 1;
18-
pub const SDL_QUERY: SDL_EventState = 0xFF;
15+
pub type SDL_State = c_int;
16+
pub const SDL_DISABLE: SDL_State = 0;
17+
pub const SDL_ENABLE: SDL_State = 1;
18+
pub const SDL_QUERY: SDL_State = -1;
1919

2020
pub type SDL_SysWMmsg = c_void;
2121

@@ -466,6 +466,6 @@ extern "C" {
466466
pub fn SDL_AddEventWatch(filter: SDL_EventFilter, userdata: *mut c_void);
467467
pub fn SDL_DelEventWatch(filter: SDL_EventFilter, userdata: *mut c_void);
468468
pub fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *mut c_void);
469-
pub fn SDL_EventState(type_: uint32_t, state: SDL_EventState) -> SDL_EventState;
469+
pub fn SDL_EventState(type_: uint32_t, state: SDL_State) -> SDL_State;
470470
pub fn SDL_RegisterEvents(numevents: c_int) -> uint32_t;
471471
}

sdl2-sys/src/hint.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use libc::{c_int, c_char};
2-
3-
pub type SDL_bool = c_int;
1+
use libc::c_char;
2+
use sdl::SDL_bool;
43

54
#[derive(Copy, Clone)]
65
#[repr(C)]

sdl2-sys/src/joystick.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use libc::{c_int, c_char, c_void, int32_t, int16_t, int8_t, uint8_t};
2-
3-
pub type SDL_bool = c_int;
2+
use sdl::SDL_bool;
43

54
pub type SDL_Joystick = c_void;
65

sdl2-sys/src/keyboard.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use rect::SDL_Rect;
44
use video::SDL_Window;
55
use scancode::SDL_Scancode;
66
use keycode::{SDL_Keycode, SDL_Keymod};
7-
8-
pub type SDL_bool = c_int;
7+
use sdl::SDL_bool;
98

109
// SDL_keyboard.h
1110
#[derive(Copy, Clone)]

sdl2-sys/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,29 @@ pub mod sdl;
3232
pub mod timer;
3333
pub mod version;
3434
pub mod hint;
35+
36+
pub use scancode::*;
37+
pub use keycode::*;
38+
pub use audio::*;
39+
pub use clipboard::*;
40+
pub use controller::*;
41+
pub use cpuinfo::*;
42+
pub use event::*;
43+
pub use filesystem::*;
44+
pub use haptic::*;
45+
pub use gesture::*;
46+
pub use joystick::*;
47+
pub use keyboard::*;
48+
pub use messagebox::*;
49+
pub use rect::*;
50+
pub use pixels::*;
51+
pub use render::*;
52+
pub use rwops::*;
53+
pub use surface::*;
54+
pub use touch::*;
55+
pub use video::*;
56+
pub use mouse::*;
57+
pub use sdl::*;
58+
pub use timer::*;
59+
pub use version::*;
60+
pub use hint::*;

sdl2-sys/src/mouse.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use libc::{c_int, c_uint, c_void, uint8_t, uint32_t};
22
use surface::SDL_Surface;
33
use video::SDL_Window;
4+
use sdl::SDL_bool;
5+
use event::SDL_State;
46

5-
pub type SDL_bool = c_int;
67
pub type SDL_Cursor = c_void;
78

89
pub type SDL_SystemCursor = c_uint;
@@ -20,10 +21,7 @@ pub const SDL_SYSTEM_CURSOR_NO: SDL_SystemCursor = 10;
2021
pub const SDL_SYSTEM_CURSOR_HAND: SDL_SystemCursor = 11;
2122
pub const SDL_NUM_SYSTEM_CURSORS: SDL_SystemCursor = 12;
2223

23-
pub type SDL_MouseState = c_int;
24-
pub const SDL_DISABLE: SDL_MouseState = 0;
25-
pub const SDL_ENABLE: SDL_MouseState = 1;
26-
pub const SDL_QUERY: SDL_MouseState = -1;
24+
2725

2826
pub const SDL_BUTTON_LEFT: u8 = 1;
2927
pub const SDL_BUTTON_MIDDLE: u8 = 2;
@@ -54,5 +52,5 @@ extern "C" {
5452
pub fn SDL_GetCursor() -> *mut SDL_Cursor;
5553
pub fn SDL_GetDefaultCursor() -> *mut SDL_Cursor;
5654
pub fn SDL_FreeCursor(cursor: *mut SDL_Cursor);
57-
pub fn SDL_ShowCursor(toggle: SDL_MouseState) -> SDL_MouseState;
55+
pub fn SDL_ShowCursor(toggle: SDL_State) -> SDL_State;
5856
}

sdl2-sys/src/pixels.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use libc::{c_int, uint8_t, uint32_t};
2-
3-
pub type SDL_bool = c_int;
2+
use sdl::SDL_bool;
43

54
//SDL_pixels.h
65
#[derive(Copy, Clone)]

sdl2-sys/src/rect.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use libc::c_int;
2+
use sdl::SDL_bool;
23

34
/// A structure that defines a two dimensional point.
45
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)]
@@ -18,8 +19,6 @@ pub struct SDL_Rect {
1819
pub h: c_int
1920
}
2021

21-
pub type SDL_bool = c_int;
22-
2322
extern "C" {
2423
pub fn SDL_HasIntersection(A: *const SDL_Rect, B: *const SDL_Rect) -> SDL_bool;
2524
pub fn SDL_IntersectRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *mut SDL_Rect) -> SDL_bool;

sdl2-sys/src/render.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use libc::{c_int, c_uint, c_char, c_void, c_float, c_double};
22
use libc::{uint8_t, uint32_t};
33
use rect::{SDL_Point, SDL_Rect};
4-
54
use surface::SDL_Surface;
65
use video::SDL_Window;
7-
8-
pub type SDL_bool = c_int;
6+
use sdl::SDL_bool;
97

108
//SDL_render.h
119
pub type SDL_RendererFlags = c_uint;

sdl2-sys/src/rwops.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
use libc::{c_uchar, uint32_t, c_char, FILE, c_void};
22
use libc::{c_int, int64_t, size_t};
3+
use sdl::SDL_bool;
34

45
#[allow(dead_code)]
56
#[repr(C)]
67
struct SDL_RWops_Anon {
78
data: [c_uchar; 24],
89
}
910

10-
pub type SDL_bool = c_int;
11-
1211
pub static RW_SEEK_SET: c_int = 0;
1312
pub static RW_SEEK_CUR: c_int = 1;
1413
pub static RW_SEEK_END: c_int = 2;

sdl2-sys/src/sdl.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ mod others {
1818
extern {}
1919
}
2020

21+
pub type SDL_bool = c_int;
22+
2123
pub type SDL_errorcode = c_uint;
2224
pub const SDL_ENOMEM: SDL_errorcode = 0;
2325
pub const SDL_EFREAD: SDL_errorcode = 1;
@@ -50,7 +52,4 @@ extern "C" {
5052
pub fn SDL_QuitSubSystem(flags: SDL_InitFlag);
5153
pub fn SDL_WasInit(flags: SDL_InitFlag) -> SDL_InitFlag;
5254
pub fn SDL_Quit();
53-
54-
//SDL_timer.h
55-
pub fn SDL_GetTicks() -> uint32_t;
5655
}

sdl2-sys/src/surface.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use pixels::SDL_Palette;
33
use rwops::SDL_RWops;
44
use rect::SDL_Rect;
55
use libc::{c_int, c_void, uint32_t, uint8_t};
6-
pub use render::SDL_BlendMode;
7-
8-
pub type SDL_bool = c_int;
6+
use render::SDL_BlendMode;
7+
use sdl::SDL_bool;
98

109
pub type SDL_SurfaceFlag = uint32_t;
1110

sdl2-sys/src/video.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use rect::SDL_Rect;
22
use surface::SDL_Surface;
3+
use sdl::SDL_bool;
34

45
#[cfg(feature = "no_std")]
56
use core::prelude::*;
67
use libc::{c_void, c_int, c_float, c_char, uint16_t, uint32_t};
78

8-
pub type SDL_bool = c_int;
9-
109
//SDL_video.h
1110
#[allow(missing_copy_implementations)]
1211
#[repr(C)]

src/sdl2/mouse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl MouseUtil {
210210
}
211211

212212
pub fn is_cursor_showing(&self) -> bool {
213-
unsafe { ll::SDL_ShowCursor(ll::SDL_QUERY) == 1 }
213+
unsafe { ll::SDL_ShowCursor(::sys::SDL_QUERY) == 1 }
214214
}
215215

216216
pub fn show_cursor(&self, show: bool) {

src/sdl2/render.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,7 @@ impl<'a> Renderer<'a> {
695695
}
696696

697697
/// Draws a series of connected lines on the current rendering target.
698-
/// # Panics
699-
/// Panics if drawing fails for any reason (e.g. driver failure)
698+
/// Errors if drawing fails for any reason (e.g. driver failure)
700699
pub fn draw_lines(&mut self, points: &[Point]) -> Result<(), String> {
701700
let result = unsafe {
702701
ll::SDL_RenderDrawLines(
@@ -774,10 +773,9 @@ impl<'a> Renderer<'a> {
774773
/// * If `dst` is `None`, the texture will be stretched to fill the given
775774
/// rectangle.
776775
///
777-
/// # Panics
778-
/// Panics if drawing fails for any reason (e.g. driver failure),
776+
/// Errors if drawing fails for any reason (e.g. driver failure),
779777
/// or if the provided texture does not belong to the renderer.
780-
pub fn copy(&mut self, texture: &Texture, src: Option<Rect>, dst: Option<Rect>)
778+
pub fn copy(&mut self, texture: &Texture, src: Option<Rect>, dst: Option<Rect>)
781779
-> Result<(), String> {
782780
texture.check_renderer();
783781

@@ -817,8 +815,8 @@ impl<'a> Renderer<'a> {
817815
/// if the provided texture does not belong to the renderer,
818816
/// or if the driver does not support RenderCopyEx.
819817
pub fn copy_ex(&mut self, texture: &Texture, src: Option<Rect>,
820-
dst: Option<Rect>, angle: f64, center: Option<Point>,
821-
flip_horizontal: bool, flip_vertical: bool)
818+
dst: Option<Rect>, angle: f64, center: Option<Point>,
819+
flip_horizontal: bool, flip_vertical: bool)
822820
-> Result<(), String> {
823821
texture.check_renderer();
824822

src/sdl2/surface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl SurfaceRef {
453453
}
454454

455455
pub fn blend_mode(&self) -> BlendMode {
456-
let mut mode: ll::SDL_BlendMode = 0;
456+
let mut mode: ::sys::SDL_BlendMode = 0;
457457
let result = unsafe {
458458
ll::SDL_GetSurfaceBlendMode(self.raw(), &mut mode)
459459
};

0 commit comments

Comments
 (0)