Merge pull request #396 from nukep/mut

sdl2-sys: Update *const pointers to *mut, where necessary
This commit is contained in:
Tony Aldridge
2015-04-14 09:14:41 +01:00
32 changed files with 497 additions and 527 deletions
+6 -6
View File
@@ -38,10 +38,10 @@ pub struct SDL_AudioSpec {
pub padding: uint16_t,
pub size: uint32_t,
pub callback: SDL_AudioCallback,
pub userdata: *const c_void,
pub userdata: *mut c_void,
}
pub type SDL_AudioFilter =
Option<extern "C" fn (arg1: *const SDL_AudioCVT, arg2: SDL_AudioFormat)>;
Option<extern "C" fn (arg1: *mut SDL_AudioCVT, arg2: SDL_AudioFormat)>;
#[allow(dead_code, missing_copy_implementations, raw_pointer_derive)]
#[derive(Copy, Clone)]
#[repr(C)]
@@ -70,7 +70,7 @@ extern "C" {
pub fn SDL_AudioQuit();
pub fn SDL_GetCurrentAudioDriver() -> *const c_char;
pub fn SDL_OpenAudio(desired: *const SDL_AudioSpec,
obtained: *const SDL_AudioSpec) -> c_int;
obtained: *mut SDL_AudioSpec) -> c_int;
pub fn SDL_GetNumAudioDevices(iscapture: c_int) -> c_int;
pub fn SDL_GetAudioDeviceName(index: c_int, iscapture: c_int) -> *const c_char;
pub fn SDL_OpenAudioDevice(device: *const c_char, iscapture: c_int,
@@ -82,7 +82,7 @@ extern "C" {
SDL_AudioStatus;
pub fn SDL_PauseAudio(pause_on: c_int);
pub fn SDL_PauseAudioDevice(dev: SDL_AudioDeviceID, pause_on: c_int);
pub fn SDL_LoadWAV_RW(src: *const SDL_RWops, freesrc: c_int,
pub fn SDL_LoadWAV_RW(src: *mut SDL_RWops, freesrc: c_int,
spec: *mut SDL_AudioSpec,
audio_buf: *mut *mut uint8_t, audio_len: *mut uint32_t) -> *mut SDL_AudioSpec;
pub fn SDL_FreeWAV(audio_buf: *mut uint8_t);
@@ -91,9 +91,9 @@ extern "C" {
src_rate: c_int, dst_format: SDL_AudioFormat,
dst_channels: uint8_t, dst_rate: c_int) -> c_int;
pub fn SDL_ConvertAudio(cvt: *mut SDL_AudioCVT) -> c_int;
pub fn SDL_MixAudio(dst: *const uint8_t, src: *const uint8_t, len: uint32_t,
pub fn SDL_MixAudio(dst: *mut uint8_t, src: *const uint8_t, len: uint32_t,
volume: c_int);
pub fn SDL_MixAudioFormat(dst: *const uint8_t, src: *const uint8_t,
pub fn SDL_MixAudioFormat(dst: *mut uint8_t, src: *const uint8_t,
format: SDL_AudioFormat, len: uint32_t,
volume: c_int);
pub fn SDL_LockAudio();
+17 -17
View File
@@ -36,14 +36,14 @@ pub struct SDL_GameControllerButtonBindDataHat {
}
impl SDL_GameControllerButtonBindData {
pub fn button(&self) -> *const c_int {
self.data.as_ptr() as *const _
pub fn button(&mut self) -> *mut c_int {
self.data.as_mut_ptr() as *mut _
}
pub fn axis(&self) -> *const c_int {
self.data.as_ptr() as *const _
pub fn axis(&mut self) -> *mut c_int {
self.data.as_mut_ptr() as *mut _
}
pub fn hat(&self) -> *const SDL_GameControllerButtonBindDataHat {
self.data.as_ptr() as *const _
pub fn hat(&mut self) -> *mut SDL_GameControllerButtonBindDataHat {
self.data.as_mut_ptr() as *mut _
}
}
@@ -80,21 +80,21 @@ extern "C" {
pub fn SDL_GameControllerAddMapping(mappingString: *const c_char) -> c_int;
pub fn SDL_GameControllerMappingForGUID(guid: SDL_JoystickGUID) ->
*const c_char;
pub fn SDL_GameControllerMapping(gamecontroller: *const SDL_GameController)
pub fn SDL_GameControllerMapping(gamecontroller: *mut SDL_GameController)
-> *const c_char;
pub fn SDL_IsGameController(joystick_index: c_int) -> SDL_bool;
pub fn SDL_GameControllerNameForIndex(joystick_index: c_int) ->
*const c_char;
pub fn SDL_GameControllerOpen(joystick_index: c_int) ->
*const SDL_GameController;
pub fn SDL_GameControllerName(gamecontroller: *const SDL_GameController) ->
*mut SDL_GameController;
pub fn SDL_GameControllerName(gamecontroller: *mut SDL_GameController) ->
*const c_char;
pub fn SDL_GameControllerGetAttached(gamecontroller:
*const SDL_GameController) ->
*mut SDL_GameController) ->
SDL_bool;
pub fn SDL_GameControllerGetJoystick(gamecontroller:
*const SDL_GameController) ->
*const SDL_Joystick;
*mut SDL_GameController) ->
*mut SDL_Joystick;
pub fn SDL_GameControllerEventState(state: c_int) -> c_int;
pub fn SDL_GameControllerUpdate();
pub fn SDL_GameControllerGetAxisFromString(pchString: *const c_char) ->
@@ -103,10 +103,10 @@ extern "C" {
SDL_GameControllerAxis)
-> *const c_char;
pub fn SDL_GameControllerGetBindForAxis(gamecontroller:
*const SDL_GameController,
*mut SDL_GameController,
axis: SDL_GameControllerAxis)
-> SDL_GameControllerButtonBind;
pub fn SDL_GameControllerGetAxis(gamecontroller: *const SDL_GameController,
pub fn SDL_GameControllerGetAxis(gamecontroller: *mut SDL_GameController,
axis: SDL_GameControllerAxis) ->
int16_t;
pub fn SDL_GameControllerGetButtonFromString(pchString: *const c_char) ->
@@ -115,13 +115,13 @@ extern "C" {
SDL_GameControllerButton)
-> *const c_char;
pub fn SDL_GameControllerGetBindForButton(gamecontroller:
*const SDL_GameController,
*mut SDL_GameController,
button:
SDL_GameControllerButton)
-> SDL_GameControllerButtonBind;
pub fn SDL_GameControllerGetButton(gamecontroller:
*const SDL_GameController,
*mut SDL_GameController,
button: SDL_GameControllerButton)
-> uint8_t;
pub fn SDL_GameControllerClose(gamecontroller: *const SDL_GameController);
pub fn SDL_GameControllerClose(gamecontroller: *mut SDL_GameController);
}
+57 -57
View File
@@ -320,8 +320,8 @@ pub struct SDL_UserEvent {
pub timestamp: uint32_t,
pub windowID: uint32_t,
pub code: int32_t,
pub data1: *const c_void,
pub data2: *const c_void,
pub data1: *mut c_void,
pub data2: *mut c_void,
}
#[allow(missing_copy_implementations)]
@@ -329,7 +329,7 @@ pub struct SDL_UserEvent {
pub struct SDL_SysWMEvent {
pub type_: uint32_t,
pub timestamp: uint32_t,
pub msg: *const SDL_SysWMmsg,
pub msg: *mut SDL_SysWMmsg,
}
#[allow(missing_copy_implementations)]
@@ -339,100 +339,100 @@ pub struct SDL_Event {
}
impl SDL_Event {
pub fn type_(&self) -> *const uint32_t {
self.data.as_ptr() as *const _
pub fn type_(&mut self) -> *mut uint32_t {
self.data.as_mut_ptr() as *mut _
}
pub fn common(&self) -> *const SDL_CommonEvent {
self.data.as_ptr() as *const _
pub fn common(&mut self) -> *mut SDL_CommonEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn window(&self) -> *const SDL_WindowEvent {
self.data.as_ptr() as *const _
pub fn window(&mut self) -> *mut SDL_WindowEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn key(&self) -> *const SDL_KeyboardEvent {
self.data.as_ptr() as *const _
pub fn key(&mut self) -> *mut SDL_KeyboardEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn edit(&self) -> *const SDL_TextEditingEvent {
self.data.as_ptr() as *const _
pub fn edit(&mut self) -> *mut SDL_TextEditingEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn text(&self) -> *const SDL_TextInputEvent {
self.data.as_ptr() as *const _
pub fn text(&mut self) -> *mut SDL_TextInputEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn motion(&self) -> *const SDL_MouseMotionEvent {
self.data.as_ptr() as *const _
pub fn motion(&mut self) -> *mut SDL_MouseMotionEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn button(&self) -> *const SDL_MouseButtonEvent {
self.data.as_ptr() as *const _
pub fn button(&mut self) -> *mut SDL_MouseButtonEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn wheel(&self) -> *const SDL_MouseWheelEvent {
self.data.as_ptr() as *const _
pub fn wheel(&mut self) -> *mut SDL_MouseWheelEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn jaxis(&self) -> *const SDL_JoyAxisEvent {
self.data.as_ptr() as *const _
pub fn jaxis(&mut self) -> *mut SDL_JoyAxisEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn jball(&self) -> *const SDL_JoyBallEvent {
self.data.as_ptr() as *const _
pub fn jball(&mut self) -> *mut SDL_JoyBallEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn jhat(&self) -> *const SDL_JoyHatEvent {
self.data.as_ptr() as *const _
pub fn jhat(&mut self) -> *mut SDL_JoyHatEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn jbutton(&self) -> *const SDL_JoyButtonEvent {
self.data.as_ptr() as *const _
pub fn jbutton(&mut self) -> *mut SDL_JoyButtonEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn jdevice(&self) -> *const SDL_JoyDeviceEvent {
self.data.as_ptr() as *const _
pub fn jdevice(&mut self) -> *mut SDL_JoyDeviceEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn caxis(&self) -> *const SDL_ControllerAxisEvent {
self.data.as_ptr() as *const _
pub fn caxis(&mut self) -> *mut SDL_ControllerAxisEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn cbutton(&self) -> *const SDL_ControllerButtonEvent {
self.data.as_ptr() as *const _
pub fn cbutton(&mut self) -> *mut SDL_ControllerButtonEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn cdevice(&self) -> *const SDL_ControllerDeviceEvent {
self.data.as_ptr() as *const _
pub fn cdevice(&mut self) -> *mut SDL_ControllerDeviceEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn quit(&self) -> *const SDL_QuitEvent {
self.data.as_ptr() as *const _
pub fn quit(&mut self) -> *mut SDL_QuitEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn user(&self) -> *const SDL_UserEvent {
self.data.as_ptr() as *const _
pub fn user(&mut self) -> *mut SDL_UserEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn syswm(&self) -> *const SDL_SysWMEvent {
self.data.as_ptr() as *const _
pub fn syswm(&mut self) -> *mut SDL_SysWMEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn tfinger(&self) -> *const SDL_TouchFingerEvent {
self.data.as_ptr() as *const _
pub fn tfinger(&mut self) -> *mut SDL_TouchFingerEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn mgesture(&self) -> *const SDL_MultiGestureEvent {
self.data.as_ptr() as *const _
pub fn mgesture(&mut self) -> *mut SDL_MultiGestureEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn dgesture(&self) -> *const SDL_DollarGestureEvent {
self.data.as_ptr() as *const _
pub fn dgesture(&mut self) -> *mut SDL_DollarGestureEvent {
self.data.as_mut_ptr() as *mut _
}
pub fn drop(&self) -> *const SDL_DropEvent {
self.data.as_ptr() as *const _
pub fn drop(&mut self) -> *mut SDL_DropEvent {
self.data.as_mut_ptr() as *mut _
}
}
@@ -441,10 +441,10 @@ pub const SDL_ADDEVENT: SDL_eventaction = 0;
pub const SDL_PEEKEVENT: SDL_eventaction = 1;
pub const SDL_GETEVENT: SDL_eventaction = 2;
pub type SDL_EventFilter =
extern "C" fn(userdata: *const c_void, event: *const SDL_Event) -> c_int;
extern "C" fn(userdata: *mut c_void, event: *mut SDL_Event) -> c_int;
extern "C" {
pub fn SDL_free(mem: *const c_void);
pub fn SDL_free(mem: *mut c_void);
pub fn SDL_PumpEvents();
pub fn SDL_PeepEvents(events: *mut SDL_Event, numevents: c_int,
action: SDL_eventaction,
@@ -460,12 +460,12 @@ extern "C" {
c_int;
pub fn SDL_PushEvent(event: *mut SDL_Event) -> c_int;
pub fn SDL_SetEventFilter(filter: SDL_EventFilter,
userdata: *const c_void);
userdata: *mut c_void);
/*pub fn SDL_GetEventFilter(filter: *SDL_EventFilter,
userdata: **c_void) -> SDL_bool;*/
pub fn SDL_AddEventWatch(filter: SDL_EventFilter, userdata: *const c_void);
pub fn SDL_DelEventWatch(filter: SDL_EventFilter, userdata: *const c_void);
pub fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *const c_void);
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_RegisterEvents(numevents: c_int) -> uint32_t;
}
+3 -3
View File
@@ -6,7 +6,7 @@ pub type SDL_GestureID = int64_t;
extern "C" {
pub fn SDL_RecordGesture(touchId: SDL_TouchID) -> c_int;
pub fn SDL_SaveAllDollarTemplates(src: *const SDL_RWops) -> c_int;
pub fn SDL_SaveDollarTemplate(gestureId: SDL_GestureID, src: *const SDL_RWops) -> c_int;
pub fn SDL_LoadDollarTemplates(touchId: SDL_TouchID, src: *const SDL_RWops) -> c_int;
pub fn SDL_SaveAllDollarTemplates(src: *mut SDL_RWops) -> c_int;
pub fn SDL_SaveDollarTemplate(gestureId: SDL_GestureID, src: *mut SDL_RWops) -> c_int;
pub fn SDL_LoadDollarTemplates(touchId: SDL_TouchID, src: *mut SDL_RWops) -> c_int;
}
+40 -40
View File
@@ -132,64 +132,64 @@ pub struct SDL_HapticEffect {
}
impl SDL_HapticEffect {
pub fn type_(&self) -> *const uint16_t {
self.data.as_ptr() as *const _
pub fn type_(&mut self) -> *mut uint16_t {
self.data.as_mut_ptr() as *mut _
}
pub fn constant(&self) -> *const SDL_HapticConstant {
self.data.as_ptr() as *const _
pub fn constant(&mut self) -> *mut SDL_HapticConstant {
self.data.as_mut_ptr() as *mut _
}
pub fn periodic(&self) -> *const SDL_HapticPeriodic {
self.data.as_ptr() as *const _
pub fn periodic(&mut self) -> *mut SDL_HapticPeriodic {
self.data.as_mut_ptr() as *mut _
}
pub fn condition(&self) -> *const SDL_HapticCondition {
self.data.as_ptr() as *const _
pub fn condition(&mut self) -> *mut SDL_HapticCondition {
self.data.as_mut_ptr() as *mut _
}
pub fn ramp(&self) -> *const SDL_HapticRamp {
self.data.as_ptr() as *const _
pub fn ramp(&mut self) -> *mut SDL_HapticRamp {
self.data.as_mut_ptr() as *mut _
}
pub fn left_right(&self) -> *const SDL_HapticLeftRight {
self.data.as_ptr() as *const _
pub fn left_right(&mut self) -> *mut SDL_HapticLeftRight {
self.data.as_mut_ptr() as *mut _
}
pub fn custom(&self) -> *const SDL_HapticCustom {
self.data.as_ptr() as *const _
pub fn custom(&mut self) -> *mut SDL_HapticCustom {
self.data.as_mut_ptr() as *mut _
}
}
extern "C" {
pub fn SDL_NumHaptics() -> c_int;
pub fn SDL_HapticName(device_index: c_int) -> *const c_char;
pub fn SDL_HapticOpen(device_index: c_int) -> *const SDL_Haptic;
pub fn SDL_HapticOpen(device_index: c_int) -> *mut SDL_Haptic;
pub fn SDL_HapticOpened(device_index: c_int) -> c_int;
pub fn SDL_HapticIndex(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticIndex(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_MouseIsHaptic() -> c_int;
pub fn SDL_HapticOpenFromMouse() -> *const SDL_Haptic;
pub fn SDL_JoystickIsHaptic(joystick: *const SDL_Joystick) -> c_int;
pub fn SDL_HapticOpenFromJoystick(joystick: *const SDL_Joystick) -> *const SDL_Haptic;
pub fn SDL_HapticClose(haptic: *const SDL_Haptic);
pub fn SDL_HapticNumEffects(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticNumEffectsPlaying(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticQuery(haptic: *const SDL_Haptic) -> c_uint;
pub fn SDL_HapticNumAxes(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticEffectSupported(haptic: *const SDL_Haptic, effect: *const SDL_HapticEffect) -> c_int;
pub fn SDL_HapticNewEffect(haptic: *const SDL_Haptic, effect: *const SDL_HapticEffect) -> c_int;
pub fn SDL_HapticUpdateEffect(haptic: *const SDL_Haptic, effect: *const SDL_HapticEffect) -> c_int;
pub fn SDL_HapticRunEffect(haptic: *const SDL_Haptic, effect: c_int, iterations: uint32_t) -> c_int;
pub fn SDL_HapticStopEffect(haptic: *const SDL_Haptic, effect: c_int) -> c_int;
pub fn SDL_HapticDestroyEffect(haptic: *const SDL_Haptic, effect: c_int);
pub fn SDL_HapticGetEffectStatus(haptic: *const SDL_Haptic, effect: c_int) -> c_int;
pub fn SDL_HapticSetGain(haptic: *const SDL_Haptic, gain: c_int) -> c_int;
pub fn SDL_HapticSetAutocenter(haptic: *const SDL_Haptic, autocenter: c_int) -> c_int;
pub fn SDL_HapticPause(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticUnpause(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticStopAll(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticRumbleSupported(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticRumbleInit(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticRumblePlay(haptic: *const SDL_Haptic, strength: c_float, length: uint32_t) -> c_int;
pub fn SDL_HapticRumbleStop(haptic: *const SDL_Haptic) -> c_int;
pub fn SDL_HapticOpenFromMouse() -> *mut SDL_Haptic;
pub fn SDL_JoystickIsHaptic(joystick: *mut SDL_Joystick) -> c_int;
pub fn SDL_HapticOpenFromJoystick(joystick: *mut SDL_Joystick) -> *mut SDL_Haptic;
pub fn SDL_HapticClose(haptic: *mut SDL_Haptic);
pub fn SDL_HapticNumEffects(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticNumEffectsPlaying(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticQuery(haptic: *mut SDL_Haptic) -> c_uint;
pub fn SDL_HapticNumAxes(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticEffectSupported(haptic: *mut SDL_Haptic, effect: *mut SDL_HapticEffect) -> c_int;
pub fn SDL_HapticNewEffect(haptic: *mut SDL_Haptic, effect: *mut SDL_HapticEffect) -> c_int;
pub fn SDL_HapticUpdateEffect(haptic: *mut SDL_Haptic, effect: *mut SDL_HapticEffect) -> c_int;
pub fn SDL_HapticRunEffect(haptic: *mut SDL_Haptic, effect: c_int, iterations: uint32_t) -> c_int;
pub fn SDL_HapticStopEffect(haptic: *mut SDL_Haptic, effect: c_int) -> c_int;
pub fn SDL_HapticDestroyEffect(haptic: *mut SDL_Haptic, effect: c_int);
pub fn SDL_HapticGetEffectStatus(haptic: *mut SDL_Haptic, effect: c_int) -> c_int;
pub fn SDL_HapticSetGain(haptic: *mut SDL_Haptic, gain: c_int) -> c_int;
pub fn SDL_HapticSetAutocenter(haptic: *mut SDL_Haptic, autocenter: c_int) -> c_int;
pub fn SDL_HapticPause(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticUnpause(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticStopAll(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticRumbleSupported(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticRumbleInit(haptic: *mut SDL_Haptic) -> c_int;
pub fn SDL_HapticRumblePlay(haptic: *mut SDL_Haptic, strength: c_float, length: uint32_t) -> c_int;
pub fn SDL_HapticRumbleStop(haptic: *mut SDL_Haptic) -> c_int;
}
+14 -14
View File
@@ -14,31 +14,31 @@ pub struct SDL_JoystickGUID {
extern "C" {
pub fn SDL_NumJoysticks() -> c_int;
pub fn SDL_JoystickNameForIndex(device_index: c_int) -> *const c_char;
pub fn SDL_JoystickOpen(device_index: c_int) -> *const SDL_Joystick;
pub fn SDL_JoystickName(joystick: *const SDL_Joystick) -> *const c_char;
pub fn SDL_JoystickOpen(device_index: c_int) -> *mut SDL_Joystick;
pub fn SDL_JoystickName(joystick: *mut SDL_Joystick) -> *const c_char;
pub fn SDL_JoystickGetDeviceGUID(device_index: c_int) ->
SDL_JoystickGUID;
pub fn SDL_JoystickGetGUID(joystick: *const SDL_Joystick) ->
pub fn SDL_JoystickGetGUID(joystick: *mut SDL_Joystick) ->
SDL_JoystickGUID;
pub fn SDL_JoystickGetGUIDString(guid: SDL_JoystickGUID,
pszGUID: *const c_char, cbGUID: c_int);
pub fn SDL_JoystickGetGUIDFromString(pchGUID: *const c_char) ->
SDL_JoystickGUID;
pub fn SDL_JoystickGetAttached(joystick: *const SDL_Joystick) -> SDL_bool;
pub fn SDL_JoystickInstanceID(joystick: *const SDL_Joystick) -> int32_t;
pub fn SDL_JoystickNumAxes(joystick: *const SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumBalls(joystick: *const SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumHats(joystick: *const SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumButtons(joystick: *const SDL_Joystick) -> c_int;
pub fn SDL_JoystickGetAttached(joystick: *mut SDL_Joystick) -> SDL_bool;
pub fn SDL_JoystickInstanceID(joystick: *mut SDL_Joystick) -> int32_t;
pub fn SDL_JoystickNumAxes(joystick: *mut SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumBalls(joystick: *mut SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumHats(joystick: *mut SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumButtons(joystick: *mut SDL_Joystick) -> c_int;
pub fn SDL_JoystickUpdate();
pub fn SDL_JoystickEventState(state: c_int) -> c_int;
pub fn SDL_JoystickGetAxis(joystick: *const SDL_Joystick, axis: c_int) ->
pub fn SDL_JoystickGetAxis(joystick: *mut SDL_Joystick, axis: c_int) ->
int16_t;
pub fn SDL_JoystickGetHat(joystick: *const SDL_Joystick, hat: c_int) ->
pub fn SDL_JoystickGetHat(joystick: *mut SDL_Joystick, hat: c_int) ->
int8_t;
pub fn SDL_JoystickGetBall(joystick: *const SDL_Joystick, ball: c_int,
pub fn SDL_JoystickGetBall(joystick: *mut SDL_Joystick, ball: c_int,
dx: *const c_int, dy: *const c_int) -> c_int;
pub fn SDL_JoystickGetButton(joystick: *const SDL_Joystick, button: c_int)
pub fn SDL_JoystickGetButton(joystick: *mut SDL_Joystick, button: c_int)
-> uint8_t;
pub fn SDL_JoystickClose(joystick: *const SDL_Joystick);
pub fn SDL_JoystickClose(joystick: *mut SDL_Joystick);
}
+3 -3
View File
@@ -18,8 +18,8 @@ pub struct SDL_Keysym {
}
extern "C" {
pub fn SDL_GetKeyboardFocus() -> *const SDL_Window;
pub fn SDL_GetKeyboardState(numkeys: *const c_int) -> *const uint8_t;
pub fn SDL_GetKeyboardFocus() -> *mut SDL_Window;
pub fn SDL_GetKeyboardState(numkeys: *mut c_int) -> *const uint8_t;
pub fn SDL_GetModState() -> SDL_Keymod;
pub fn SDL_SetModState(modstate: SDL_Keymod);
pub fn SDL_GetKeyFromScancode(scancode: SDL_Scancode) -> SDL_Keycode;
@@ -33,5 +33,5 @@ extern "C" {
pub fn SDL_StopTextInput();
pub fn SDL_SetTextInputRect(rect: *const SDL_Rect);
pub fn SDL_HasScreenKeyboardSupport() -> SDL_bool;
pub fn SDL_IsScreenKeyboardShown(window: *const SDL_Window) -> SDL_bool;
pub fn SDL_IsScreenKeyboardShown(window: *mut SDL_Window) -> SDL_bool;
}
+1 -1
View File
@@ -7,5 +7,5 @@ pub const SDL_MESSAGEBOX_WARNING : SDL_MessageBoxFlags = 0x00000020;
pub const SDL_MESSAGEBOX_INFORMATION : SDL_MessageBoxFlags = 0x00000040;
extern "C" {
pub fn SDL_ShowSimpleMessageBox(flags: uint32_t, title: *const c_char, message: *const c_char, window: *const SDL_Window) -> c_int;
pub fn SDL_ShowSimpleMessageBox(flags: uint32_t, title: *const c_char, message: *const c_char, window: *mut SDL_Window) -> c_int;
}
+12 -12
View File
@@ -38,21 +38,21 @@ pub const SDL_BUTTON_X2MASK: u32 = 0x10;
extern "C" {
pub fn SDL_GetMouseFocus() -> *const SDL_Window;
pub fn SDL_GetMouseState(x: *const c_int, y: *const c_int) -> uint32_t;
pub fn SDL_GetRelativeMouseState(x: *const c_int, y: *const c_int) -> uint32_t;
pub fn SDL_WarpMouseInWindow(window: *const SDL_Window, x: c_int, y: c_int);
pub fn SDL_GetMouseFocus() -> *mut SDL_Window;
pub fn SDL_GetMouseState(x: *mut c_int, y: *mut c_int) -> uint32_t;
pub fn SDL_GetRelativeMouseState(x: *mut c_int, y: *mut c_int) -> uint32_t;
pub fn SDL_WarpMouseInWindow(window: *mut SDL_Window, x: c_int, y: c_int);
pub fn SDL_SetRelativeMouseMode(enabled: SDL_bool) -> c_int;
pub fn SDL_GetRelativeMouseMode() -> SDL_bool;
pub fn SDL_CreateCursor(data: *const uint8_t, mask: *const uint8_t, w: c_int,
h: c_int, hot_x: c_int, hot_y: c_int) ->
*const SDL_Cursor;
pub fn SDL_CreateColorCursor(surface: *const SDL_Surface, hot_x: c_int,
hot_y: c_int) -> *const SDL_Cursor;
pub fn SDL_CreateSystemCursor(id: SDL_SystemCursor) -> *const SDL_Cursor;
pub fn SDL_SetCursor(cursor: *const SDL_Cursor);
pub fn SDL_GetCursor() -> *const SDL_Cursor;
pub fn SDL_GetDefaultCursor() -> *const SDL_Cursor;
pub fn SDL_FreeCursor(cursor: *const SDL_Cursor);
*mut SDL_Cursor;
pub fn SDL_CreateColorCursor(surface: *mut SDL_Surface, hot_x: c_int,
hot_y: c_int) -> *mut SDL_Cursor;
pub fn SDL_CreateSystemCursor(id: SDL_SystemCursor) -> *mut SDL_Cursor;
pub fn SDL_SetCursor(cursor: *mut SDL_Cursor);
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;
}
+7 -7
View File
@@ -14,7 +14,7 @@ pub struct SDL_Color {
#[repr(C)]
pub struct SDL_Palette {
pub ncolors: c_int,
pub colors: *const SDL_Color,
pub colors: *mut SDL_Color,
pub version: uint32_t,
pub refcount: c_int
}
@@ -23,7 +23,7 @@ pub struct SDL_Palette {
#[repr(C)]
pub struct SDL_PixelFormat {
pub format: SDL_PixelFormatEnum,
pub palette: *const SDL_Palette,
pub palette: *mut SDL_Palette,
pub BitsPerPixel: uint8_t,
pub BytesPerPixel: uint8_t,
pub padding: [uint8_t; 2],
@@ -40,7 +40,7 @@ pub struct SDL_PixelFormat {
pub Bshift: uint8_t,
pub Ashift: uint8_t,
pub refcount: c_int,
pub next: *const SDL_PixelFormat
pub next: *mut SDL_PixelFormat
}
pub type SDL_PixelFormatEnum = uint32_t;
@@ -82,8 +82,8 @@ pub const SDL_PIXELFORMAT_UYVY: SDL_PixelFormatEnum = 0x59565955;
pub const SDL_PIXELFORMAT_YVYU: SDL_PixelFormatEnum = 0x55595659;
extern "C" {
pub fn SDL_GetRGB(pixel: uint32_t, format: *const SDL_PixelFormat, r: *const uint8_t, g: *const uint8_t, b: *const uint8_t);
pub fn SDL_GetRGBA(pixel: uint32_t, format: *const SDL_PixelFormat, r: *const uint8_t, g: *const uint8_t, b: *const uint8_t, a: *const uint8_t);
pub fn SDL_MapRGB(format: *const SDL_PixelFormat, r: uint8_t, g: uint8_t, b: uint8_t) -> uint32_t;
pub fn SDL_MapRGBA(format: *const SDL_PixelFormat, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> uint32_t;
pub fn SDL_GetRGB(pixel: uint32_t, format: *mut SDL_PixelFormat, r: *mut uint8_t, g: *mut uint8_t, b: *mut uint8_t);
pub fn SDL_GetRGBA(pixel: uint32_t, format: *mut SDL_PixelFormat, r: *mut uint8_t, g: *mut uint8_t, b: *mut uint8_t, a: *mut uint8_t);
pub fn SDL_MapRGB(format: *mut SDL_PixelFormat, r: uint8_t, g: uint8_t, b: uint8_t) -> uint32_t;
pub fn SDL_MapRGBA(format: *mut SDL_PixelFormat, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> uint32_t;
}
+13 -14
View File
@@ -42,10 +42,10 @@ pub mod ll {
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: *const SDL_Rect) -> SDL_bool;
pub fn SDL_UnionRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *const SDL_Rect);
pub fn SDL_EnclosePoints(points: *const SDL_Point, count: c_int, clip: *const SDL_Rect, result: *const SDL_Rect) -> SDL_bool;
pub fn SDL_IntersectRectAndLine(rect: *const SDL_Rect, X1: *const c_int, Y1: *const c_int, X2: *const c_int, Y2: *const c_int) -> SDL_bool;
pub fn SDL_IntersectRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *mut SDL_Rect) -> SDL_bool;
pub fn SDL_UnionRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *mut SDL_Rect);
pub fn SDL_EnclosePoints(points: *const SDL_Point, count: c_int, clip: *const SDL_Rect, result: *mut SDL_Rect) -> SDL_bool;
pub fn SDL_IntersectRectAndLine(rect: *const SDL_Rect, X1: *mut c_int, Y1: *mut c_int, X2: *mut c_int, Y2: *mut c_int) -> SDL_bool;
}
}
@@ -70,14 +70,14 @@ impl Rect {
/// Calculate a minimal rectangle enclosing a set of points.
pub fn from_enclose_points(points: &[Point], clip: Option<Rect>) -> Option<Rect> {
let out: Rect = Rect::new(0, 0, 0, 0);
let mut out: Rect = Rect::new(0, 0, 0, 0);
let result = unsafe {
ll::SDL_EnclosePoints(
points.as_ptr(),
points.len() as c_int,
transmute(clip.as_ref()),
&out
&mut out
) != 0
};
@@ -102,10 +102,10 @@ impl Rect {
/// Calculate the intersection of two rectangles.
pub fn intersection(&self, other: &Rect) -> Option<Rect> {
let out: Rect = Rect::new(0, 0, 0, 0);
let mut out: Rect = Rect::new(0, 0, 0, 0);
let result = unsafe {
ll::SDL_IntersectRect(self, other, &out) != 0
ll::SDL_IntersectRect(self, other, &mut out) != 0
};
if result {
@@ -117,10 +117,10 @@ impl Rect {
/// Calculate the union of two rectangles.
pub fn union(&self, other: &Rect) -> Rect {
let out: Rect = Rect::new(0, 0, 0, 0);
let mut out: Rect = Rect::new(0, 0, 0, 0);
unsafe {
ll::SDL_UnionRect(self, other, &out)
ll::SDL_UnionRect(self, other, &mut out)
};
out
@@ -128,11 +128,11 @@ impl Rect {
/// Calculate the intersection of a rectangle and line segment. return points of intersection.
pub fn intersect_line(&self, start: &Point, end: &Point) -> Option<(Point, Point)> {
let out_start: Point = start.clone();
let out_end: Point = end.clone();
let mut out_start: Point = start.clone();
let mut out_end: Point = end.clone();
let result = unsafe {
ll::SDL_IntersectRectAndLine(self, &out_start.x, &out_start.y, &out_end.x, &out_end.y) != 0
ll::SDL_IntersectRectAndLine(self, &mut out_start.x, &mut out_start.y, &mut out_end.x, &mut out_end.y) != 0
};
if result {
@@ -142,4 +142,3 @@ impl Rect {
}
}
}
+4 -4
View File
@@ -22,8 +22,8 @@ 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: *const SDL_Rect) -> SDL_bool;
pub fn SDL_UnionRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *const SDL_Rect);
pub fn SDL_EnclosePoints(points: *const SDL_Point, count: c_int, clip: *const SDL_Rect, result: *const SDL_Rect) -> SDL_bool;
pub fn SDL_IntersectRectAndLine(rect: *const SDL_Rect, X1: *const c_int, Y1: *const c_int, X2: *const c_int, Y2: *const c_int) -> SDL_bool;
pub fn SDL_IntersectRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *mut SDL_Rect) -> SDL_bool;
pub fn SDL_UnionRect(A: *const SDL_Rect, B: *const SDL_Rect, result: *mut SDL_Rect);
pub fn SDL_EnclosePoints(points: *const SDL_Point, count: c_int, clip: *const SDL_Rect, result: *mut SDL_Rect) -> SDL_bool;
pub fn SDL_IntersectRectAndLine(rect: *const SDL_Rect, X1: *mut c_int, Y1: *mut c_int, X2: *mut c_int, Y2: *mut c_int) -> SDL_bool;
}
+52 -52
View File
@@ -60,56 +60,56 @@ pub const SDL_BLENDMODE_MOD : SDL_BlendMode = 0x00000004;
extern "C" {
pub fn SDL_GetNumRenderDrivers() -> c_int;
pub fn SDL_GetRenderDriverInfo(index: c_int, info: *const SDL_RendererInfo) -> c_int;
pub fn SDL_CreateWindowAndRenderer(width: c_int, height: c_int, window_flags: uint32_t, window: *const *const SDL_Window, renderer: *const *const SDL_Renderer) -> c_int;
pub fn SDL_CreateRenderer(window: *const SDL_Window, index: c_int, flags: uint32_t) -> *const SDL_Renderer;
pub fn SDL_CreateSoftwareRenderer(surface: *const SDL_Surface) -> *const SDL_Renderer;
pub fn SDL_GetRenderer(window: *const SDL_Window) -> *const SDL_Renderer;
pub fn SDL_GetRendererInfo(renderer: *const SDL_Renderer, info: *const SDL_RendererInfo) -> c_int;
pub fn SDL_GetRendererOutputSize(renderer: *const SDL_Renderer, w: *const c_int, h: *const c_int) -> c_int;
pub fn SDL_CreateTexture(renderer: *const SDL_Renderer, format: uint32_t, access: c_int, w: c_int, h: c_int) -> *const SDL_Texture;
pub fn SDL_CreateTextureFromSurface(renderer: *const SDL_Renderer, surface: *const SDL_Surface) -> *const SDL_Texture;
pub fn SDL_QueryTexture(texture: *const SDL_Texture, format: *const uint32_t, access: *const c_int, w: *const c_int, h: *const c_int) -> c_int;
pub fn SDL_SetTextureColorMod(texture: *const SDL_Texture, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int;
pub fn SDL_GetTextureColorMod(texture: *const SDL_Texture, r: *const uint8_t, g: *const uint8_t, b: *const uint8_t) -> c_int;
pub fn SDL_SetTextureAlphaMod(texture: *const SDL_Texture, alpha: uint8_t) -> c_int;
pub fn SDL_GetTextureAlphaMod(texture: *const SDL_Texture, alpha: *const uint8_t) -> c_int;
pub fn SDL_SetTextureBlendMode(texture: *const SDL_Texture, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetTextureBlendMode(texture: *const SDL_Texture, blendMode: *const SDL_BlendMode) -> c_int;
pub fn SDL_UpdateTexture(texture: *const SDL_Texture, rect: *const SDL_Rect, pixels: *const c_void, pitch: c_int) -> c_int;
pub fn SDL_UpdateYUVTexture(texture: *const SDL_Texture, rect: *const SDL_Rect, Yplane: *const uint8_t, Ypitch: c_int, Uplane: *const uint8_t, Upitch: c_int, Vplane: *const uint8_t, Vpitch: c_int) -> c_int;
pub fn SDL_LockTexture(texture: *const SDL_Texture, rect: *const SDL_Rect, pixels: *mut *mut c_void, pitch: *mut c_int) -> c_int;
pub fn SDL_UnlockTexture(texture: *const SDL_Texture);
pub fn SDL_RenderTargetSupported(renderer: *const SDL_Renderer) -> SDL_bool;
pub fn SDL_SetRenderTarget(renderer: *const SDL_Renderer, texture: *const SDL_Texture) -> c_int;
pub fn SDL_GetRenderTarget(renderer: *const SDL_Renderer) -> *const SDL_Texture;
pub fn SDL_RenderSetLogicalSize(renderer: *const SDL_Renderer, w: c_int, h: c_int) -> c_int;
pub fn SDL_RenderGetLogicalSize(renderer: *const SDL_Renderer, w: *const c_int, h: *const c_int);
pub fn SDL_RenderSetViewport(renderer: *const SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderGetViewport(renderer: *const SDL_Renderer, rect: *const SDL_Rect);
pub fn SDL_RenderSetClipRect(renderer: *const SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderGetClipRect(renderer: *const SDL_Renderer, rect: *const SDL_Rect);
pub fn SDL_RenderSetScale(renderer: *const SDL_Renderer, scaleX: c_float, scaleY: c_float) -> c_int;
pub fn SDL_RenderGetScale(renderer: *const SDL_Renderer, scaleX: *const c_float, scaleY: *const c_float);
pub fn SDL_SetRenderDrawColor(renderer: *const SDL_Renderer, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> c_int;
pub fn SDL_GetRenderDrawColor(renderer: *const SDL_Renderer, r: *const uint8_t, g: *const uint8_t, b: *const uint8_t, a: *const uint8_t) -> c_int;
pub fn SDL_SetRenderDrawBlendMode(renderer: *const SDL_Renderer, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetRenderDrawBlendMode(renderer: *const SDL_Renderer, blendMode: *const SDL_BlendMode) -> c_int;
pub fn SDL_RenderClear(renderer: *const SDL_Renderer) -> c_int;
pub fn SDL_RenderDrawPoint(renderer: *const SDL_Renderer, x: c_int, y: c_int) -> c_int;
pub fn SDL_RenderDrawPoints(renderer: *const SDL_Renderer, Points: *const SDL_Point, count: c_int) -> c_int;
pub fn SDL_RenderDrawLine(renderer: *const SDL_Renderer, x1: c_int, y1: c_int, x2: c_int, y2: c_int) -> c_int;
pub fn SDL_RenderDrawLines(renderer: *const SDL_Renderer, Points: *const SDL_Point, count: c_int) -> c_int;
pub fn SDL_RenderDrawRect(renderer: *const SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderDrawRects(renderer: *const SDL_Renderer, rects: *const SDL_Rect, count: c_int) -> c_int;
pub fn SDL_RenderFillRect(renderer: *const SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderFillRects(renderer: *const SDL_Renderer, rects: *const SDL_Rect, count: c_int) -> c_int;
pub fn SDL_RenderCopy(renderer: *const SDL_Renderer, texture: *const SDL_Texture, srcrect: *const SDL_Rect, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderCopyEx(renderer: *const SDL_Renderer, texture: *const SDL_Texture, srcrect: *const SDL_Rect, dstrect: *const SDL_Rect, angle: c_double, center: *const SDL_Point, flip: SDL_RendererFlip) -> c_int;
pub fn SDL_RenderReadPixels(renderer: *const SDL_Renderer, rect: *const SDL_Rect, format: uint32_t, pixels: *mut c_void, pitch: c_int) -> c_int;
pub fn SDL_RenderPresent(renderer: *const SDL_Renderer);
pub fn SDL_DestroyTexture(texture: *const SDL_Texture);
pub fn SDL_DestroyRenderer(renderer: *const SDL_Renderer);
pub fn SDL_GL_BindTexture(texture: *const SDL_Texture, texw: *const c_float, texh: *const c_float) -> c_int;
pub fn SDL_GL_UnbindTexture(texture: *const SDL_Texture) -> c_int;
pub fn SDL_GetRenderDriverInfo(index: c_int, info: *mut SDL_RendererInfo) -> c_int;
pub fn SDL_CreateWindowAndRenderer(width: c_int, height: c_int, window_flags: uint32_t, window: *mut *mut SDL_Window, renderer: *mut *mut SDL_Renderer) -> c_int;
pub fn SDL_CreateRenderer(window: *mut SDL_Window, index: c_int, flags: uint32_t) -> *mut SDL_Renderer;
pub fn SDL_CreateSoftwareRenderer(surface: *mut SDL_Surface) -> *mut SDL_Renderer;
pub fn SDL_GetRenderer(window: *mut SDL_Window) -> *mut SDL_Renderer;
pub fn SDL_GetRendererInfo(renderer: *mut SDL_Renderer, info: *mut SDL_RendererInfo) -> c_int;
pub fn SDL_GetRendererOutputSize(renderer: *mut SDL_Renderer, w: *mut c_int, h: *mut c_int) -> c_int;
pub fn SDL_CreateTexture(renderer: *mut SDL_Renderer, format: uint32_t, access: c_int, w: c_int, h: c_int) -> *mut SDL_Texture;
pub fn SDL_CreateTextureFromSurface(renderer: *mut SDL_Renderer, surface: *mut SDL_Surface) -> *mut SDL_Texture;
pub fn SDL_QueryTexture(texture: *mut SDL_Texture, format: *mut uint32_t, access: *mut c_int, w: *mut c_int, h: *mut c_int) -> c_int;
pub fn SDL_SetTextureColorMod(texture: *mut SDL_Texture, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int;
pub fn SDL_GetTextureColorMod(texture: *mut SDL_Texture, r: *mut uint8_t, g: *mut uint8_t, b: *mut uint8_t) -> c_int;
pub fn SDL_SetTextureAlphaMod(texture: *mut SDL_Texture, alpha: uint8_t) -> c_int;
pub fn SDL_GetTextureAlphaMod(texture: *mut SDL_Texture, alpha: *mut uint8_t) -> c_int;
pub fn SDL_SetTextureBlendMode(texture: *mut SDL_Texture, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetTextureBlendMode(texture: *mut SDL_Texture, blendMode: *mut SDL_BlendMode) -> c_int;
pub fn SDL_UpdateTexture(texture: *mut SDL_Texture, rect: *const SDL_Rect, pixels: *const c_void, pitch: c_int) -> c_int;
pub fn SDL_UpdateYUVTexture(texture: *mut SDL_Texture, rect: *const SDL_Rect, Yplane: *const uint8_t, Ypitch: c_int, Uplane: *const uint8_t, Upitch: c_int, Vplane: *const uint8_t, Vpitch: c_int) -> c_int;
pub fn SDL_LockTexture(texture: *mut SDL_Texture, rect: *const SDL_Rect, pixels: *mut *mut c_void, pitch: *mut c_int) -> c_int;
pub fn SDL_UnlockTexture(texture: *mut SDL_Texture);
pub fn SDL_RenderTargetSupported(renderer: *mut SDL_Renderer) -> SDL_bool;
pub fn SDL_SetRenderTarget(renderer: *mut SDL_Renderer, texture: *mut SDL_Texture) -> c_int;
pub fn SDL_GetRenderTarget(renderer: *mut SDL_Renderer) -> *mut SDL_Texture;
pub fn SDL_RenderSetLogicalSize(renderer: *mut SDL_Renderer, w: c_int, h: c_int) -> c_int;
pub fn SDL_RenderGetLogicalSize(renderer: *mut SDL_Renderer, w: *mut c_int, h: *mut c_int);
pub fn SDL_RenderSetViewport(renderer: *mut SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderGetViewport(renderer: *mut SDL_Renderer, rect: *mut SDL_Rect);
pub fn SDL_RenderSetClipRect(renderer: *mut SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderGetClipRect(renderer: *mut SDL_Renderer, rect: *mut SDL_Rect);
pub fn SDL_RenderSetScale(renderer: *mut SDL_Renderer, scaleX: c_float, scaleY: c_float) -> c_int;
pub fn SDL_RenderGetScale(renderer: *mut SDL_Renderer, scaleX: *mut c_float, scaleY: *mut c_float);
pub fn SDL_SetRenderDrawColor(renderer: *mut SDL_Renderer, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> c_int;
pub fn SDL_GetRenderDrawColor(renderer: *mut SDL_Renderer, r: *mut uint8_t, g: *mut uint8_t, b: *mut uint8_t, a: *mut uint8_t) -> c_int;
pub fn SDL_SetRenderDrawBlendMode(renderer: *mut SDL_Renderer, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetRenderDrawBlendMode(renderer: *mut SDL_Renderer, blendMode: *mut SDL_BlendMode) -> c_int;
pub fn SDL_RenderClear(renderer: *mut SDL_Renderer) -> c_int;
pub fn SDL_RenderDrawPoint(renderer: *mut SDL_Renderer, x: c_int, y: c_int) -> c_int;
pub fn SDL_RenderDrawPoints(renderer: *mut SDL_Renderer, Points: *const SDL_Point, count: c_int) -> c_int;
pub fn SDL_RenderDrawLine(renderer: *mut SDL_Renderer, x1: c_int, y1: c_int, x2: c_int, y2: c_int) -> c_int;
pub fn SDL_RenderDrawLines(renderer: *mut SDL_Renderer, Points: *const SDL_Point, count: c_int) -> c_int;
pub fn SDL_RenderDrawRect(renderer: *mut SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderDrawRects(renderer: *mut SDL_Renderer, rects: *const SDL_Rect, count: c_int) -> c_int;
pub fn SDL_RenderFillRect(renderer: *mut SDL_Renderer, rect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderFillRects(renderer: *mut SDL_Renderer, rects: *const SDL_Rect, count: c_int) -> c_int;
pub fn SDL_RenderCopy(renderer: *mut SDL_Renderer, texture: *mut SDL_Texture, srcrect: *const SDL_Rect, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_RenderCopyEx(renderer: *mut SDL_Renderer, texture: *mut SDL_Texture, srcrect: *const SDL_Rect, dstrect: *const SDL_Rect, angle: c_double, center: *const SDL_Point, flip: SDL_RendererFlip) -> c_int;
pub fn SDL_RenderReadPixels(renderer: *mut SDL_Renderer, rect: *const SDL_Rect, format: uint32_t, pixels: *mut c_void, pitch: c_int) -> c_int;
pub fn SDL_RenderPresent(renderer: *mut SDL_Renderer);
pub fn SDL_DestroyTexture(texture: *mut SDL_Texture);
pub fn SDL_DestroyRenderer(renderer: *mut SDL_Renderer);
pub fn SDL_GL_BindTexture(texture: *mut SDL_Texture, texw: *mut c_float, texh: *mut c_float) -> c_int;
pub fn SDL_GL_UnbindTexture(texture: *mut SDL_Texture) -> c_int;
}
+11 -11
View File
@@ -16,23 +16,23 @@ pub static RW_SEEK_END: c_int = 2;
#[allow(dead_code)]
#[repr(C)]
pub struct SDL_RWops {
pub size: extern "C" fn(context: *const SDL_RWops) -> int64_t,
pub seek: extern "C" fn(context: *const SDL_RWops, offset: int64_t, whence: c_int) -> int64_t,
pub read: extern "C" fn(context: *const SDL_RWops, ptr: *const c_void,
pub size: extern "C" fn(context: *mut SDL_RWops) -> int64_t,
pub seek: extern "C" fn(context: *mut SDL_RWops, offset: int64_t, whence: c_int) -> int64_t,
pub read: extern "C" fn(context: *mut SDL_RWops, ptr: *mut c_void,
size: size_t, maxnum: size_t) -> size_t,
pub write: extern "C" fn(context: *const SDL_RWops, ptr: *const c_void,
pub write: extern "C" fn(context: *mut SDL_RWops, ptr: *const c_void,
size: size_t, maxnum: size_t) -> size_t,
pub close: extern "C" fn(context: *const SDL_RWops) -> c_int,
pub close: extern "C" fn(context: *mut SDL_RWops) -> c_int,
pub type_: uint32_t,
hidden: SDL_RWops_Anon
}
extern "C" {
pub fn SDL_RWFromFile(file: *const c_char, mode: *const c_char) -> *const SDL_RWops;
pub fn SDL_RWFromFP(fp: *const FILE, autoclose: SDL_bool) -> *const SDL_RWops;
pub fn SDL_RWFromMem(mem: *const c_void, size: c_int) -> *const SDL_RWops;
pub fn SDL_RWFromConstMem(mem: *const c_void, size: c_int) -> *const SDL_RWops;
pub fn SDL_RWFromFile(file: *const c_char, mode: *const c_char) -> *mut SDL_RWops;
pub fn SDL_RWFromFP(fp: *mut FILE, autoclose: SDL_bool) -> *mut SDL_RWops;
pub fn SDL_RWFromMem(mem: *mut c_void, size: c_int) -> *mut SDL_RWops;
pub fn SDL_RWFromConstMem(mem: *const c_void, size: c_int) -> *mut SDL_RWops;
pub fn SDL_AllocRW() -> *const SDL_RWops;
pub fn SDL_FreeRW(area: *const SDL_RWops);
pub fn SDL_AllocRW() -> *mut SDL_RWops;
pub fn SDL_FreeRW(area: *mut SDL_RWops);
}
+34 -34
View File
@@ -24,47 +24,47 @@ pub struct SDL_BlitMap;
#[repr(C)]
pub struct SDL_Surface {
pub flags: uint32_t,
pub format: *const SDL_PixelFormat,
pub format: *mut SDL_PixelFormat,
pub w: c_int,
pub h: c_int,
pub pitch: c_int,
pub pixels: *const c_void,
pub userdata: *const c_void,
pub pixels: *mut c_void,
pub userdata: *mut c_void,
pub locked: c_int,
pub lock_data: *const c_void,
pub lock_data: *mut c_void,
pub clip_rect: SDL_Rect,
pub map: *const SDL_BlitMap,
pub map: *mut SDL_BlitMap,
pub refcount: c_int
}
extern "C" {
pub fn SDL_CreateRGBSurface(flags: uint32_t, width: c_int, height: c_int, depth: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *const SDL_Surface;
pub fn SDL_CreateRGBSurfaceFrom(pixels: *const c_void, width: c_int, height: c_int, depth: c_int, pitch: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *const SDL_Surface;
pub fn SDL_FreeSurface(surface: *const SDL_Surface);
pub fn SDL_SetSurfacePalette(surface: *const SDL_Surface, palette: *const SDL_Palette) -> c_int;
pub fn SDL_LockSurface(surface: *const SDL_Surface) -> c_int;
pub fn SDL_UnlockSurface(surface: *const SDL_Surface);
pub fn SDL_LoadBMP_RW(src: *const SDL_RWops, freesrc: c_int) -> *const SDL_Surface;
pub fn SDL_SaveBMP_RW(surface: *const SDL_Surface, dst: *const SDL_RWops, freedst: c_int) -> c_int;
pub fn SDL_SetSurfaceRLE(surface: *const SDL_Surface, flag: c_int) -> c_int;
pub fn SDL_SetColorKey(surface: *const SDL_Surface, flag: c_int, key: uint32_t) -> c_int;
pub fn SDL_GetColorKey(surface: *const SDL_Surface, key: *const uint32_t) -> c_int;
pub fn SDL_SetSurfaceColorMod(surface: *const SDL_Surface, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int;
pub fn SDL_GetSurfaceColorMod(surface: *const SDL_Surface, r: *const uint8_t, g: *const uint8_t, b: *const uint8_t ) -> c_int;
pub fn SDL_SetSurfaceAlphaMod(surface: *const SDL_Surface, alpha: uint8_t) -> c_int;
pub fn SDL_GetSurfaceAlphaMod(surface: *const SDL_Surface, alpha: *const uint8_t ) -> c_int;
pub fn SDL_SetSurfaceBlendMode(surface: *const SDL_Surface, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetSurfaceBlendMode(surface: *const SDL_Surface, blendMode: *const SDL_BlendMode) -> c_int;
pub fn SDL_SetClipRect(surface: *const SDL_Surface, rect: *const SDL_Rect) -> SDL_bool;
pub fn SDL_GetClipRect(surface: *const SDL_Surface, rect: *const SDL_Rect);
pub fn SDL_ConvertSurface(src: *const SDL_Surface, fmt: *const SDL_PixelFormat, flags: uint32_t) -> *const SDL_Surface;
pub fn SDL_ConvertSurfaceFormat(src: *const SDL_Surface, pixel_format: uint32_t, flags: uint32_t) -> *const SDL_Surface;
pub fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *const c_void, src_pitch: c_int, dst_format: uint32_t, dst: *const c_void, dst_pitch: c_int) -> c_int;
pub fn SDL_FillRect(dst: *const SDL_Surface, rect: *const SDL_Rect, color: uint32_t) -> c_int;
pub fn SDL_FillRects(dst: *const SDL_Surface, rects: *const SDL_Rect, count: c_int, color: uint32_t) -> c_int;
pub fn SDL_UpperBlit(src: *const SDL_Surface, srcrect: *const SDL_Rect, dst: *const SDL_Surface, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_LowerBlit(src: *const SDL_Surface, srcrect: *const SDL_Rect, dst: *const SDL_Surface, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_SoftStretch(src: *const SDL_Surface, srcrect: *const SDL_Rect, dst: *const SDL_Surface, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_UpperBlitScaled(src: *const SDL_Surface, srcrect: *const SDL_Rect, dst: *const SDL_Surface, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_LowerBlitScaled(src: *const SDL_Surface, srcrect: *const SDL_Rect, dst: *const SDL_Surface, dstrect: *const SDL_Rect) -> c_int;
pub fn SDL_CreateRGBSurface(flags: uint32_t, width: c_int, height: c_int, depth: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *mut SDL_Surface;
pub fn SDL_CreateRGBSurfaceFrom(pixels: *mut c_void, width: c_int, height: c_int, depth: c_int, pitch: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *mut SDL_Surface;
pub fn SDL_FreeSurface(surface: *mut SDL_Surface);
pub fn SDL_SetSurfacePalette(surface: *mut SDL_Surface, palette: *mut SDL_Palette) -> c_int;
pub fn SDL_LockSurface(surface: *mut SDL_Surface) -> c_int;
pub fn SDL_UnlockSurface(surface: *mut SDL_Surface);
pub fn SDL_LoadBMP_RW(src: *mut SDL_RWops, freesrc: c_int) -> *mut SDL_Surface;
pub fn SDL_SaveBMP_RW(surface: *mut SDL_Surface, dst: *mut SDL_RWops, freedst: c_int) -> c_int;
pub fn SDL_SetSurfaceRLE(surface: *mut SDL_Surface, flag: c_int) -> c_int;
pub fn SDL_SetColorKey(surface: *mut SDL_Surface, flag: c_int, key: uint32_t) -> c_int;
pub fn SDL_GetColorKey(surface: *mut SDL_Surface, key: *mut uint32_t) -> c_int;
pub fn SDL_SetSurfaceColorMod(surface: *mut SDL_Surface, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int;
pub fn SDL_GetSurfaceColorMod(surface: *mut SDL_Surface, r: *mut uint8_t, g: *mut uint8_t, b: *mut uint8_t ) -> c_int;
pub fn SDL_SetSurfaceAlphaMod(surface: *mut SDL_Surface, alpha: uint8_t) -> c_int;
pub fn SDL_GetSurfaceAlphaMod(surface: *mut SDL_Surface, alpha: *mut uint8_t ) -> c_int;
pub fn SDL_SetSurfaceBlendMode(surface: *mut SDL_Surface, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetSurfaceBlendMode(surface: *mut SDL_Surface, blendMode: *mut SDL_BlendMode) -> c_int;
pub fn SDL_SetClipRect(surface: *mut SDL_Surface, rect: *const SDL_Rect) -> SDL_bool;
pub fn SDL_GetClipRect(surface: *mut SDL_Surface, rect: *mut SDL_Rect);
pub fn SDL_ConvertSurface(src: *mut SDL_Surface, fmt: *mut SDL_PixelFormat, flags: uint32_t) -> *mut SDL_Surface;
pub fn SDL_ConvertSurfaceFormat(src: *mut SDL_Surface, pixel_format: uint32_t, flags: uint32_t) -> *mut SDL_Surface;
pub fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *const c_void, src_pitch: c_int, dst_format: uint32_t, dst: *mut c_void, dst_pitch: c_int) -> c_int;
pub fn SDL_FillRect(dst: *mut SDL_Surface, rect: *const SDL_Rect, color: uint32_t) -> c_int;
pub fn SDL_FillRects(dst: *mut SDL_Surface, rects: *const SDL_Rect, count: c_int, color: uint32_t) -> c_int;
pub fn SDL_UpperBlit(src: *mut SDL_Surface, srcrect: *mut SDL_Rect, dst: *mut SDL_Surface, dstrect: *mut SDL_Rect) -> c_int;
pub fn SDL_LowerBlit(src: *mut SDL_Surface, srcrect: *mut SDL_Rect, dst: *mut SDL_Surface, dstrect: *mut SDL_Rect) -> c_int;
pub fn SDL_SoftStretch(src: *mut SDL_Surface, srcrect: *mut SDL_Rect, dst: *mut SDL_Surface, dstrect: *mut SDL_Rect) -> c_int;
pub fn SDL_UpperBlitScaled(src: *mut SDL_Surface, srcrect: *mut SDL_Rect, dst: *mut SDL_Surface, dstrect: *mut SDL_Rect) -> c_int;
pub fn SDL_LowerBlitScaled(src: *mut SDL_Surface, srcrect: *mut SDL_Rect, dst: *mut SDL_Surface, dstrect: *mut SDL_Rect) -> c_int;
}
+2 -2
View File
@@ -4,7 +4,7 @@ use libc::{uint32_t, uint64_t, c_void, c_int};
//SDL_timer.h
pub type SDL_TimerCallback =
Option<extern "C" fn(arg1: uint32_t, arg2: *const c_void) -> uint32_t>;
Option<extern "C" fn(arg1: uint32_t, arg2: *mut c_void) -> uint32_t>;
pub type SDL_TimerID = c_int;
extern "C" {
pub fn SDL_GetTicks() -> uint32_t;
@@ -13,6 +13,6 @@ extern "C" {
pub fn SDL_Delay(ms: uint32_t);
pub fn SDL_AddTimer(interval: uint32_t, callback: SDL_TimerCallback,
param: *const c_void) -> SDL_TimerID;
param: *mut c_void) -> SDL_TimerID;
pub fn SDL_RemoveTimer(id: SDL_TimerID) -> c_int;
}
+1 -1
View File
@@ -19,5 +19,5 @@ extern "C" {
pub fn SDL_GetTouchDevice(index: c_int) -> SDL_TouchID;
pub fn SDL_GetNumTouchFingers(touchID: SDL_TouchID) -> c_int;
pub fn SDL_GetTouchFinger(touchID: SDL_TouchID, index: c_int) ->
*const SDL_Finger;
*mut SDL_Finger;
}
+52 -52
View File
@@ -21,7 +21,7 @@ pub struct SDL_DisplayMode {
pub w: c_int,
pub h: c_int,
pub refresh_rate: c_int,
pub driverdata: *const c_void
pub driverdata: *mut c_void
}
pub type SDL_WindowPos = c_int;
@@ -148,68 +148,68 @@ extern "C" {
pub fn SDL_GetCurrentVideoDriver() -> *const c_char;
pub fn SDL_GetNumVideoDisplays() -> c_int;
pub fn SDL_GetDisplayName(displayIndex: c_int) -> *const c_char;
pub fn SDL_GetDisplayBounds(displayIndex: c_int, rect: *const SDL_Rect) -> c_int;
pub fn SDL_GetDisplayBounds(displayIndex: c_int, rect: *mut SDL_Rect) -> c_int;
pub fn SDL_GetNumDisplayModes(displayIndex: c_int) -> c_int;
pub fn SDL_GetDisplayMode(displayIndex: c_int, modeIndex: c_int, mode: *const SDL_DisplayMode) -> c_int;
pub fn SDL_GetDesktopDisplayMode(displayIndex: c_int, mode: *const SDL_DisplayMode) -> c_int;
pub fn SDL_GetCurrentDisplayMode(displayIndex: c_int, mode: *const SDL_DisplayMode) -> c_int;
pub fn SDL_GetClosestDisplayMode(displayIndex: c_int, mode: *const SDL_DisplayMode, closest: *const SDL_DisplayMode) -> *const SDL_DisplayMode;
pub fn SDL_GetWindowDisplayIndex(window: *const SDL_Window) -> c_int;
pub fn SDL_SetWindowDisplayMode(window: *const SDL_Window, mode: *const SDL_DisplayMode) -> c_int;
pub fn SDL_GetWindowDisplayMode(window: *const SDL_Window, mode: *const SDL_DisplayMode) -> c_int;
pub fn SDL_GetWindowPixelFormat(window: *const SDL_Window) -> uint32_t;
pub fn SDL_CreateWindow(title: *const c_char, x: c_int, y: c_int, w: c_int, h: c_int, flags: uint32_t) -> *const SDL_Window;
pub fn SDL_CreateWindowFrom(data: *const c_void) -> *const SDL_Window;
pub fn SDL_GetWindowID(window: *const SDL_Window) -> uint32_t;
pub fn SDL_GetWindowFromID(id: uint32_t) -> *const SDL_Window;
pub fn SDL_GetWindowFlags(window: *const SDL_Window) -> uint32_t;
pub fn SDL_SetWindowTitle(window: *const SDL_Window, title: *const c_char);
pub fn SDL_GetWindowTitle(window: *const SDL_Window) -> *const c_char;
pub fn SDL_SetWindowIcon(window: *const SDL_Window, icon: *const SDL_Surface);
pub fn SDL_SetWindowData(window: *const SDL_Window, name: *const c_char, userdata: *const c_void) -> *const c_void;
pub fn SDL_GetWindowData(window: *const SDL_Window, name: *const c_char) -> *const c_void;
pub fn SDL_SetWindowPosition(window: *const SDL_Window, x: c_int, y: c_int);
pub fn SDL_GetWindowPosition(window: *const SDL_Window, x: *const c_int, y: *const c_int);
pub fn SDL_SetWindowSize(window: *const SDL_Window, w: c_int, h: c_int);
pub fn SDL_GetWindowSize(window: *const SDL_Window, w: *const c_int, h: *const c_int);
pub fn SDL_SetWindowMinimumSize(window: *const SDL_Window, min_w: c_int, min_h: c_int);
pub fn SDL_GetWindowMinimumSize(window: *const SDL_Window, w: *const c_int, h: *const c_int);
pub fn SDL_SetWindowMaximumSize(window: *const SDL_Window, max_w: c_int, max_h: c_int);
pub fn SDL_GetWindowMaximumSize(window: *const SDL_Window, w: *const c_int, h: *const c_int);
pub fn SDL_SetWindowBordered(window: *const SDL_Window, bordered: SDL_bool);
pub fn SDL_ShowWindow(window: *const SDL_Window);
pub fn SDL_HideWindow(window: *const SDL_Window);
pub fn SDL_RaiseWindow(window: *const SDL_Window);
pub fn SDL_MaximizeWindow(window: *const SDL_Window);
pub fn SDL_MinimizeWindow(window: *const SDL_Window);
pub fn SDL_RestoreWindow(window: *const SDL_Window);
pub fn SDL_SetWindowFullscreen(window: *const SDL_Window, flags: uint32_t) -> c_int;
pub fn SDL_GetWindowSurface(window: *const SDL_Window) -> *const SDL_Surface;
pub fn SDL_UpdateWindowSurface(window: *const SDL_Window) -> c_int;
pub fn SDL_UpdateWindowSurfaceRects(window: *const SDL_Window, rects: *const SDL_Rect, numrects: c_int) -> c_int;
pub fn SDL_SetWindowGrab(window: *const SDL_Window, grabbed: SDL_bool);
pub fn SDL_GetWindowGrab(window: *const SDL_Window) -> SDL_bool;
pub fn SDL_SetWindowBrightness(window: *const SDL_Window, brightness: c_float) -> c_int;
pub fn SDL_GetWindowBrightness(window: *const SDL_Window) -> c_float;
pub fn SDL_SetWindowGammaRamp(window: *const SDL_Window, red: *const uint16_t, green: *const uint16_t, blue: *const uint16_t) -> c_int;
pub fn SDL_GetWindowGammaRamp(window: *const SDL_Window, red: *const uint16_t, green: *const uint16_t, blue: *const uint16_t) -> c_int;
pub fn SDL_DestroyWindow(window: *const SDL_Window);
pub fn SDL_GetDisplayMode(displayIndex: c_int, modeIndex: c_int, mode: *mut SDL_DisplayMode) -> c_int;
pub fn SDL_GetDesktopDisplayMode(displayIndex: c_int, mode: *mut SDL_DisplayMode) -> c_int;
pub fn SDL_GetCurrentDisplayMode(displayIndex: c_int, mode: *mut SDL_DisplayMode) -> c_int;
pub fn SDL_GetClosestDisplayMode(displayIndex: c_int, mode: *const SDL_DisplayMode, closest: *mut SDL_DisplayMode) -> *mut SDL_DisplayMode;
pub fn SDL_GetWindowDisplayIndex(window: *mut SDL_Window) -> c_int;
pub fn SDL_SetWindowDisplayMode(window: *mut SDL_Window, mode: *const SDL_DisplayMode) -> c_int;
pub fn SDL_GetWindowDisplayMode(window: *mut SDL_Window, mode: *mut SDL_DisplayMode) -> c_int;
pub fn SDL_GetWindowPixelFormat(window: *mut SDL_Window) -> uint32_t;
pub fn SDL_CreateWindow(title: *const c_char, x: c_int, y: c_int, w: c_int, h: c_int, flags: uint32_t) -> *mut SDL_Window;
pub fn SDL_CreateWindowFrom(data: *const c_void) -> *mut SDL_Window;
pub fn SDL_GetWindowID(window: *mut SDL_Window) -> uint32_t;
pub fn SDL_GetWindowFromID(id: uint32_t) -> *mut SDL_Window;
pub fn SDL_GetWindowFlags(window: *mut SDL_Window) -> uint32_t;
pub fn SDL_SetWindowTitle(window: *mut SDL_Window, title: *const c_char);
pub fn SDL_GetWindowTitle(window: *mut SDL_Window) -> *const c_char;
pub fn SDL_SetWindowIcon(window: *mut SDL_Window, icon: *mut SDL_Surface);
pub fn SDL_SetWindowData(window: *mut SDL_Window, name: *const c_char, userdata: *const c_void) -> *const c_void;
pub fn SDL_GetWindowData(window: *mut SDL_Window, name: *const c_char) -> *mut c_void;
pub fn SDL_SetWindowPosition(window: *mut SDL_Window, x: c_int, y: c_int);
pub fn SDL_GetWindowPosition(window: *mut SDL_Window, x: *const c_int, y: *const c_int);
pub fn SDL_SetWindowSize(window: *mut SDL_Window, w: c_int, h: c_int);
pub fn SDL_GetWindowSize(window: *mut SDL_Window, w: *mut c_int, h: *mut c_int);
pub fn SDL_SetWindowMinimumSize(window: *mut SDL_Window, min_w: c_int, min_h: c_int);
pub fn SDL_GetWindowMinimumSize(window: *mut SDL_Window, w: *mut c_int, h: *mut c_int);
pub fn SDL_SetWindowMaximumSize(window: *mut SDL_Window, max_w: c_int, max_h: c_int);
pub fn SDL_GetWindowMaximumSize(window: *mut SDL_Window, w: *mut c_int, h: *mut c_int);
pub fn SDL_SetWindowBordered(window: *mut SDL_Window, bordered: SDL_bool);
pub fn SDL_ShowWindow(window: *mut SDL_Window);
pub fn SDL_HideWindow(window: *mut SDL_Window);
pub fn SDL_RaiseWindow(window: *mut SDL_Window);
pub fn SDL_MaximizeWindow(window: *mut SDL_Window);
pub fn SDL_MinimizeWindow(window: *mut SDL_Window);
pub fn SDL_RestoreWindow(window: *mut SDL_Window);
pub fn SDL_SetWindowFullscreen(window: *mut SDL_Window, flags: uint32_t) -> c_int;
pub fn SDL_GetWindowSurface(window: *mut SDL_Window) -> *mut SDL_Surface;
pub fn SDL_UpdateWindowSurface(window: *mut SDL_Window) -> c_int;
pub fn SDL_UpdateWindowSurfaceRects(window: *mut SDL_Window, rects: *const SDL_Rect, numrects: c_int) -> c_int;
pub fn SDL_SetWindowGrab(window: *mut SDL_Window, grabbed: SDL_bool);
pub fn SDL_GetWindowGrab(window: *mut SDL_Window) -> SDL_bool;
pub fn SDL_SetWindowBrightness(window: *mut SDL_Window, brightness: c_float) -> c_int;
pub fn SDL_GetWindowBrightness(window: *mut SDL_Window) -> c_float;
pub fn SDL_SetWindowGammaRamp(window: *mut SDL_Window, red: *const uint16_t, green: *const uint16_t, blue: *const uint16_t) -> c_int;
pub fn SDL_GetWindowGammaRamp(window: *mut SDL_Window, red: *mut uint16_t, green: *mut uint16_t, blue: *mut uint16_t) -> c_int;
pub fn SDL_DestroyWindow(window: *mut SDL_Window);
pub fn SDL_IsScreenSaverEnabled() -> SDL_bool;
pub fn SDL_EnableScreenSaver();
pub fn SDL_DisableScreenSaver();
pub fn SDL_GL_GetDrawableSize(window: *const SDL_Window, w: *const c_int, h: *const c_int);
pub fn SDL_GL_GetDrawableSize(window: *mut SDL_Window, w: *mut c_int, h: *mut c_int);
pub fn SDL_GL_LoadLibrary(path: *const c_char) -> c_int;
pub fn SDL_GL_GetProcAddress(procname: *const c_char) -> Option<extern "system" fn()>;
pub fn SDL_GL_UnloadLibrary();
pub fn SDL_GL_ExtensionSupported(extension: *const c_char) -> SDL_bool;
pub fn SDL_GL_SetAttribute(attr: SDL_GLattr, value: c_int) -> c_int;
pub fn SDL_GL_GetAttribute(attr: SDL_GLattr, value: *const c_int) -> c_int;
pub fn SDL_GL_CreateContext(window: *const SDL_Window) -> SDL_GLContext;
pub fn SDL_GL_MakeCurrent(window: *const SDL_Window, context: SDL_GLContext) -> c_int;
pub fn SDL_GL_GetCurrentWindow() -> *const SDL_Window;
pub fn SDL_GL_GetAttribute(attr: SDL_GLattr, value: *mut c_int) -> c_int;
pub fn SDL_GL_CreateContext(window: *mut SDL_Window) -> SDL_GLContext;
pub fn SDL_GL_MakeCurrent(window: *mut SDL_Window, context: SDL_GLContext) -> c_int;
pub fn SDL_GL_GetCurrentWindow() -> *mut SDL_Window;
pub fn SDL_GL_GetCurrentContext() -> SDL_GLContext;
pub fn SDL_GL_SetSwapInterval(interval: c_int) -> c_int;
pub fn SDL_GL_GetSwapInterval() -> c_int;
pub fn SDL_GL_SwapWindow(window: *const SDL_Window);
pub fn SDL_GL_SwapWindow(window: *mut SDL_Window);
pub fn SDL_GL_DeleteContext(context: SDL_GLContext);
}
+1 -1
View File
@@ -183,7 +183,7 @@ pub fn mapping_for_guid(guid: joystick::Guid) -> SdlResult<String> {
/// Wrapper around the SDL_GameController object
pub struct GameController {
raw: *const ll::SDL_GameController,
raw: *mut ll::SDL_GameController,
}
impl GameController {
+8 -8
View File
@@ -486,8 +486,8 @@ impl Event {
timestamp: 0,
windowID: window_id,
code: code as i32,
data1: ptr::null(),
data2: ptr::null(),
data1: ptr::null_mut(),
data2: ptr::null_mut(),
};
unsafe {
ptr::copy(&event, &mut ret as *mut ll::SDL_Event as *mut ll::SDL_UserEvent, 1);
@@ -501,7 +501,7 @@ impl Event {
}
}
fn from_ll(raw: &ll::SDL_Event) -> Event {
fn from_ll(mut raw: ll::SDL_Event) -> Event {
let raw_type = raw.type_();
let raw_type = if raw_type.is_null() {
panic!("Event payload is null")
@@ -864,7 +864,7 @@ impl Event {
let buf = CStr::from_ptr(event.file).to_bytes();
let text = String::from_utf8_lossy(buf).to_string();
ll::SDL_free(event.file as *const c_void);
ll::SDL_free(event.file as *mut c_void);
Event::DropFile {
timestamp: event.timestamp,
@@ -918,7 +918,7 @@ impl<'sdl> EventPump<'sdl> {
let mut raw = unsafe { mem::uninitialized() };
let has_pending = unsafe { ll::SDL_PollEvent(&mut raw) == 1 as c_int };
if has_pending { Some(Event::from_ll(&raw)) }
if has_pending { Some(Event::from_ll(raw)) }
else { None }
}
@@ -955,7 +955,7 @@ impl<'sdl> EventPump<'sdl> {
let mut raw = mem::uninitialized();
let success = ll::SDL_WaitEvent(&mut raw) == 1;
if success { Event::from_ll(&raw) }
if success { Event::from_ll(raw) }
else { panic!(get_error()) }
}
}
@@ -966,7 +966,7 @@ impl<'sdl> EventPump<'sdl> {
let mut raw = mem::uninitialized();
let success = ll::SDL_WaitEventTimeout(&mut raw, timeout as c_int) == 1;
if success { Some(Event::from_ll(&raw)) }
if success { Some(Event::from_ll(raw)) }
else { None }
}
}
@@ -1089,7 +1089,7 @@ where B: FromIterator<Event>
} else {
events.set_len(max_amount as usize);
events.iter().map(|event_raw| {
events.into_iter().map(|event_raw| {
Event::from_ll(event_raw)
}).collect()
}

Some files were not shown because too many files have changed in this diff Show More