mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Merge branch 'rustup' of github.com:pcwalton/rust-sdl2 into pcwalton-rustup
Conflicts: src/codegen/main.rs src/sdl2/audio.rs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
RUSTC ?= rustc
|
||||
RUSTFLAGS ?=
|
||||
OUTDIR ?= ./build
|
||||
|
||||
@@ -36,17 +37,17 @@ $(BINDIR) $(LIBDIR) $(TMPDIR):
|
||||
mkdir -p '$@'
|
||||
|
||||
$(TMPDIR)/codegen: $(wildcard src/codegen/*.rs) $(TMPDIR)
|
||||
rustc -o '$(TMPDIR)/codegen' src/codegen/main.rs $(RUSTFLAGS)
|
||||
$(RUSTC) -o '$(TMPDIR)/codegen' src/codegen/main.rs $(RUSTFLAGS)
|
||||
|
||||
src/sdl2/generated/%.rs: $(TMPDIR)/codegen
|
||||
'$(TMPDIR)/codegen' $(patsubst src/sdl2/generated/%,%,$@) src/sdl2/generated/
|
||||
|
||||
$(TMPDIR)/libsdl2.dummy: src/sdl2/lib.rs $(RUST_SRC) $(LIBDIR) $(TMPDIR)
|
||||
rustc --out-dir '$(LIBDIR)' src/sdl2/lib.rs $(RUSTFLAGS)
|
||||
$(RUSTC) --out-dir '$(LIBDIR)' src/sdl2/lib.rs $(RUSTFLAGS)
|
||||
touch $@
|
||||
|
||||
compile_demo: src/demo/main.rs src/demo/video.rs $(TMPDIR)/libsdl2.dummy $(BINDIR)
|
||||
rustc -o '$(BINDIR)/demo' -L '$(LIBDIR)' src/demo/main.rs
|
||||
$(RUSTC) -o '$(BINDIR)/demo' -L '$(LIBDIR)' src/demo/main.rs
|
||||
|
||||
demo: compile_demo
|
||||
'$(BINDIR)/demo'
|
||||
|
||||
+2
-2
@@ -28,12 +28,12 @@ fn main() {
|
||||
Ok(_) => {},
|
||||
};
|
||||
|
||||
if *args.get(1) == "keycode.rs".to_owned() {
|
||||
if "keycode.rs" == *args.get(1) {
|
||||
match keycode::generate(&output_dir) {
|
||||
Ok(_) => {},
|
||||
Err(e) => fail!("Could not automatically generate sources for keycodes: {:s}", e.desc),
|
||||
};
|
||||
} else if *args.get(1) == "scancode.rs".to_owned() {
|
||||
} else if "scancode.rs" == *args.get(1) {
|
||||
match scancode::generate(&output_dir) {
|
||||
Ok(_) => {},
|
||||
Err(e) => fail!("Could not automatically generate sources for scancodes: {:s}", e.desc),
|
||||
|
||||
+7
-3
@@ -262,11 +262,15 @@ impl AudioDevice {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open(device: &str, iscapture: int, spec: &AudioSpec) -> Result<(AudioDevice, AudioSpec), ~str> {
|
||||
pub fn open(device: Option<&str>, iscapture: int, spec: &AudioSpec) -> Result<(AudioDevice, ~AudioSpec), ~str> {
|
||||
//! SDL_OpenAudioDevice
|
||||
let obtained = unsafe { mem::uninit::<AudioSpec>() };
|
||||
let obtained = ~unsafe { mem::uninit::<AudioSpec>() };
|
||||
unsafe {
|
||||
let ret = ll::SDL_OpenAudioDevice(device.to_c_str().unwrap(),
|
||||
let device_c_str = match device {
|
||||
None => ptr::null(),
|
||||
Some(device) => device.to_c_str().unwrap(),
|
||||
};
|
||||
let ret = ll::SDL_OpenAudioDevice(device_c_str,
|
||||
iscapture as c_int,
|
||||
cast::transmute(spec),
|
||||
cast::transmute(&obtained),
|
||||
|
||||
Reference in New Issue
Block a user