Skip to content

Commit d706ee9

Browse files
committed
Move mixer module to the sdl2-sys crate
The 'mixer' feature is re-exported so compiling without it will leave out the mixer function definitions in sdl2-sys crate as well. Progresses on Rust-SDL2#647
1 parent 3e22653 commit d706ee9

File tree

5 files changed

+118
-118
lines changed

5 files changed

+118
-118
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ default = []
4040
ttf = []
4141
image = []
4242
gfx = ["c_vec"]
43-
mixer = []
43+
mixer = ["sdl2-sys/mixer"]
4444

4545
use-bindgen = ["sdl2-sys/use-bindgen"]
4646
use-pkgconfig = ["sdl2-sys/use-pkgconfig"]

sdl2-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ use-bindgen = ["bindgen"]
5050
static-link = []
5151
use_mac_framework = []
5252
bundled = ["cmake", "reqwest", "tar", "flate2"]
53+
mixer = []

sdl2-sys/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
#![allow(non_snake_case)]
1010

1111
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
12+
13+
#[cfg(feature = "mixer")]
14+
pub mod mixer;

src/sdl2/mixer/ffi.rs renamed to sdl2-sys/src/mixer.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::os::raw::{c_uint, c_int, c_char, c_double, c_void};
2-
use sys;
32

43
pub type MIX_InitFlags = c_uint;
54
pub const MIX_INIT_FLAC: c_uint = 1;
@@ -42,7 +41,7 @@ pub type Mix_EffectDone_t = ::std::option::Option<extern "C" fn(arg1: c_int,
4241
arg2: *const c_void)
4342
>;
4443
extern "C" {
45-
pub fn Mix_Linked_Version() -> *const sys::SDL_version;
44+
pub fn Mix_Linked_Version() -> *const ::SDL_version;
4645
pub fn Mix_Init(flags: c_int) -> c_int;
4746
pub fn Mix_Quit();
4847
pub fn Mix_OpenAudio(frequency: c_int,
@@ -55,10 +54,10 @@ extern "C" {
5554
format: *mut u16,
5655
channels: *mut c_int)
5756
-> c_int;
58-
pub fn Mix_LoadWAV_RW(src: *mut sys::SDL_RWops, freesrc: c_int) -> *mut Mix_Chunk;
57+
pub fn Mix_LoadWAV_RW(src: *mut ::SDL_RWops, freesrc: c_int) -> *mut Mix_Chunk;
5958
pub fn Mix_LoadMUS(file: *const c_char) -> *mut Mix_Music;
60-
pub fn Mix_LoadMUS_RW(src: *mut sys::SDL_RWops, freesrc: c_int) -> *mut Mix_Music;
61-
pub fn Mix_LoadMUSType_RW(src: *mut sys::SDL_RWops,
59+
pub fn Mix_LoadMUS_RW(src: *mut ::SDL_RWops, freesrc: c_int) -> *mut Mix_Music;
60+
pub fn Mix_LoadMUSType_RW(src: *mut ::SDL_RWops,
6261
type_: Mix_MusicType,
6362
freesrc: c_int)
6463
-> *mut Mix_Music;

0 commit comments

Comments
 (0)