sdl2-bindings 0.0.4 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/ChangeLog +23 -0
 - data/LICENSE.txt +1 -1
 - data/README.md +8 -2
 - data/lib/sdl2.rb +5 -3
 - data/lib/sdl2_audio.rb +22 -0
 - data/lib/sdl2_cpuinfo.rb +5 -2
 - data/lib/sdl2_error.rb +3 -0
 - data/lib/sdl2_events.rb +34 -1
 - data/lib/sdl2_gamecontroller.rb +69 -2
 - data/lib/sdl2_haptic.rb +1 -0
 - data/lib/sdl2_hidapi.rb +118 -0
 - data/lib/sdl2_hints.rb +108 -70
 - data/lib/sdl2_joystick.rb +41 -1
 - data/lib/sdl2_keycode.rb +5 -0
 - data/lib/sdl2_misc.rb +45 -0
 - data/lib/sdl2_mixer.rb +10 -0
 - data/lib/sdl2_pixels.rb +6 -0
 - data/lib/sdl2_render.rb +32 -0
 - data/lib/sdl2_rwops.rb +11 -11
 - data/lib/sdl2_sensor.rb +97 -0
 - data/lib/sdl2_stdinc.rb +103 -34
 - data/lib/sdl2_surface.rb +10 -1
 - data/lib/sdl2_syswm.rb +2 -0
 - data/lib/sdl2_timer.rb +3 -0
 - data/lib/sdl2_touch.rb +2 -0
 - data/lib/sdl2_ttf.rb +12 -0
 - data/lib/sdl2_version.rb +1 -1
 - data/lib/sdl2_video.rb +40 -1
 - metadata +6 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 35079ab7c6bbfd35b26fdaeb404263532c8076897bbdaae87252f4c7eb752ba6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ebb622ab9b6693acc19c70cd110365a1f3e546f7cdb60a1f63033324b86b769b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 62cb6b497ffb2a3b07485280698c74ab8caf4823449cc8958334373596a9dd18a019a6ffe8619beb19009a23fdda32ec2585859d6430911686204e4f03aac4a6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 031fec3cd69850e0cdab203e2facc931d7fe75b1cb1c7753c8a514fa6d694410490c595d8f808868ba96fe6af87f86838c5f6e37aa43a797f6b742e1d7e26a03
         
     | 
    
        data/ChangeLog
    CHANGED
    
    | 
         @@ -1,3 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            2021-12-02  vaiorabbit  <http://twitter.com/vaiorabbit>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            	* Added SDL 2.0.18 features ( https://github.com/libsdl-org/SDL/releases/tag/release-2.0.18 )
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            2021-08-12  vaiorabbit  <http://twitter.com/vaiorabbit>
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            	* Added SDL 2.0.14 features (SDL_misc).
         
     | 
| 
      
 8 
     | 
    
         
            +
            	* Added SDL 2.0.16 features (SDL_sensor).
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            2021-02-21  vaiorabbit  <http://twitter.com/vaiorabbit>
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            	* Added defines from Audio, Mixer and TTF
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            2020-12-27  vaiorabbit  <http://twitter.com/vaiorabbit>
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            	* Added SDL 2.0.14 features.
         
     | 
| 
      
 17 
     | 
    
         
            +
            	* third_party/sdl2_build_dll.sh: Added to build x64 DLL for Windows
         
     | 
| 
      
 18 
     | 
    
         
            +
            	* test/util.rb: Added
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            2020-12-20  vaiorabbit  <http://twitter.com/vaiorabbit>
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            	* third_party/sdl2_build_dylib.sh: Added to build x86_64|arm64 Universal Binary
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       1 
24 
     | 
    
         
             
            2020-06-08  vaiorabbit  <http://twitter.com/vaiorabbit>
         
     | 
| 
       2 
25 
     | 
    
         | 
| 
       3 
26 
     | 
    
         
             
            	* lib/sdl2_syswm.rb: Added
         
     | 
    
        data/LICENSE.txt
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            sdl2-bindings : Yet another SDL2 wrapper for Ruby
         
     | 
| 
       2 
     | 
    
         
            -
            Copyright (c) 2015- 
     | 
| 
      
 2 
     | 
    
         
            +
            Copyright (c) 2015-2021 vaiorabbit <http://twitter.com/vaiorabbit>
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            This software is provided 'as-is', without any express or implied
         
     | 
| 
       5 
5 
     | 
    
         
             
            warranty. In no event will the authors be held liable for any damages
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
            [Notice] Experimental project.
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            *   Created : 2015-09-19
         
     | 
| 
       8 
     | 
    
         
            -
            *   Last modified :  
     | 
| 
      
 8 
     | 
    
         
            +
            *   Last modified : 2021-12-02
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            ## Features ##
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -30,13 +30,19 @@ 
     | 
|
| 
       30 
30 
     | 
    
         
             
                *   sdl2_ttf : 2.0.13
         
     | 
| 
       31 
31 
     | 
    
         
             
            *   [2019-08-31] SDL 2.0.10 (Installed via Homebrew)
         
     | 
| 
       32 
32 
     | 
    
         
             
            *   [2020-03-22] SDL 2.0.12 (Installed via Homebrew)
         
     | 
| 
      
 33 
     | 
    
         
            +
            *   [2020-12-27] SDL 2.0.14 (Installed via Homebrew)
         
     | 
| 
      
 34 
     | 
    
         
            +
                *   macOS Big Sur (11.0.1), ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
         
     | 
| 
      
 35 
     | 
    
         
            +
            *   [2021-08-12] SDL 2.0.16 (Installed via Homebrew)
         
     | 
| 
      
 36 
     | 
    
         
            +
                *   macOS Big Sur (11.5), ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
         
     | 
| 
      
 37 
     | 
    
         
            +
            *   [2021-12-02] SDL 2.0.18 (Installed via Homebrew)
         
     | 
| 
      
 38 
     | 
    
         
            +
                *   macOS Big Sur (11.6), ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
         
     | 
| 
       33 
39 
     | 
    
         | 
| 
       34 
40 
     | 
    
         
             
            ## License ##
         
     | 
| 
       35 
41 
     | 
    
         | 
| 
       36 
42 
     | 
    
         
             
            The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
         
     | 
| 
       37 
43 
     | 
    
         | 
| 
       38 
44 
     | 
    
         
             
                sdl2-bindings : Yet another SDL2 wrapper for Ruby
         
     | 
| 
       39 
     | 
    
         
            -
                Copyright (c) 2015- 
     | 
| 
      
 45 
     | 
    
         
            +
                Copyright (c) 2015-2021 vaiorabbit <http://twitter.com/vaiorabbit>
         
     | 
| 
       40 
46 
     | 
    
         | 
| 
       41 
47 
     | 
    
         
             
                This software is provided 'as-is', without any express or implied
         
     | 
| 
       42 
48 
     | 
    
         
             
                warranty. In no event will the authors be held liable for any damages
         
     | 
    
        data/lib/sdl2.rb
    CHANGED
    
    | 
         @@ -20,6 +20,7 @@ require_relative 'sdl2_keyboard.rb' 
     | 
|
| 
       20 
20 
     | 
    
         
             
            require_relative 'sdl2_keycode.rb'
         
     | 
| 
       21 
21 
     | 
    
         
             
            require_relative 'sdl2_log.rb'
         
     | 
| 
       22 
22 
     | 
    
         
             
            require_relative 'sdl2_messagebox.rb'
         
     | 
| 
      
 23 
     | 
    
         
            +
            require_relative 'sdl2_misc.rb'
         
     | 
| 
       23 
24 
     | 
    
         
             
            require_relative 'sdl2_mouse.rb'
         
     | 
| 
       24 
25 
     | 
    
         
             
            require_relative 'sdl2_pixels.rb'
         
     | 
| 
       25 
26 
     | 
    
         
             
            require_relative 'sdl2_platform.rb'
         
     | 
| 
         @@ -28,6 +29,7 @@ require_relative 'sdl2_rect.rb' 
     | 
|
| 
       28 
29 
     | 
    
         
             
            require_relative 'sdl2_render.rb'
         
     | 
| 
       29 
30 
     | 
    
         
             
            require_relative 'sdl2_rwops.rb'
         
     | 
| 
       30 
31 
     | 
    
         
             
            require_relative 'sdl2_scancode.rb'
         
     | 
| 
      
 32 
     | 
    
         
            +
            require_relative 'sdl2_sensor.rb'
         
     | 
| 
       31 
33 
     | 
    
         
             
            require_relative 'sdl2_shape.rb'
         
     | 
| 
       32 
34 
     | 
    
         
             
            require_relative 'sdl2_stdinc.rb'
         
     | 
| 
       33 
35 
     | 
    
         
             
            require_relative 'sdl2_surface.rb'
         
     | 
| 
         @@ -105,6 +107,7 @@ module SDL2 
     | 
|
| 
       105 
107 
     | 
    
         
             
                setup_keycode_symbols()
         
     | 
| 
       106 
108 
     | 
    
         
             
                setup_log_symbols()
         
     | 
| 
       107 
109 
     | 
    
         
             
                setup_messagebox_symbols()
         
     | 
| 
      
 110 
     | 
    
         
            +
                setup_misc_symbols()
         
     | 
| 
       108 
111 
     | 
    
         
             
                setup_mouse_symbols()
         
     | 
| 
       109 
112 
     | 
    
         
             
                setup_pixels_symbols()
         
     | 
| 
       110 
113 
     | 
    
         
             
                setup_platform_symbols()
         
     | 
| 
         @@ -113,6 +116,7 @@ module SDL2 
     | 
|
| 
       113 
116 
     | 
    
         
             
                setup_render_symbols()
         
     | 
| 
       114 
117 
     | 
    
         
             
                setup_rwops_symbols()
         
     | 
| 
       115 
118 
     | 
    
         
             
                setup_scancode_symbols()
         
     | 
| 
      
 119 
     | 
    
         
            +
                setup_sensor_symbols()
         
     | 
| 
       116 
120 
     | 
    
         
             
                setup_shape_symbols()
         
     | 
| 
       117 
121 
     | 
    
         
             
                setup_surface_symbols()
         
     | 
| 
       118 
122 
     | 
    
         
             
                setup_syswm_symbols()
         
     | 
| 
         @@ -128,12 +132,10 @@ end 
     | 
|
| 
       128 
132 
     | 
    
         | 
| 
       129 
133 
     | 
    
         | 
| 
       130 
134 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       131 
     | 
    
         
            -
            #  SDL2.load_lib('libSDL2.dylib')
         
     | 
| 
       132 
     | 
    
         
            -
            #  p SDL2.SDL_Init(SDL2::SDL_INIT_EVERYTHING)
         
     | 
| 
       133 
135 
     | 
    
         
             
              SDL2.load_lib('libSDL2.dylib',
         
     | 
| 
       134 
136 
     | 
    
         
             
                            gfx_libpath: '/usr/local/lib/libSDL2_gfx.dylib'
         
     | 
| 
       135 
137 
     | 
    
         
             
                           )
         
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
       137 
139 
     | 
    
         
             
              success = SDL2.SDL_Init(SDL2::SDL_INIT_EVERYTHING)
         
     | 
| 
       138 
140 
     | 
    
         
             
              exit if success < 0
         
     | 
| 
       139 
141 
     | 
    
         | 
    
        data/lib/sdl2_audio.rb
    CHANGED
    
    | 
         @@ -14,10 +14,29 @@ module SDL2 
     | 
|
| 
       14 
14 
     | 
    
         
             
              SDL_AUDIO_MASK_DATATYPE = (1 << 8)
         
     | 
| 
       15 
15 
     | 
    
         
             
              SDL_AUDIO_MASK_ENDIAN = (1 << 12)
         
     | 
| 
       16 
16 
     | 
    
         
             
              SDL_AUDIO_MASK_SIGNED = (1 << 15)
         
     | 
| 
      
 17 
     | 
    
         
            +
              AUDIO_U8 = 0x0008
         
     | 
| 
      
 18 
     | 
    
         
            +
              AUDIO_S8 = 0x8008
         
     | 
| 
      
 19 
     | 
    
         
            +
              AUDIO_U16LSB = 0x0010
         
     | 
| 
      
 20 
     | 
    
         
            +
              AUDIO_S16LSB = 0x8010
         
     | 
| 
      
 21 
     | 
    
         
            +
              AUDIO_U16MSB = 0x1010
         
     | 
| 
      
 22 
     | 
    
         
            +
              AUDIO_S16MSB = 0x9010
         
     | 
| 
      
 23 
     | 
    
         
            +
              AUDIO_U16 = AUDIO_U16LSB
         
     | 
| 
      
 24 
     | 
    
         
            +
              AUDIO_S16 = AUDIO_S16LSB
         
     | 
| 
      
 25 
     | 
    
         
            +
              AUDIO_S32LSB = 0x8020
         
     | 
| 
      
 26 
     | 
    
         
            +
              AUDIO_S32MSB = 0x9020
         
     | 
| 
      
 27 
     | 
    
         
            +
              AUDIO_S32 = AUDIO_S32LSB
         
     | 
| 
      
 28 
     | 
    
         
            +
              AUDIO_F32LSB = 0x8120
         
     | 
| 
      
 29 
     | 
    
         
            +
              AUDIO_F32MSB = 0x9120
         
     | 
| 
      
 30 
     | 
    
         
            +
              AUDIO_F32 = AUDIO_F32LSB
         
     | 
| 
      
 31 
     | 
    
         
            +
              AUDIO_U16SYS = AUDIO_U16LSB
         
     | 
| 
      
 32 
     | 
    
         
            +
              AUDIO_S16SYS = AUDIO_S16LSB
         
     | 
| 
      
 33 
     | 
    
         
            +
              AUDIO_S32SYS = AUDIO_S32LSB
         
     | 
| 
      
 34 
     | 
    
         
            +
              AUDIO_F32SYS = AUDIO_F32LSB
         
     | 
| 
       17 
35 
     | 
    
         
             
              SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001
         
     | 
| 
       18 
36 
     | 
    
         
             
              SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002
         
     | 
| 
       19 
37 
     | 
    
         
             
              SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004
         
     | 
| 
       20 
38 
     | 
    
         
             
              SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008
         
     | 
| 
      
 39 
     | 
    
         
            +
              SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_FORMAT_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE | SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
         
     | 
| 
       21 
40 
     | 
    
         
             
              SDL_AUDIOCVT_MAX_FILTERS = 9
         
     | 
| 
       22 
41 
     | 
    
         
             
              SDL_MIX_MAXVOLUME = 128
         
     | 
| 
       23 
42 
     | 
    
         | 
| 
         @@ -80,6 +99,7 @@ module SDL2 
     | 
|
| 
       80 
99 
     | 
    
         
             
                  :SDL_OpenAudio,
         
     | 
| 
       81 
100 
     | 
    
         
             
                  :SDL_GetNumAudioDevices,
         
     | 
| 
       82 
101 
     | 
    
         
             
                  :SDL_GetAudioDeviceName,
         
     | 
| 
      
 102 
     | 
    
         
            +
                  :SDL_GetAudioDeviceSpec,
         
     | 
| 
       83 
103 
     | 
    
         
             
                  :SDL_OpenAudioDevice,
         
     | 
| 
       84 
104 
     | 
    
         
             
                  :SDL_GetAudioStatus,
         
     | 
| 
       85 
105 
     | 
    
         
             
                  :SDL_GetAudioDeviceStatus,
         
     | 
| 
         @@ -118,6 +138,7 @@ module SDL2 
     | 
|
| 
       118 
138 
     | 
    
         
             
                  :SDL_OpenAudio => [:pointer, :pointer],
         
     | 
| 
       119 
139 
     | 
    
         
             
                  :SDL_GetNumAudioDevices => [:int],
         
     | 
| 
       120 
140 
     | 
    
         
             
                  :SDL_GetAudioDeviceName => [:int, :int],
         
     | 
| 
      
 141 
     | 
    
         
            +
                  :SDL_GetAudioDeviceSpec => [:int, :int, :pointer],
         
     | 
| 
       121 
142 
     | 
    
         
             
                  :SDL_OpenAudioDevice => [:pointer, :int, :pointer, :pointer, :int],
         
     | 
| 
       122 
143 
     | 
    
         
             
                  :SDL_GetAudioStatus => [],
         
     | 
| 
       123 
144 
     | 
    
         
             
                  :SDL_GetAudioDeviceStatus => [:uint],
         
     | 
| 
         @@ -156,6 +177,7 @@ module SDL2 
     | 
|
| 
       156 
177 
     | 
    
         
             
                  :SDL_OpenAudio => :int,
         
     | 
| 
       157 
178 
     | 
    
         
             
                  :SDL_GetNumAudioDevices => :int,
         
     | 
| 
       158 
179 
     | 
    
         
             
                  :SDL_GetAudioDeviceName => :pointer,
         
     | 
| 
      
 180 
     | 
    
         
            +
                  :SDL_GetAudioDeviceSpec => :int,
         
     | 
| 
       159 
181 
     | 
    
         
             
                  :SDL_OpenAudioDevice => :uint,
         
     | 
| 
       160 
182 
     | 
    
         
             
                  :SDL_GetAudioStatus => :int,
         
     | 
| 
       161 
183 
     | 
    
         
             
                  :SDL_GetAudioDeviceStatus => :int,
         
     | 
    
        data/lib/sdl2_cpuinfo.rb
    CHANGED
    
    | 
         @@ -44,6 +44,7 @@ module SDL2 
     | 
|
| 
       44 
44 
     | 
    
         
             
                  :SDL_GetSystemRAM,
         
     | 
| 
       45 
45 
     | 
    
         
             
                  :SDL_SIMDGetAlignment,
         
     | 
| 
       46 
46 
     | 
    
         
             
                  :SDL_SIMDAlloc,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  :SDL_SIMDRealloc,
         
     | 
| 
       47 
48 
     | 
    
         
             
                  :SDL_SIMDFree,
         
     | 
| 
       48 
49 
     | 
    
         
             
                ]
         
     | 
| 
       49 
50 
     | 
    
         
             
                args = {
         
     | 
| 
         @@ -65,7 +66,8 @@ module SDL2 
     | 
|
| 
       65 
66 
     | 
    
         
             
                  :SDL_HasNEON => [],
         
     | 
| 
       66 
67 
     | 
    
         
             
                  :SDL_GetSystemRAM => [],
         
     | 
| 
       67 
68 
     | 
    
         
             
                  :SDL_SIMDGetAlignment => [],
         
     | 
| 
       68 
     | 
    
         
            -
                  :SDL_SIMDAlloc => [: 
     | 
| 
      
 69 
     | 
    
         
            +
                  :SDL_SIMDAlloc => [:int],
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :SDL_SIMDRealloc => [:pointer, :int],
         
     | 
| 
       69 
71 
     | 
    
         
             
                  :SDL_SIMDFree => [:pointer],
         
     | 
| 
       70 
72 
     | 
    
         
             
                }
         
     | 
| 
       71 
73 
     | 
    
         
             
                retvals = {
         
     | 
| 
         @@ -86,8 +88,9 @@ module SDL2 
     | 
|
| 
       86 
88 
     | 
    
         
             
                  :SDL_HasARMSIMD => :int,
         
     | 
| 
       87 
89 
     | 
    
         
             
                  :SDL_HasNEON => :int,
         
     | 
| 
       88 
90 
     | 
    
         
             
                  :SDL_GetSystemRAM => :int,
         
     | 
| 
       89 
     | 
    
         
            -
                  :SDL_SIMDGetAlignment => : 
     | 
| 
      
 91 
     | 
    
         
            +
                  :SDL_SIMDGetAlignment => :int,
         
     | 
| 
       90 
92 
     | 
    
         
             
                  :SDL_SIMDAlloc => :pointer,
         
     | 
| 
      
 93 
     | 
    
         
            +
                  :SDL_SIMDRealloc => :pointer,
         
     | 
| 
       91 
94 
     | 
    
         
             
                  :SDL_SIMDFree => :void,
         
     | 
| 
       92 
95 
     | 
    
         
             
                }
         
     | 
| 
       93 
96 
     | 
    
         
             
                symbols.each do |sym|
         
     | 
    
        data/lib/sdl2_error.rb
    CHANGED
    
    | 
         @@ -33,18 +33,21 @@ module SDL2 
     | 
|
| 
       33 
33 
     | 
    
         
             
                symbols = [
         
     | 
| 
       34 
34 
     | 
    
         
             
                  :SDL_SetError,
         
     | 
| 
       35 
35 
     | 
    
         
             
                  :SDL_GetError,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :SDL_GetErrorMsg,
         
     | 
| 
       36 
37 
     | 
    
         
             
                  :SDL_ClearError,
         
     | 
| 
       37 
38 
     | 
    
         
             
                  :SDL_Error,
         
     | 
| 
       38 
39 
     | 
    
         
             
                ]
         
     | 
| 
       39 
40 
     | 
    
         
             
                args = {
         
     | 
| 
       40 
41 
     | 
    
         
             
                  :SDL_SetError => [:pointer],
         
     | 
| 
       41 
42 
     | 
    
         
             
                  :SDL_GetError => [],
         
     | 
| 
      
 43 
     | 
    
         
            +
                  :SDL_GetErrorMsg => [:pointer, :int],
         
     | 
| 
       42 
44 
     | 
    
         
             
                  :SDL_ClearError => [],
         
     | 
| 
       43 
45 
     | 
    
         
             
                  :SDL_Error => [:int],
         
     | 
| 
       44 
46 
     | 
    
         
             
                }
         
     | 
| 
       45 
47 
     | 
    
         
             
                retvals = {
         
     | 
| 
       46 
48 
     | 
    
         
             
                  :SDL_SetError => :int,
         
     | 
| 
       47 
49 
     | 
    
         
             
                  :SDL_GetError => :pointer,
         
     | 
| 
      
 50 
     | 
    
         
            +
                  :SDL_GetErrorMsg => :pointer,
         
     | 
| 
       48 
51 
     | 
    
         
             
                  :SDL_ClearError => :void,
         
     | 
| 
       49 
52 
     | 
    
         
             
                  :SDL_Error => :int,
         
     | 
| 
       50 
53 
     | 
    
         
             
                }
         
     | 
    
        data/lib/sdl2_events.rb
    CHANGED
    
    | 
         @@ -14,7 +14,7 @@ module SDL2 
     | 
|
| 
       14 
14 
     | 
    
         
             
              SDL_RELEASED = 0
         
     | 
| 
       15 
15 
     | 
    
         
             
              SDL_PRESSED = 1
         
     | 
| 
       16 
16 
     | 
    
         
             
              SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32
         
     | 
| 
       17 
     | 
    
         
            -
              SDL_TEXTINPUTEVENT_TEXT_SIZE =  
     | 
| 
      
 17 
     | 
    
         
            +
              SDL_TEXTINPUTEVENT_TEXT_SIZE = 32
         
     | 
| 
       18 
18 
     | 
    
         
             
              SDL_QUERY = -1
         
     | 
| 
       19 
19 
     | 
    
         
             
              SDL_IGNORE = 0
         
     | 
| 
       20 
20 
     | 
    
         
             
              SDL_DISABLE = 0
         
     | 
| 
         @@ -30,6 +30,7 @@ module SDL2 
     | 
|
| 
       30 
30 
     | 
    
         
             
              SDL_APP_DIDENTERBACKGROUND = 260
         
     | 
| 
       31 
31 
     | 
    
         
             
              SDL_APP_WILLENTERFOREGROUND = 261
         
     | 
| 
       32 
32 
     | 
    
         
             
              SDL_APP_DIDENTERFOREGROUND = 262
         
     | 
| 
      
 33 
     | 
    
         
            +
              SDL_LOCALECHANGED = 263
         
     | 
| 
       33 
34 
     | 
    
         
             
              SDL_DISPLAYEVENT = 336
         
     | 
| 
       34 
35 
     | 
    
         
             
              SDL_WINDOWEVENT = 512
         
     | 
| 
       35 
36 
     | 
    
         
             
              SDL_SYSWMEVENT = 513
         
     | 
| 
         @@ -55,6 +56,10 @@ module SDL2 
     | 
|
| 
       55 
56 
     | 
    
         
             
              SDL_CONTROLLERDEVICEADDED = 1619
         
     | 
| 
       56 
57 
     | 
    
         
             
              SDL_CONTROLLERDEVICEREMOVED = 1620
         
     | 
| 
       57 
58 
     | 
    
         
             
              SDL_CONTROLLERDEVICEREMAPPED = 1621
         
     | 
| 
      
 59 
     | 
    
         
            +
              SDL_CONTROLLERTOUCHPADDOWN = 1622
         
     | 
| 
      
 60 
     | 
    
         
            +
              SDL_CONTROLLERTOUCHPADMOTION = 1623
         
     | 
| 
      
 61 
     | 
    
         
            +
              SDL_CONTROLLERTOUCHPADUP = 1624
         
     | 
| 
      
 62 
     | 
    
         
            +
              SDL_CONTROLLERSENSORUPDATE = 1625
         
     | 
| 
       58 
63 
     | 
    
         
             
              SDL_FINGERDOWN = 1792
         
     | 
| 
       59 
64 
     | 
    
         
             
              SDL_FINGERUP = 1793
         
     | 
| 
       60 
65 
     | 
    
         
             
              SDL_FINGERMOTION = 1794
         
     | 
| 
         @@ -71,6 +76,7 @@ module SDL2 
     | 
|
| 
       71 
76 
     | 
    
         
             
              SDL_SENSORUPDATE = 4608
         
     | 
| 
       72 
77 
     | 
    
         
             
              SDL_RENDER_TARGETS_RESET = 8192
         
     | 
| 
       73 
78 
     | 
    
         
             
              SDL_RENDER_DEVICE_RESET = 8193
         
     | 
| 
      
 79 
     | 
    
         
            +
              SDL_POLLSENTINEL = 32512
         
     | 
| 
       74 
80 
     | 
    
         
             
              SDL_USEREVENT = 32768
         
     | 
| 
       75 
81 
     | 
    
         
             
              SDL_LASTEVENT = 65535
         
     | 
| 
       76 
82 
     | 
    
         
             
              SDL_ADDEVENT = 0
         
     | 
| 
         @@ -191,6 +197,8 @@ module SDL2 
     | 
|
| 
       191 
197 
     | 
    
         
             
                  :x, :int,
         
     | 
| 
       192 
198 
     | 
    
         
             
                  :y, :int,
         
     | 
| 
       193 
199 
     | 
    
         
             
                  :direction, :uint,
         
     | 
| 
      
 200 
     | 
    
         
            +
                  :preciseX, :float,
         
     | 
| 
      
 201 
     | 
    
         
            +
                  :preciseY, :float,
         
     | 
| 
       194 
202 
     | 
    
         
             
                )
         
     | 
| 
       195 
203 
     | 
    
         
             
              end
         
     | 
| 
       196 
204 
     | 
    
         | 
| 
         @@ -288,6 +296,29 @@ module SDL2 
     | 
|
| 
       288 
296 
     | 
    
         
             
                )
         
     | 
| 
       289 
297 
     | 
    
         
             
              end
         
     | 
| 
       290 
298 
     | 
    
         | 
| 
      
 299 
     | 
    
         
            +
              class SDL_ControllerTouchpadEvent < FFI::Struct
         
     | 
| 
      
 300 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 301 
     | 
    
         
            +
                  :type, :uint,
         
     | 
| 
      
 302 
     | 
    
         
            +
                  :timestamp, :uint,
         
     | 
| 
      
 303 
     | 
    
         
            +
                  :which, :int,
         
     | 
| 
      
 304 
     | 
    
         
            +
                  :touchpad, :int,
         
     | 
| 
      
 305 
     | 
    
         
            +
                  :finger, :int,
         
     | 
| 
      
 306 
     | 
    
         
            +
                  :x, :float,
         
     | 
| 
      
 307 
     | 
    
         
            +
                  :y, :float,
         
     | 
| 
      
 308 
     | 
    
         
            +
                  :pressure, :float,
         
     | 
| 
      
 309 
     | 
    
         
            +
                )
         
     | 
| 
      
 310 
     | 
    
         
            +
              end
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
              class SDL_ControllerSensorEvent < FFI::Struct
         
     | 
| 
      
 313 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 314 
     | 
    
         
            +
                  :type, :uint,
         
     | 
| 
      
 315 
     | 
    
         
            +
                  :timestamp, :uint,
         
     | 
| 
      
 316 
     | 
    
         
            +
                  :which, :int,
         
     | 
| 
      
 317 
     | 
    
         
            +
                  :sensor, :int,
         
     | 
| 
      
 318 
     | 
    
         
            +
                  :data, [:float, 3],
         
     | 
| 
      
 319 
     | 
    
         
            +
                )
         
     | 
| 
      
 320 
     | 
    
         
            +
              end
         
     | 
| 
      
 321 
     | 
    
         
            +
             
     | 
| 
       291 
322 
     | 
    
         
             
              class SDL_AudioDeviceEvent < FFI::Struct
         
     | 
| 
       292 
323 
     | 
    
         
             
                layout(
         
     | 
| 
       293 
324 
     | 
    
         
             
                  :type, :uint,
         
     | 
| 
         @@ -413,6 +444,8 @@ module SDL2 
     | 
|
| 
       413 
444 
     | 
    
         
             
                  :caxis, SDL_ControllerAxisEvent,
         
     | 
| 
       414 
445 
     | 
    
         
             
                  :cbutton, SDL_ControllerButtonEvent,
         
     | 
| 
       415 
446 
     | 
    
         
             
                  :cdevice, SDL_ControllerDeviceEvent,
         
     | 
| 
      
 447 
     | 
    
         
            +
                  :ctouchpad, SDL_ControllerTouchpadEvent,
         
     | 
| 
      
 448 
     | 
    
         
            +
                  :csensor, SDL_ControllerSensorEvent,
         
     | 
| 
       416 
449 
     | 
    
         
             
                  :adevice, SDL_AudioDeviceEvent,
         
     | 
| 
       417 
450 
     | 
    
         
             
                  :sensor, SDL_SensorEvent,
         
     | 
| 
       418 
451 
     | 
    
         
             
                  :quit, SDL_QuitEvent,
         
     | 
    
        data/lib/sdl2_gamecontroller.rb
    CHANGED
    
    | 
         @@ -20,6 +20,10 @@ module SDL2 
     | 
|
| 
       20 
20 
     | 
    
         
             
              SDL_CONTROLLER_TYPE_PS3 = 3
         
     | 
| 
       21 
21 
     | 
    
         
             
              SDL_CONTROLLER_TYPE_PS4 = 4
         
     | 
| 
       22 
22 
     | 
    
         
             
              SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = 5
         
     | 
| 
      
 23 
     | 
    
         
            +
              SDL_CONTROLLER_TYPE_VIRTUAL = 6
         
     | 
| 
      
 24 
     | 
    
         
            +
              SDL_CONTROLLER_TYPE_PS5 = 7
         
     | 
| 
      
 25 
     | 
    
         
            +
              SDL_CONTROLLER_TYPE_AMAZON_LUNA = 8
         
     | 
| 
      
 26 
     | 
    
         
            +
              SDL_CONTROLLER_TYPE_GOOGLE_STADIA = 9
         
     | 
| 
       23 
27 
     | 
    
         
             
              SDL_CONTROLLER_BINDTYPE_NONE = 0
         
     | 
| 
       24 
28 
     | 
    
         
             
              SDL_CONTROLLER_BINDTYPE_BUTTON = 1
         
     | 
| 
       25 
29 
     | 
    
         
             
              SDL_CONTROLLER_BINDTYPE_AXIS = 2
         
     | 
| 
         @@ -48,7 +52,13 @@ module SDL2 
     | 
|
| 
       48 
52 
     | 
    
         
             
              SDL_CONTROLLER_BUTTON_DPAD_DOWN = 12
         
     | 
| 
       49 
53 
     | 
    
         
             
              SDL_CONTROLLER_BUTTON_DPAD_LEFT = 13
         
     | 
| 
       50 
54 
     | 
    
         
             
              SDL_CONTROLLER_BUTTON_DPAD_RIGHT = 14
         
     | 
| 
       51 
     | 
    
         
            -
               
     | 
| 
      
 55 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_MISC1 = 15
         
     | 
| 
      
 56 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_PADDLE1 = 16
         
     | 
| 
      
 57 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_PADDLE2 = 17
         
     | 
| 
      
 58 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_PADDLE3 = 18
         
     | 
| 
      
 59 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_PADDLE4 = 19
         
     | 
| 
      
 60 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_TOUCHPAD = 20
         
     | 
| 
      
 61 
     | 
    
         
            +
              SDL_CONTROLLER_BUTTON_MAX = 21
         
     | 
| 
       52 
62 
     | 
    
         | 
| 
       53 
63 
     | 
    
         
             
              # Typedef
         
     | 
| 
       54 
64 
     | 
    
         | 
| 
         @@ -107,6 +117,7 @@ module SDL2 
     | 
|
| 
       107 
117 
     | 
    
         
             
                  :SDL_GameControllerGetVendor,
         
     | 
| 
       108 
118 
     | 
    
         
             
                  :SDL_GameControllerGetProduct,
         
     | 
| 
       109 
119 
     | 
    
         
             
                  :SDL_GameControllerGetProductVersion,
         
     | 
| 
      
 120 
     | 
    
         
            +
                  :SDL_GameControllerGetSerial,
         
     | 
| 
       110 
121 
     | 
    
         
             
                  :SDL_GameControllerGetAttached,
         
     | 
| 
       111 
122 
     | 
    
         
             
                  :SDL_GameControllerGetJoystick,
         
     | 
| 
       112 
123 
     | 
    
         
             
                  :SDL_GameControllerEventState,
         
     | 
| 
         @@ -114,20 +125,38 @@ module SDL2 
     | 
|
| 
       114 
125 
     | 
    
         
             
                  :SDL_GameControllerGetAxisFromString,
         
     | 
| 
       115 
126 
     | 
    
         
             
                  :SDL_GameControllerGetStringForAxis,
         
     | 
| 
       116 
127 
     | 
    
         
             
                  :SDL_GameControllerGetBindForAxis,
         
     | 
| 
      
 128 
     | 
    
         
            +
                  :SDL_GameControllerHasAxis,
         
     | 
| 
       117 
129 
     | 
    
         
             
                  :SDL_GameControllerGetAxis,
         
     | 
| 
       118 
130 
     | 
    
         
             
                  :SDL_GameControllerGetButtonFromString,
         
     | 
| 
       119 
131 
     | 
    
         
             
                  :SDL_GameControllerGetStringForButton,
         
     | 
| 
       120 
132 
     | 
    
         
             
                  :SDL_GameControllerGetBindForButton,
         
     | 
| 
      
 133 
     | 
    
         
            +
                  :SDL_GameControllerHasButton,
         
     | 
| 
       121 
134 
     | 
    
         
             
                  :SDL_GameControllerGetButton,
         
     | 
| 
      
 135 
     | 
    
         
            +
                  :SDL_GameControllerGetNumTouchpads,
         
     | 
| 
      
 136 
     | 
    
         
            +
                  :SDL_GameControllerGetNumTouchpadFingers,
         
     | 
| 
      
 137 
     | 
    
         
            +
                  :SDL_GameControllerGetTouchpadFinger,
         
     | 
| 
      
 138 
     | 
    
         
            +
                  :SDL_GameControllerHasSensor,
         
     | 
| 
      
 139 
     | 
    
         
            +
                  :SDL_GameControllerSetSensorEnabled,
         
     | 
| 
      
 140 
     | 
    
         
            +
                  :SDL_GameControllerIsSensorEnabled,
         
     | 
| 
      
 141 
     | 
    
         
            +
                  :SDL_GameControllerGetSensorDataRate,
         
     | 
| 
      
 142 
     | 
    
         
            +
                  :SDL_GameControllerGetSensorData,
         
     | 
| 
       122 
143 
     | 
    
         
             
                  :SDL_GameControllerRumble,
         
     | 
| 
      
 144 
     | 
    
         
            +
                  :SDL_GameControllerRumbleTriggers,
         
     | 
| 
      
 145 
     | 
    
         
            +
                  :SDL_GameControllerHasLED,
         
     | 
| 
      
 146 
     | 
    
         
            +
                  :SDL_GameControllerHasRumble,
         
     | 
| 
      
 147 
     | 
    
         
            +
                  :SDL_GameControllerHasRumbleTriggers,
         
     | 
| 
      
 148 
     | 
    
         
            +
                  :SDL_GameControllerSetLED,
         
     | 
| 
      
 149 
     | 
    
         
            +
                  :SDL_GameControllerSendEffect,
         
     | 
| 
       123 
150 
     | 
    
         
             
                  :SDL_GameControllerClose,
         
     | 
| 
      
 151 
     | 
    
         
            +
                  :SDL_GameControllerGetAppleSFSymbolsNameForButton,
         
     | 
| 
      
 152 
     | 
    
         
            +
                  :SDL_GameControllerGetAppleSFSymbolsNameForAxis,
         
     | 
| 
       124 
153 
     | 
    
         
             
                ]
         
     | 
| 
       125 
154 
     | 
    
         
             
                args = {
         
     | 
| 
       126 
155 
     | 
    
         
             
                  :SDL_GameControllerAddMappingsFromRW => [:pointer, :int],
         
     | 
| 
       127 
156 
     | 
    
         
             
                  :SDL_GameControllerAddMapping => [:pointer],
         
     | 
| 
       128 
157 
     | 
    
         
             
                  :SDL_GameControllerNumMappings => [],
         
     | 
| 
       129 
158 
     | 
    
         
             
                  :SDL_GameControllerMappingForIndex => [:int],
         
     | 
| 
       130 
     | 
    
         
            -
                  :SDL_GameControllerMappingForGUID => [SDL_JoystickGUID],
         
     | 
| 
      
 159 
     | 
    
         
            +
                  :SDL_GameControllerMappingForGUID => [SDL_JoystickGUID.by_value],
         
     | 
| 
       131 
160 
     | 
    
         
             
                  :SDL_GameControllerMapping => [:pointer],
         
     | 
| 
       132 
161 
     | 
    
         
             
                  :SDL_IsGameController => [:int],
         
     | 
| 
       133 
162 
     | 
    
         
             
                  :SDL_GameControllerNameForIndex => [:int],
         
     | 
| 
         @@ -143,6 +172,7 @@ module SDL2 
     | 
|
| 
       143 
172 
     | 
    
         
             
                  :SDL_GameControllerGetVendor => [:pointer],
         
     | 
| 
       144 
173 
     | 
    
         
             
                  :SDL_GameControllerGetProduct => [:pointer],
         
     | 
| 
       145 
174 
     | 
    
         
             
                  :SDL_GameControllerGetProductVersion => [:pointer],
         
     | 
| 
      
 175 
     | 
    
         
            +
                  :SDL_GameControllerGetSerial => [:pointer],
         
     | 
| 
       146 
176 
     | 
    
         
             
                  :SDL_GameControllerGetAttached => [:pointer],
         
     | 
| 
       147 
177 
     | 
    
         
             
                  :SDL_GameControllerGetJoystick => [:pointer],
         
     | 
| 
       148 
178 
     | 
    
         
             
                  :SDL_GameControllerEventState => [:int],
         
     | 
| 
         @@ -150,13 +180,31 @@ module SDL2 
     | 
|
| 
       150 
180 
     | 
    
         
             
                  :SDL_GameControllerGetAxisFromString => [:pointer],
         
     | 
| 
       151 
181 
     | 
    
         
             
                  :SDL_GameControllerGetStringForAxis => [:int],
         
     | 
| 
       152 
182 
     | 
    
         
             
                  :SDL_GameControllerGetBindForAxis => [:pointer, :int],
         
     | 
| 
      
 183 
     | 
    
         
            +
                  :SDL_GameControllerHasAxis => [:pointer, :int],
         
     | 
| 
       153 
184 
     | 
    
         
             
                  :SDL_GameControllerGetAxis => [:pointer, :int],
         
     | 
| 
       154 
185 
     | 
    
         
             
                  :SDL_GameControllerGetButtonFromString => [:pointer],
         
     | 
| 
       155 
186 
     | 
    
         
             
                  :SDL_GameControllerGetStringForButton => [:int],
         
     | 
| 
       156 
187 
     | 
    
         
             
                  :SDL_GameControllerGetBindForButton => [:pointer, :int],
         
     | 
| 
      
 188 
     | 
    
         
            +
                  :SDL_GameControllerHasButton => [:pointer, :int],
         
     | 
| 
       157 
189 
     | 
    
         
             
                  :SDL_GameControllerGetButton => [:pointer, :int],
         
     | 
| 
      
 190 
     | 
    
         
            +
                  :SDL_GameControllerGetNumTouchpads => [:pointer],
         
     | 
| 
      
 191 
     | 
    
         
            +
                  :SDL_GameControllerGetNumTouchpadFingers => [:pointer, :int],
         
     | 
| 
      
 192 
     | 
    
         
            +
                  :SDL_GameControllerGetTouchpadFinger => [:pointer, :int, :int, :pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 193 
     | 
    
         
            +
                  :SDL_GameControllerHasSensor => [:pointer, :int],
         
     | 
| 
      
 194 
     | 
    
         
            +
                  :SDL_GameControllerSetSensorEnabled => [:pointer, :int, :int],
         
     | 
| 
      
 195 
     | 
    
         
            +
                  :SDL_GameControllerIsSensorEnabled => [:pointer, :int],
         
     | 
| 
      
 196 
     | 
    
         
            +
                  :SDL_GameControllerGetSensorDataRate => [:pointer, :int],
         
     | 
| 
      
 197 
     | 
    
         
            +
                  :SDL_GameControllerGetSensorData => [:pointer, :int, :pointer, :int],
         
     | 
| 
       158 
198 
     | 
    
         
             
                  :SDL_GameControllerRumble => [:pointer, :ushort, :ushort, :uint],
         
     | 
| 
      
 199 
     | 
    
         
            +
                  :SDL_GameControllerRumbleTriggers => [:pointer, :ushort, :ushort, :uint],
         
     | 
| 
      
 200 
     | 
    
         
            +
                  :SDL_GameControllerHasLED => [:pointer],
         
     | 
| 
      
 201 
     | 
    
         
            +
                  :SDL_GameControllerHasRumble => [:pointer],
         
     | 
| 
      
 202 
     | 
    
         
            +
                  :SDL_GameControllerHasRumbleTriggers => [:pointer],
         
     | 
| 
      
 203 
     | 
    
         
            +
                  :SDL_GameControllerSetLED => [:pointer, :uchar, :uchar, :uchar],
         
     | 
| 
      
 204 
     | 
    
         
            +
                  :SDL_GameControllerSendEffect => [:pointer, :pointer, :int],
         
     | 
| 
       159 
205 
     | 
    
         
             
                  :SDL_GameControllerClose => [:pointer],
         
     | 
| 
      
 206 
     | 
    
         
            +
                  :SDL_GameControllerGetAppleSFSymbolsNameForButton => [:pointer, :int],
         
     | 
| 
      
 207 
     | 
    
         
            +
                  :SDL_GameControllerGetAppleSFSymbolsNameForAxis => [:pointer, :int],
         
     | 
| 
       160 
208 
     | 
    
         
             
                }
         
     | 
| 
       161 
209 
     | 
    
         
             
                retvals = {
         
     | 
| 
       162 
210 
     | 
    
         
             
                  :SDL_GameControllerAddMappingsFromRW => :int,
         
     | 
| 
         @@ -179,6 +227,7 @@ module SDL2 
     | 
|
| 
       179 
227 
     | 
    
         
             
                  :SDL_GameControllerGetVendor => :ushort,
         
     | 
| 
       180 
228 
     | 
    
         
             
                  :SDL_GameControllerGetProduct => :ushort,
         
     | 
| 
       181 
229 
     | 
    
         
             
                  :SDL_GameControllerGetProductVersion => :ushort,
         
     | 
| 
      
 230 
     | 
    
         
            +
                  :SDL_GameControllerGetSerial => :pointer,
         
     | 
| 
       182 
231 
     | 
    
         
             
                  :SDL_GameControllerGetAttached => :int,
         
     | 
| 
       183 
232 
     | 
    
         
             
                  :SDL_GameControllerGetJoystick => :pointer,
         
     | 
| 
       184 
233 
     | 
    
         
             
                  :SDL_GameControllerEventState => :int,
         
     | 
| 
         @@ -186,13 +235,31 @@ module SDL2 
     | 
|
| 
       186 
235 
     | 
    
         
             
                  :SDL_GameControllerGetAxisFromString => :int,
         
     | 
| 
       187 
236 
     | 
    
         
             
                  :SDL_GameControllerGetStringForAxis => :pointer,
         
     | 
| 
       188 
237 
     | 
    
         
             
                  :SDL_GameControllerGetBindForAxis => SDL_GameControllerButtonBind,
         
     | 
| 
      
 238 
     | 
    
         
            +
                  :SDL_GameControllerHasAxis => :int,
         
     | 
| 
       189 
239 
     | 
    
         
             
                  :SDL_GameControllerGetAxis => :short,
         
     | 
| 
       190 
240 
     | 
    
         
             
                  :SDL_GameControllerGetButtonFromString => :int,
         
     | 
| 
       191 
241 
     | 
    
         
             
                  :SDL_GameControllerGetStringForButton => :pointer,
         
     | 
| 
       192 
242 
     | 
    
         
             
                  :SDL_GameControllerGetBindForButton => SDL_GameControllerButtonBind,
         
     | 
| 
      
 243 
     | 
    
         
            +
                  :SDL_GameControllerHasButton => :int,
         
     | 
| 
       193 
244 
     | 
    
         
             
                  :SDL_GameControllerGetButton => :uchar,
         
     | 
| 
      
 245 
     | 
    
         
            +
                  :SDL_GameControllerGetNumTouchpads => :int,
         
     | 
| 
      
 246 
     | 
    
         
            +
                  :SDL_GameControllerGetNumTouchpadFingers => :int,
         
     | 
| 
      
 247 
     | 
    
         
            +
                  :SDL_GameControllerGetTouchpadFinger => :int,
         
     | 
| 
      
 248 
     | 
    
         
            +
                  :SDL_GameControllerHasSensor => :int,
         
     | 
| 
      
 249 
     | 
    
         
            +
                  :SDL_GameControllerSetSensorEnabled => :int,
         
     | 
| 
      
 250 
     | 
    
         
            +
                  :SDL_GameControllerIsSensorEnabled => :int,
         
     | 
| 
      
 251 
     | 
    
         
            +
                  :SDL_GameControllerGetSensorDataRate => :float,
         
     | 
| 
      
 252 
     | 
    
         
            +
                  :SDL_GameControllerGetSensorData => :int,
         
     | 
| 
       194 
253 
     | 
    
         
             
                  :SDL_GameControllerRumble => :int,
         
     | 
| 
      
 254 
     | 
    
         
            +
                  :SDL_GameControllerRumbleTriggers => :int,
         
     | 
| 
      
 255 
     | 
    
         
            +
                  :SDL_GameControllerHasLED => :int,
         
     | 
| 
      
 256 
     | 
    
         
            +
                  :SDL_GameControllerHasRumble => :int,
         
     | 
| 
      
 257 
     | 
    
         
            +
                  :SDL_GameControllerHasRumbleTriggers => :int,
         
     | 
| 
      
 258 
     | 
    
         
            +
                  :SDL_GameControllerSetLED => :int,
         
     | 
| 
      
 259 
     | 
    
         
            +
                  :SDL_GameControllerSendEffect => :int,
         
     | 
| 
       195 
260 
     | 
    
         
             
                  :SDL_GameControllerClose => :void,
         
     | 
| 
      
 261 
     | 
    
         
            +
                  :SDL_GameControllerGetAppleSFSymbolsNameForButton => :pointer,
         
     | 
| 
      
 262 
     | 
    
         
            +
                  :SDL_GameControllerGetAppleSFSymbolsNameForAxis => :pointer,
         
     | 
| 
       196 
263 
     | 
    
         
             
                }
         
     | 
| 
       197 
264 
     | 
    
         
             
                symbols.each do |sym|
         
     | 
| 
       198 
265 
     | 
    
         
             
                  begin
         
     | 
    
        data/lib/sdl2_haptic.rb
    CHANGED
    
    
    
        data/lib/sdl2_hidapi.rb
    ADDED
    
    | 
         @@ -0,0 +1,118 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # * https://github.com/vaiorabbit/sdl2-bindings
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # [NOTICE] This is an automatically generated file.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'ffi'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module SDL2
         
     | 
| 
      
 10 
     | 
    
         
            +
              extend FFI::Library
         
     | 
| 
      
 11 
     | 
    
         
            +
              # Define/Macro
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              class SDL_hid_device_info < FFI::Struct
         
     | 
| 
      
 23 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 24 
     | 
    
         
            +
                  :path, :pointer,
         
     | 
| 
      
 25 
     | 
    
         
            +
                  :vendor_id, :ushort,
         
     | 
| 
      
 26 
     | 
    
         
            +
                  :product_id, :ushort,
         
     | 
| 
      
 27 
     | 
    
         
            +
                  :serial_number, :pointer,
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :release_number, :ushort,
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :manufacturer_string, :pointer,
         
     | 
| 
      
 30 
     | 
    
         
            +
                  :product_string, :pointer,
         
     | 
| 
      
 31 
     | 
    
         
            +
                  :usage_page, :ushort,
         
     | 
| 
      
 32 
     | 
    
         
            +
                  :usage, :ushort,
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :interface_number, :int,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :interface_class, :int,
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :interface_subclass, :int,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :interface_protocol, :int,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  :next, :pointer,
         
     | 
| 
      
 38 
     | 
    
         
            +
                )
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              def self.setup_hidapi_symbols()
         
     | 
| 
      
 45 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 46 
     | 
    
         
            +
                  :SDL_hid_init,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  :SDL_hid_exit,
         
     | 
| 
      
 48 
     | 
    
         
            +
                  :SDL_hid_device_change_count,
         
     | 
| 
      
 49 
     | 
    
         
            +
                  :SDL_hid_enumerate,
         
     | 
| 
      
 50 
     | 
    
         
            +
                  :SDL_hid_free_enumeration,
         
     | 
| 
      
 51 
     | 
    
         
            +
                  :SDL_hid_open,
         
     | 
| 
      
 52 
     | 
    
         
            +
                  :SDL_hid_open_path,
         
     | 
| 
      
 53 
     | 
    
         
            +
                  :SDL_hid_write,
         
     | 
| 
      
 54 
     | 
    
         
            +
                  :SDL_hid_read_timeout,
         
     | 
| 
      
 55 
     | 
    
         
            +
                  :SDL_hid_read,
         
     | 
| 
      
 56 
     | 
    
         
            +
                  :SDL_hid_set_nonblocking,
         
     | 
| 
      
 57 
     | 
    
         
            +
                  :SDL_hid_send_feature_report,
         
     | 
| 
      
 58 
     | 
    
         
            +
                  :SDL_hid_get_feature_report,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  :SDL_hid_close,
         
     | 
| 
      
 60 
     | 
    
         
            +
                  :SDL_hid_get_manufacturer_string,
         
     | 
| 
      
 61 
     | 
    
         
            +
                  :SDL_hid_get_product_string,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :SDL_hid_get_serial_number_string,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  :SDL_hid_get_indexed_string,
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :SDL_hid_ble_scan,
         
     | 
| 
      
 65 
     | 
    
         
            +
                ]
         
     | 
| 
      
 66 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 67 
     | 
    
         
            +
                  :SDL_hid_init => [],
         
     | 
| 
      
 68 
     | 
    
         
            +
                  :SDL_hid_exit => [],
         
     | 
| 
      
 69 
     | 
    
         
            +
                  :SDL_hid_device_change_count => [],
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :SDL_hid_enumerate => [:ushort, :ushort],
         
     | 
| 
      
 71 
     | 
    
         
            +
                  :SDL_hid_free_enumeration => [:pointer],
         
     | 
| 
      
 72 
     | 
    
         
            +
                  :SDL_hid_open => [:ushort, :ushort, :pointer],
         
     | 
| 
      
 73 
     | 
    
         
            +
                  :SDL_hid_open_path => [:pointer, :int],
         
     | 
| 
      
 74 
     | 
    
         
            +
                  :SDL_hid_write => [:pointer, :pointer, :int],
         
     | 
| 
      
 75 
     | 
    
         
            +
                  :SDL_hid_read_timeout => [:pointer, :pointer, :int, :int],
         
     | 
| 
      
 76 
     | 
    
         
            +
                  :SDL_hid_read => [:pointer, :pointer, :int],
         
     | 
| 
      
 77 
     | 
    
         
            +
                  :SDL_hid_set_nonblocking => [:pointer, :int],
         
     | 
| 
      
 78 
     | 
    
         
            +
                  :SDL_hid_send_feature_report => [:pointer, :pointer, :int],
         
     | 
| 
      
 79 
     | 
    
         
            +
                  :SDL_hid_get_feature_report => [:pointer, :pointer, :int],
         
     | 
| 
      
 80 
     | 
    
         
            +
                  :SDL_hid_close => [:pointer],
         
     | 
| 
      
 81 
     | 
    
         
            +
                  :SDL_hid_get_manufacturer_string => [:pointer, :pointer, :int],
         
     | 
| 
      
 82 
     | 
    
         
            +
                  :SDL_hid_get_product_string => [:pointer, :pointer, :int],
         
     | 
| 
      
 83 
     | 
    
         
            +
                  :SDL_hid_get_serial_number_string => [:pointer, :pointer, :int],
         
     | 
| 
      
 84 
     | 
    
         
            +
                  :SDL_hid_get_indexed_string => [:pointer, :int, :pointer, :int],
         
     | 
| 
      
 85 
     | 
    
         
            +
                  :SDL_hid_ble_scan => [:int],
         
     | 
| 
      
 86 
     | 
    
         
            +
                }
         
     | 
| 
      
 87 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 88 
     | 
    
         
            +
                  :SDL_hid_init => :int,
         
     | 
| 
      
 89 
     | 
    
         
            +
                  :SDL_hid_exit => :int,
         
     | 
| 
      
 90 
     | 
    
         
            +
                  :SDL_hid_device_change_count => :uint,
         
     | 
| 
      
 91 
     | 
    
         
            +
                  :SDL_hid_enumerate => :pointer,
         
     | 
| 
      
 92 
     | 
    
         
            +
                  :SDL_hid_free_enumeration => :void,
         
     | 
| 
      
 93 
     | 
    
         
            +
                  :SDL_hid_open => :pointer,
         
     | 
| 
      
 94 
     | 
    
         
            +
                  :SDL_hid_open_path => :pointer,
         
     | 
| 
      
 95 
     | 
    
         
            +
                  :SDL_hid_write => :int,
         
     | 
| 
      
 96 
     | 
    
         
            +
                  :SDL_hid_read_timeout => :int,
         
     | 
| 
      
 97 
     | 
    
         
            +
                  :SDL_hid_read => :int,
         
     | 
| 
      
 98 
     | 
    
         
            +
                  :SDL_hid_set_nonblocking => :int,
         
     | 
| 
      
 99 
     | 
    
         
            +
                  :SDL_hid_send_feature_report => :int,
         
     | 
| 
      
 100 
     | 
    
         
            +
                  :SDL_hid_get_feature_report => :int,
         
     | 
| 
      
 101 
     | 
    
         
            +
                  :SDL_hid_close => :void,
         
     | 
| 
      
 102 
     | 
    
         
            +
                  :SDL_hid_get_manufacturer_string => :int,
         
     | 
| 
      
 103 
     | 
    
         
            +
                  :SDL_hid_get_product_string => :int,
         
     | 
| 
      
 104 
     | 
    
         
            +
                  :SDL_hid_get_serial_number_string => :int,
         
     | 
| 
      
 105 
     | 
    
         
            +
                  :SDL_hid_get_indexed_string => :int,
         
     | 
| 
      
 106 
     | 
    
         
            +
                  :SDL_hid_ble_scan => :void,
         
     | 
| 
      
 107 
     | 
    
         
            +
                }
         
     | 
| 
      
 108 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 109 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 110 
     | 
    
         
            +
                    attach_function sym, args[sym], retvals[sym]
         
     | 
| 
      
 111 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 112 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
         
     | 
| 
      
 113 
     | 
    
         
            +
                  end
         
     | 
| 
      
 114 
     | 
    
         
            +
                end
         
     | 
| 
      
 115 
     | 
    
         
            +
              end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
            end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     |