diff --git a/a_types.c.v b/a_types.c.v new file mode 100644 index 00000000..dcd98466 --- /dev/null +++ b/a_types.c.v @@ -0,0 +1,5 @@ +module sdl + +// va_list +[typedef] +pub struct C.va_list {} diff --git a/audio.c.v b/audio.c.v index 0e003bd9..e6c03669 100644 --- a/audio.c.v +++ b/audio.c.v @@ -620,7 +620,7 @@ pub fn open_audio_device(const_device &char, iscapture int, const_desired &Audio allowed_changes)) } -fn C.SDL_OpenAudioDevice(const_device &char, iscapture int, const_desired &C.SDL_AudioSpec, obtained &C.SDL_AudioSpec, allowed_changes int) C.SDL_AudioDeviceID +fn C.SDL_OpenAudioDevice(const_device &char, iscapture int, const_desired &C.SDL_AudioSpec, obtained &C.SDL_AudioSpec, allowed_changes int) AudioDeviceID // AudioStatus // @@ -634,7 +634,7 @@ pub enum AudioStatus { audio_paused = C.SDL_AUDIO_PAUSED } -fn C.SDL_GetAudioStatus() C.SDL_AudioStatus +fn C.SDL_GetAudioStatus() AudioStatus // get_audio_status is a legacy means of querying the audio device. // @@ -656,7 +656,7 @@ pub fn get_audio_status() AudioStatus { return AudioStatus(C.SDL_GetAudioStatus()) } -fn C.SDL_GetAudioDeviceStatus(dev C.SDL_AudioDeviceID) C.SDL_AudioStatus +fn C.SDL_GetAudioDeviceStatus(dev AudioDeviceID) AudioStatus // get_audio_device_status gets the current audio state of an audio device. // @@ -668,7 +668,7 @@ fn C.SDL_GetAudioDeviceStatus(dev C.SDL_AudioDeviceID) C.SDL_AudioStatus // // See also: SDL_PauseAudioDevice pub fn get_audio_device_status(dev AudioDeviceID) AudioStatus { - return AudioStatus(C.SDL_GetAudioDeviceStatus(C.SDL_AudioDeviceID(dev))) + return AudioStatus(C.SDL_GetAudioDeviceStatus(dev)) } // Pause audio functions diff --git a/blendmode.c.v b/blendmode.c.v index 39ad0e19..e76caa68 100644 --- a/blendmode.c.v +++ b/blendmode.c.v @@ -43,7 +43,7 @@ pub enum BlendFactor { one_minus_dst_alpha = C.SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA // 0xA, 1-dstA, 1-dstA, 1-dstA, 1-dstA } -fn C.SDL_ComposeCustomBlendMode(src_color_factor C.SDL_BlendFactor, dst_color_factor C.SDL_BlendFactor, color_operation C.SDL_BlendOperation, src_alpha_factor C.SDL_BlendFactor, dst_alpha_factor C.SDL_BlendFactor, alpha_operation C.SDL_BlendOperation) C.SDL_BlendMode +fn C.SDL_ComposeCustomBlendMode(src_color_factor C.SDL_BlendFactor, dst_color_factor C.SDL_BlendFactor, color_operation C.SDL_BlendOperation, src_alpha_factor C.SDL_BlendFactor, dst_alpha_factor C.SDL_BlendFactor, alpha_operation C.SDL_BlendOperation) BlendMode // compose_custom_blend_mode composes a custom blend mode for renderers. // diff --git a/events.c.v b/events.c.v index b7e7a208..92f9965d 100644 --- a/events.c.v +++ b/events.c.v @@ -414,11 +414,11 @@ pub type ControllerTouchpadEvent = C.SDL_ControllerTouchpadEvent [typedef] pub struct C.SDL_ControllerSensorEvent { pub: - @type u32 // ::SDL_CONTROLLERSENSORUPDATE - timestamp u32 // In milliseconds, populated using SDL_GetTicks() - which C.SDL_JoystickID // The joystick instance id - sensor int // The type of the sensor, one of the values of ::SDL_SensorType - data [3]f32 // Up to 3 values from the sensor, as defined in SDL_sensor.h + @type u32 // ::SDL_CONTROLLERSENSORUPDATE + timestamp u32 // In milliseconds, populated using SDL_GetTicks() + which JoystickID // The joystick instance id + sensor int // The type of the sensor, one of the values of ::SDL_SensorType + data [3]f32 // Up to 3 values from the sensor, as defined in SDL_sensor.h } pub type ControllerSensorEvent = C.SDL_ControllerSensorEvent diff --git a/gamecontroller.c.v b/gamecontroller.c.v index d5cdd511..21ebd44c 100644 --- a/gamecontroller.c.v +++ b/gamecontroller.c.v @@ -278,7 +278,7 @@ pub fn game_controller_name_for_index(joystick_index int) &char { return C.SDL_GameControllerNameForIndex(joystick_index) } -fn C.SDL_GameControllerTypeForIndex(joystick_index int) C.SDL_GameControllerType +fn C.SDL_GameControllerTypeForIndex(joystick_index int) GameControllerType // game_controller_type_for_index gets the type of a game controller. // @@ -387,7 +387,7 @@ pub fn game_controller_name(gamecontroller &GameController) &char { return C.SDL_GameControllerName(gamecontroller) } -fn C.SDL_GameControllerGetType(gamecontroller &C.SDL_GameController) C.SDL_GameControllerType +fn C.SDL_GameControllerGetType(gamecontroller &C.SDL_GameController) GameControllerType // game_controller_get_type gets the type of this currently opened controller // @@ -580,7 +580,7 @@ pub enum GameControllerAxis { max = C.SDL_CONTROLLER_AXIS_MAX } -fn C.SDL_GameControllerGetAxisFromString(const_str &char) C.SDL_GameControllerAxis +fn C.SDL_GameControllerGetAxisFromString(const_str &char) GameControllerAxis // game_controller_get_axis_from_string converts a string into SDL_GameControllerAxis enum. // @@ -704,7 +704,7 @@ pub enum GameControllerButton { max = C.SDL_CONTROLLER_BUTTON_MAX } -fn C.SDL_GameControllerGetButtonFromString(const_str &char) C.SDL_GameControllerButton +fn C.SDL_GameControllerGetButtonFromString(const_str &char) GameControllerButton // game_controller_get_button_from_string converts a string into an SDL_GameControllerButton enum. // @@ -1027,7 +1027,7 @@ pub fn game_controller_close(gamecontroller &GameController) { C.SDL_GameControllerClose(gamecontroller) } -fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &C.SDL_GameController, button C.SDL_GameControllerButton) &char +fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &GameController, button GameControllerButton) &char // game_controller_get_apple_sf_symbols_name_for_button returns the sfSymbolsName for a given button on a game controller on Apple // platforms. @@ -1039,11 +1039,11 @@ fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &C.SDL_Game // NOTE This function is available since SDL 2.0.18. // // See also: SDL_GameControllerGetAppleSFSymbolsNameForAxis -pub fn game_controller_get_apple_sf_symbols_name_for_button(gamecontroller &C.SDL_GameController, button C.SDL_GameControllerButton) &char { +pub fn game_controller_get_apple_sf_symbols_name_for_button(gamecontroller &GameController, button GameControllerButton) &char { return C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller, button) } -fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &C.SDL_GameController, axis C.SDL_GameControllerAxis) &char +fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &GameController, axis GameControllerAxis) &char // game_controller_get_apple_sf_symbols_name_for_axis returns the sfSymbolsName for a given axis on a game controller on Apple // platforms. @@ -1055,6 +1055,6 @@ fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &C.SDL_GameCo // NOTE This function is available since SDL 2.0.18. // // See also: SDL_GameControllerGetAppleSFSymbolsNameForButton -pub fn game_controller_get_apple_sf_symbols_name_for_axis(gamecontroller &C.SDL_GameController, axis C.SDL_GameControllerAxis) &char { +pub fn game_controller_get_apple_sf_symbols_name_for_axis(gamecontroller &GameController, axis GameControllerAxis) &char { return C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller, axis) } diff --git a/joystick.c.v b/joystick.c.v index 509b3176..26c083e9 100644 --- a/joystick.c.v +++ b/joystick.c.v @@ -53,8 +53,8 @@ pub enum JoystickType { throttle } -// C.SDL_JoystickID // Sint32 / int -pub type JoystickID = int +// C.SDL_JoystickID // Sint32 +pub type JoystickID = i32 // JoystickPowerLevel is C.SDL_JoystickPowerLevel pub enum JoystickPowerLevel { @@ -218,7 +218,7 @@ pub fn joystick_get_device_product_version(device_index int) u16 { return C.SDL_JoystickGetDeviceProductVersion(device_index) } -fn C.SDL_JoystickGetDeviceType(device_index int) C.SDL_JoystickType +fn C.SDL_JoystickGetDeviceType(device_index int) JoystickType // joystick_get_device_type gets the type of a joystick, if available. // @@ -234,7 +234,7 @@ pub fn joystick_get_device_type(device_index int) JoystickType { return unsafe { JoystickType(int(C.SDL_JoystickGetDeviceType(device_index))) } } -fn C.SDL_JoystickGetDeviceInstanceID(device_index int) C.SDL_JoystickID +fn C.SDL_JoystickGetDeviceInstanceID(device_index int) JoystickID // joystick_get_device_instance_id gets the instance ID of a joystick. // @@ -516,7 +516,7 @@ pub fn joystick_get_serial(joystick &Joystick) &char { return C.SDL_JoystickGetSerial(joystick) } -fn C.SDL_JoystickGetType(joystick &C.SDL_Joystick) C.SDL_JoystickType +fn C.SDL_JoystickGetType(joystick &C.SDL_Joystick) JoystickType // joystick_get_type gets the type of an opened joystick. // @@ -581,7 +581,7 @@ pub fn joystick_get_attached(joystick &Joystick) bool { return C.SDL_JoystickGetAttached(joystick) } -fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) C.SDL_JoystickID +fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) JoystickID // joystick_instance_id gets the instance ID of an opened joystick. // @@ -592,7 +592,7 @@ fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) C.SDL_JoystickID // NOTE This function is available since SDL 2.0.0. // // See also: SDL_JoystickOpen -pub fn joystick_instance_id(joystick &Joystick) C.SDL_JoystickID { +pub fn joystick_instance_id(joystick &Joystick) JoystickID { return C.SDL_JoystickInstanceID(joystick) } @@ -958,7 +958,7 @@ pub fn joystick_close(joystick &Joystick) { C.SDL_JoystickClose(joystick) } -fn C.SDL_JoystickCurrentPowerLevel(joystick &C.SDL_Joystick) C.SDL_JoystickPowerLevel +fn C.SDL_JoystickCurrentPowerLevel(joystick &C.SDL_Joystick) JoystickPowerLevel // joystick_current_power_level gets the battery level of a joystick as SDL_JoystickPowerLevel. // diff --git a/keyboard.c.v b/keyboard.c.v index e615c348..950e942c 100644 --- a/keyboard.c.v +++ b/keyboard.c.v @@ -65,7 +65,7 @@ pub fn get_keyboard_state(numkeys &int) &u8 { return C.SDL_GetKeyboardState(numkeys) } -fn C.SDL_GetModState() C.SDL_Keymod +fn C.SDL_GetModState() Keymod // get_mod_state gets the current key modifier state for the keyboard. // @@ -101,7 +101,7 @@ pub fn set_mod_state(modstate Keymod) { C.SDL_SetModState(C.SDL_Keymod(modstate)) } -fn C.SDL_GetKeyFromScancode(scancode C.SDL_Scancode) C.SDL_Keycode +fn C.SDL_GetKeyFromScancode(scancode C.SDL_Scancode) Keycode // get_key_from_scancode gets the key code corresponding to the given scancode according to the // current keyboard layout. @@ -119,7 +119,7 @@ pub fn get_key_from_scancode(scancode Scancode) Keycode { return Keycode(int(C.SDL_GetKeyFromScancode(C.SDL_Scancode(scancode)))) } -fn C.SDL_GetScancodeFromKey(key C.SDL_Keycode) C.SDL_Scancode +fn C.SDL_GetScancodeFromKey(key C.SDL_Keycode) Scancode // get_scancode_from_key gets the scancode corresponding to the given key code according to the // current keyboard layout. @@ -164,7 +164,7 @@ pub fn get_scancode_name(scancode Scancode) &char { return C.SDL_GetScancodeName(C.SDL_Scancode(scancode)) } -fn C.SDL_GetScancodeFromName(name &char) C.SDL_Scancode +fn C.SDL_GetScancodeFromName(name &char) Scancode // get_scancode_from_name gets a scancode from a human-readable name. // @@ -202,7 +202,7 @@ pub fn get_key_name(key Keycode) &char { return C.SDL_GetKeyName(C.SDL_Keycode(key)) } -fn C.SDL_GetKeyFromName(name &char) C.SDL_Keycode +fn C.SDL_GetKeyFromName(name &char) Keycode // get_key_from_name gets a key code from a human-readable name. // diff --git a/log.c.v b/log.c.v index c6d3a336..6af0b57e 100644 --- a/log.c.v +++ b/log.c.v @@ -91,7 +91,7 @@ pub fn log_set_priority(category int, priority LogPriority) { C.SDL_LogSetPriority(category, C.SDL_LogPriority(int(priority))) } -fn C.SDL_LogGetPriority(category int) C.SDL_LogPriority +fn C.SDL_LogGetPriority(category int) LogPriority // log_get_priority gets the priority of a particular log category. // diff --git a/metal.c.v b/metal.c.v index e6f57c72..00947f65 100644 --- a/metal.c.v +++ b/metal.c.v @@ -16,7 +16,7 @@ module sdl pub type MetalView = voidptr // Metal support functions -fn C.SDL_Metal_CreateView(window &C.SDL_Window) C.SDL_MetalView +fn C.SDL_Metal_CreateView(window &C.SDL_Window) MetalView // metal_create_view creates a CAMetalLayer-backed NSView/UIView and attach it to the specified // window. diff --git a/mixer/mixer.c.v b/mixer/mixer.c.v index 5bd6d050..63e1d919 100644 --- a/mixer/mixer.c.v +++ b/mixer/mixer.c.v @@ -277,7 +277,7 @@ pub fn has_music_decoder(name &char) bool { } */ -fn C.Mix_GetMusicType(music &C.Mix_Music) C.Mix_MusicType +fn C.Mix_GetMusicType(music &C.Mix_Music) MusicType // get_music_type finds out the music format of a mixer music, or the currently playing // music, if 'music' is NULL. @@ -749,14 +749,14 @@ pub fn fade_out_music(ms int) int { return C.Mix_FadeOutMusic(ms) } -fn C.Mix_FadingMusic() C.Mix_Fading +fn C.Mix_FadingMusic() Fading // fading_music queries the fading status of a channel pub fn fading_music() Fading { return Fading(C.Mix_FadingMusic()) } -fn C.Mix_FadingChannel(which int) C.Mix_Fading +fn C.Mix_FadingChannel(which int) Fading pub fn fading_channel(which int) Fading { return Fading(C.Mix_FadingChannel(which)) } diff --git a/power.c.v b/power.c.v index ebc6f3b4..2758233c 100644 --- a/power.c.v +++ b/power.c.v @@ -17,7 +17,7 @@ pub enum PowerState { charged = C.SDL_POWERSTATE_CHARGED // Plugged in, battery charged } -fn C.SDL_GetPowerInfo(secs &int, pct &int) C.SDL_PowerState +fn C.SDL_GetPowerInfo(secs &int, pct &int) PowerState // get_power_info gets the current power supply details. // diff --git a/sensor.c.v b/sensor.c.v index f14eda69..090ec12c 100644 --- a/sensor.c.v +++ b/sensor.c.v @@ -134,7 +134,7 @@ pub fn sensor_get_device_name(device_index int) &char { return C.SDL_SensorGetDeviceName(device_index) } -fn C.SDL_SensorGetDeviceType(device_index int) C.SDL_SensorType +fn C.SDL_SensorGetDeviceType(device_index int) SensorType // sensor_get_device_type gets the type of a sensor. // @@ -160,7 +160,7 @@ pub fn sensor_get_device_non_portable_type(device_index int) int { return C.SDL_SensorGetDeviceNonPortableType(device_index) } -fn C.SDL_SensorGetDeviceInstanceID(device_index int) C.SDL_SensorID +fn C.SDL_SensorGetDeviceInstanceID(device_index int) SensorID // sensor_get_device_instance_id gets the instance ID of a sensor. // @@ -184,7 +184,7 @@ pub fn sensor_open(device_index int) &Sensor { return C.SDL_SensorOpen(device_index) } -fn C.SDL_SensorFromInstanceID(instance_id C.SDL_SensorID) &C.SDL_Sensor +fn C.SDL_SensorFromInstanceID(instance_id SensorID) &Sensor // sensor_from_instance_id returns the SDL_Sensor associated with an instance id. // @@ -192,7 +192,7 @@ fn C.SDL_SensorFromInstanceID(instance_id C.SDL_SensorID) &C.SDL_Sensor // returns an SDL_Sensor object. // // NOTE This function is available since SDL 2.0.9. -pub fn sensor_from_instance_id(instance_id C.SDL_SensorID) &Sensor { +pub fn sensor_from_instance_id(instance_id SensorID) &Sensor { return C.SDL_SensorFromInstanceID(instance_id) } @@ -208,7 +208,7 @@ pub fn sensor_get_name(sensor &Sensor) &char { return C.SDL_SensorGetName(sensor) } -fn C.SDL_SensorGetType(sensor &C.SDL_Sensor) C.SDL_SensorType +fn C.SDL_SensorGetType(sensor &C.SDL_Sensor) SensorType // sensor_get_type gets the type of a sensor. // @@ -233,7 +233,7 @@ pub fn sensor_get_non_portable_type(sensor &Sensor) int { return C.SDL_SensorGetNonPortableType(sensor) } -fn C.SDL_SensorGetInstanceID(sensor &C.SDL_Sensor) C.SDL_SensorID +fn C.SDL_SensorGetInstanceID(sensor &C.SDL_Sensor) SensorID // sensor_get_instance_id gets the instance ID of a sensor. // diff --git a/stdinc.c.v b/stdinc.c.v index 600dc753..d6b4341b 100644 --- a/stdinc.c.v +++ b/stdinc.c.v @@ -412,8 +412,8 @@ pub fn ultoa(value u32, str &char, radix int) &char { return C.SDL_ultoa(value, str, radix) } -fn C.SDL_lltoa(value C.Sint64, str &char, radix int) &char -pub fn lltoa(value C.Sint64, str &char, radix int) &char { +fn C.SDL_lltoa(value i64, str &char, radix int) &char +pub fn lltoa(value i64, str &char, radix int) &char { return C.SDL_lltoa(value, str, radix) } @@ -442,8 +442,8 @@ pub fn strtoul(str &char, endp &&char, base int) u32 { return C.SDL_strtoul(str, endp, base) } -fn C.SDL_strtoll(str &char, endp &&char, base int) C.Sint64 -pub fn strtoll(str &char, endp &&char, base int) C.Sint64 { +fn C.SDL_strtoll(str &char, endp &&char, base int) i64 +pub fn strtoll(str &char, endp &&char, base int) i64 { return C.SDL_strtoll(str, endp, base) } diff --git a/surface.c.v b/surface.c.v index da002ccb..a5ad3227 100644 --- a/surface.c.v +++ b/surface.c.v @@ -939,7 +939,7 @@ pub fn set_yuv_conversion_mode(mode YUVConversionMode) { C.SDL_SetYUVConversionMode(C.SDL_YUV_CONVERSION_MODE(int(mode))) } -fn C.SDL_GetYUVConversionMode() C.SDL_YUV_CONVERSION_MODE +fn C.SDL_GetYUVConversionMode() YUVConversionMode // get_yuv_conversion_mode gets the YUV conversion mode // @@ -948,7 +948,7 @@ pub fn get_yuv_conversion_mode() YUVConversionMode { return unsafe { YUVConversionMode(int(C.SDL_GetYUVConversionMode())) } } -fn C.SDL_GetYUVConversionModeForResolution(width int, height int) C.SDL_YUV_CONVERSION_MODE +fn C.SDL_GetYUVConversionModeForResolution(width int, height int) YUVConversionMode // get_yuv_conversion_mode_for_resolution gets the YUV conversion mode, returning the correct mode for the resolution // when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC diff --git a/thread.c.v b/thread.c.v index 10270fe9..61343669 100644 --- a/thread.c.v +++ b/thread.c.v @@ -167,7 +167,7 @@ pub fn get_thread_name(pthread &Thread) &char { return C.SDL_GetThreadName(pthread) } -fn C.SDL_ThreadID() C.SDL_threadID +fn C.SDL_ThreadID() ThreadID // thread_id gets the thread identifier for the current thread. // @@ -187,7 +187,7 @@ pub fn thread_id() ThreadID { return ThreadID(u32(C.SDL_ThreadID())) } -fn C.SDL_GetThreadID(thrd &C.SDL_Thread) C.SDL_threadID +fn C.SDL_GetThreadID(thrd &C.SDL_Thread) ThreadID // get_thread_id gets the thread identifier for the specified thread. // @@ -298,7 +298,7 @@ pub fn detach_thread(thrd &Thread) { C.SDL_DetachThread(thrd) } -fn C.SDL_TLSCreate() C.SDL_TLSID +fn C.SDL_TLSCreate() TLSID // tls_create creates a piece of thread-local storage. // diff --git a/timer.c.v b/timer.c.v index e9fd975f..90f6b8fa 100644 --- a/timer.c.v +++ b/timer.c.v @@ -145,7 +145,7 @@ pub fn delay(ms u32) { C.SDL_Delay(ms) } -fn C.SDL_AddTimer(interval u32, callback C.SDL_TimerCallback, param voidptr) C.SDL_TimerID +fn C.SDL_AddTimer(interval u32, callback C.SDL_TimerCallback, param voidptr) TimerID // add_timer calls a callback function at a future time. // diff --git a/touch.c.v b/touch.c.v index 73cd0284..7db06626 100644 --- a/touch.c.v +++ b/touch.c.v @@ -76,7 +76,7 @@ pub fn get_touch_device(index int) TouchID { return C.SDL_GetTouchDevice(index) } -fn C.SDL_GetTouchDeviceType(touch_id TouchID) C.SDL_TouchDeviceType +fn C.SDL_GetTouchDeviceType(touch_id TouchID) TouchDeviceType // get_touch_device_type gets the type of the given touch device. // diff --git a/video.c.v b/video.c.v index c64fcaa7..c4457815 100644 --- a/video.c.v +++ b/video.c.v @@ -481,7 +481,7 @@ pub fn get_display_dpi(display_index int, ddpi &f32, hdpi &f32, vdpi &f32) int { return C.SDL_GetDisplayDPI(display_index, ddpi, hdpi, vdpi) } -fn C.SDL_GetDisplayOrientation(display_index int) C.SDL_DisplayOrientation +fn C.SDL_GetDisplayOrientation(display_index int) DisplayOrientation // get_display_orientation gets the orientation of a display. // @@ -2002,7 +2002,7 @@ pub fn gl_get_attribute(attr GLattr, value &int) int { return C.SDL_GL_GetAttribute(C.SDL_GLattr(int(attr)), value) } -fn C.SDL_GL_CreateContext(window &C.SDL_Window) C.SDL_GLContext +fn C.SDL_GL_CreateContext(window &C.SDL_Window) GLContext // gl_create_context creates an OpenGL context for an OpenGL window, and make it current. // @@ -2056,7 +2056,7 @@ pub fn gl_get_current_window() &Window { return C.SDL_GL_GetCurrentWindow() } -fn C.SDL_GL_GetCurrentContext() C.SDL_GLContext +fn C.SDL_GL_GetCurrentContext() GLContext // gl_get_current_context gets the currently active OpenGL context. //