sdl2-bindings 0.0.8 → 0.1.1
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 +124 -92
 - data/LICENSE.txt +1 -1
 - data/README.md +77 -53
 - data/lib/sdl2.rb +131 -172
 - data/lib/sdl2_audio.rb +261 -222
 - data/lib/sdl2_blendmode.rb +72 -69
 - data/lib/sdl2_clipboard.rb +56 -51
 - data/lib/sdl2_cpuinfo.rb +129 -106
 - data/lib/sdl2_error.rb +71 -64
 - data/lib/sdl2_events.rb +564 -533
 - data/lib/sdl2_filesystem.rb +52 -48
 - data/lib/sdl2_framerate.rb +74 -67
 - data/lib/sdl2_gamecontroller.rb +329 -274
 - data/lib/sdl2_gesture.rb +61 -55
 - data/lib/sdl2_gfxPrimitives.rb +283 -222
 - data/lib/sdl2_haptic.rb +301 -269
 - data/lib/sdl2_hidapi.rb +139 -118
 - data/lib/sdl2_hints.rb +221 -197
 - data/lib/sdl2_image.rb +232 -185
 - data/lib/sdl2_imageFilter.rb +164 -132
 - data/lib/sdl2_joystick.rb +294 -239
 - data/lib/sdl2_keyboard.rb +125 -99
 - data/lib/sdl2_keycode.rb +307 -305
 - data/lib/sdl2_log.rb +131 -115
 - data/lib/sdl2_main.rb +74 -67
 - data/lib/sdl2_messagebox.rb +102 -98
 - data/lib/sdl2_misc.rb +48 -45
 - data/lib/sdl2_mixer.rb +392 -317
 - data/lib/sdl2_mouse.rb +136 -117
 - data/lib/sdl2_pixels.rb +240 -224
 - data/lib/sdl2_platform.rb +48 -45
 - data/lib/sdl2_power.rb +54 -51
 - data/lib/sdl2_rect.rb +145 -102
 - data/lib/sdl2_render.rb +408 -322
 - data/lib/sdl2_rotozoom.rb +76 -66
 - data/lib/sdl2_rwops.rb +238 -208
 - data/lib/sdl2_scancode.rb +289 -287
 - data/lib/sdl2_sensor.rb +115 -97
 - data/lib/sdl2_shape.rb +83 -77
 - data/lib/sdl2_sound.rb +154 -0
 - data/lib/sdl2_stdinc.rb +556 -439
 - data/lib/sdl2_surface.rb +229 -188
 - data/lib/sdl2_syswm.rb +160 -156
 - data/lib/sdl2_timer.rb +74 -65
 - data/lib/sdl2_touch.rb +86 -75
 - data/lib/sdl2_ttf.rb +358 -202
 - data/lib/sdl2_version.rb +67 -62
 - data/lib/sdl2_video.rb +540 -446
 - data/lib/sdl2_vulkan.rb +72 -64
 - metadata +19 -4
 
    
        data/lib/sdl2_clipboard.rb
    CHANGED
    
    | 
         @@ -1,51 +1,56 @@ 
     | 
|
| 
       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  
     | 
| 
       10 
     | 
    
         
            -
              extend FFI::Library
         
     | 
| 
       11 
     | 
    
         
            -
              # Define/Macro
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              # Enum
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
              # Struct
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              # Function
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              def self.setup_clipboard_symbols()
         
     | 
| 
       26 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       27 
     | 
    
         
            -
                  :SDL_SetClipboardText,
         
     | 
| 
       28 
     | 
    
         
            -
                  :SDL_GetClipboardText,
         
     | 
| 
       29 
     | 
    
         
            -
                  :SDL_HasClipboardText,
         
     | 
| 
       30 
     | 
    
         
            -
                ]
         
     | 
| 
       31 
     | 
    
         
            -
                 
     | 
| 
       32 
     | 
    
         
            -
                  :SDL_SetClipboardText =>  
     | 
| 
       33 
     | 
    
         
            -
                  :SDL_GetClipboardText =>  
     | 
| 
       34 
     | 
    
         
            -
                  :SDL_HasClipboardText =>  
     | 
| 
       35 
     | 
    
         
            -
                }
         
     | 
| 
       36 
     | 
    
         
            -
                 
     | 
| 
       37 
     | 
    
         
            -
                  :SDL_SetClipboardText => : 
     | 
| 
       38 
     | 
    
         
            -
                  :SDL_GetClipboardText =>  
     | 
| 
       39 
     | 
    
         
            -
                  :SDL_HasClipboardText =>  
     | 
| 
       40 
     | 
    
         
            -
                }
         
     | 
| 
       41 
     | 
    
         
            -
                 
     | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 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 SDL
         
     | 
| 
      
 10 
     | 
    
         
            +
              extend FFI::Library
         
     | 
| 
      
 11 
     | 
    
         
            +
              # Define/Macro
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              def self.setup_clipboard_symbols(output_error = false)
         
     | 
| 
      
 26 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 27 
     | 
    
         
            +
                  :SDL_SetClipboardText,
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :SDL_GetClipboardText,
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :SDL_HasClipboardText,
         
     | 
| 
      
 30 
     | 
    
         
            +
                ]
         
     | 
| 
      
 31 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 32 
     | 
    
         
            +
                  :SDL_SetClipboardText => :SetClipboardText,
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :SDL_GetClipboardText => :GetClipboardText,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :SDL_HasClipboardText => :HasClipboardText,
         
     | 
| 
      
 35 
     | 
    
         
            +
                }
         
     | 
| 
      
 36 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 37 
     | 
    
         
            +
                  :SDL_SetClipboardText => [:pointer],
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :SDL_GetClipboardText => [],
         
     | 
| 
      
 39 
     | 
    
         
            +
                  :SDL_HasClipboardText => [],
         
     | 
| 
      
 40 
     | 
    
         
            +
                }
         
     | 
| 
      
 41 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 42 
     | 
    
         
            +
                  :SDL_SetClipboardText => :int,
         
     | 
| 
      
 43 
     | 
    
         
            +
                  :SDL_GetClipboardText => :pointer,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  :SDL_HasClipboardText => :int,
         
     | 
| 
      
 45 
     | 
    
         
            +
                }
         
     | 
| 
      
 46 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 47 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 48 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 49 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 50 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
    
        data/lib/sdl2_cpuinfo.rb
    CHANGED
    
    | 
         @@ -1,106 +1,129 @@ 
     | 
|
| 
       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  
     | 
| 
       10 
     | 
    
         
            -
              extend FFI::Library
         
     | 
| 
       11 
     | 
    
         
            -
              # Define/Macro
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
               
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              # Enum
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              # Struct
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              # Function
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              def self.setup_cpuinfo_symbols()
         
     | 
| 
       27 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       28 
     | 
    
         
            -
                  :SDL_GetCPUCount,
         
     | 
| 
       29 
     | 
    
         
            -
                  :SDL_GetCPUCacheLineSize,
         
     | 
| 
       30 
     | 
    
         
            -
                  :SDL_HasRDTSC,
         
     | 
| 
       31 
     | 
    
         
            -
                  :SDL_HasAltiVec,
         
     | 
| 
       32 
     | 
    
         
            -
                  :SDL_HasMMX,
         
     | 
| 
       33 
     | 
    
         
            -
                  :SDL_Has3DNow,
         
     | 
| 
       34 
     | 
    
         
            -
                  :SDL_HasSSE,
         
     | 
| 
       35 
     | 
    
         
            -
                  :SDL_HasSSE2,
         
     | 
| 
       36 
     | 
    
         
            -
                  :SDL_HasSSE3,
         
     | 
| 
       37 
     | 
    
         
            -
                  :SDL_HasSSE41,
         
     | 
| 
       38 
     | 
    
         
            -
                  :SDL_HasSSE42,
         
     | 
| 
       39 
     | 
    
         
            -
                  :SDL_HasAVX,
         
     | 
| 
       40 
     | 
    
         
            -
                  :SDL_HasAVX2,
         
     | 
| 
       41 
     | 
    
         
            -
                  :SDL_HasAVX512F,
         
     | 
| 
       42 
     | 
    
         
            -
                  :SDL_HasARMSIMD,
         
     | 
| 
       43 
     | 
    
         
            -
                  :SDL_HasNEON,
         
     | 
| 
       44 
     | 
    
         
            -
                  :SDL_GetSystemRAM,
         
     | 
| 
       45 
     | 
    
         
            -
                  :SDL_SIMDGetAlignment,
         
     | 
| 
       46 
     | 
    
         
            -
                  :SDL_SIMDAlloc,
         
     | 
| 
       47 
     | 
    
         
            -
                  :SDL_SIMDRealloc,
         
     | 
| 
       48 
     | 
    
         
            -
                  :SDL_SIMDFree,
         
     | 
| 
       49 
     | 
    
         
            -
                ]
         
     | 
| 
       50 
     | 
    
         
            -
                 
     | 
| 
       51 
     | 
    
         
            -
                  :SDL_GetCPUCount =>  
     | 
| 
       52 
     | 
    
         
            -
                  :SDL_GetCPUCacheLineSize =>  
     | 
| 
       53 
     | 
    
         
            -
                  :SDL_HasRDTSC =>  
     | 
| 
       54 
     | 
    
         
            -
                  :SDL_HasAltiVec =>  
     | 
| 
       55 
     | 
    
         
            -
                  :SDL_HasMMX =>  
     | 
| 
       56 
     | 
    
         
            -
                  :SDL_Has3DNow =>  
     | 
| 
       57 
     | 
    
         
            -
                  :SDL_HasSSE =>  
     | 
| 
       58 
     | 
    
         
            -
                  :SDL_HasSSE2 =>  
     | 
| 
       59 
     | 
    
         
            -
                  :SDL_HasSSE3 =>  
     | 
| 
       60 
     | 
    
         
            -
                  :SDL_HasSSE41 =>  
     | 
| 
       61 
     | 
    
         
            -
                  :SDL_HasSSE42 =>  
     | 
| 
       62 
     | 
    
         
            -
                  :SDL_HasAVX =>  
     | 
| 
       63 
     | 
    
         
            -
                  :SDL_HasAVX2 =>  
     | 
| 
       64 
     | 
    
         
            -
                  :SDL_HasAVX512F =>  
     | 
| 
       65 
     | 
    
         
            -
                  :SDL_HasARMSIMD =>  
     | 
| 
       66 
     | 
    
         
            -
                  :SDL_HasNEON =>  
     | 
| 
       67 
     | 
    
         
            -
                  :SDL_GetSystemRAM =>  
     | 
| 
       68 
     | 
    
         
            -
                  :SDL_SIMDGetAlignment =>  
     | 
| 
       69 
     | 
    
         
            -
                  :SDL_SIMDAlloc =>  
     | 
| 
       70 
     | 
    
         
            -
                  :SDL_SIMDRealloc =>  
     | 
| 
       71 
     | 
    
         
            -
                  :SDL_SIMDFree =>  
     | 
| 
       72 
     | 
    
         
            -
                }
         
     | 
| 
       73 
     | 
    
         
            -
                 
     | 
| 
       74 
     | 
    
         
            -
                  :SDL_GetCPUCount =>  
     | 
| 
       75 
     | 
    
         
            -
                  :SDL_GetCPUCacheLineSize =>  
     | 
| 
       76 
     | 
    
         
            -
                  :SDL_HasRDTSC =>  
     | 
| 
       77 
     | 
    
         
            -
                  :SDL_HasAltiVec =>  
     | 
| 
       78 
     | 
    
         
            -
                  :SDL_HasMMX =>  
     | 
| 
       79 
     | 
    
         
            -
                  :SDL_Has3DNow =>  
     | 
| 
       80 
     | 
    
         
            -
                  :SDL_HasSSE =>  
     | 
| 
       81 
     | 
    
         
            -
                  :SDL_HasSSE2 =>  
     | 
| 
       82 
     | 
    
         
            -
                  :SDL_HasSSE3 =>  
     | 
| 
       83 
     | 
    
         
            -
                  :SDL_HasSSE41 =>  
     | 
| 
       84 
     | 
    
         
            -
                  :SDL_HasSSE42 =>  
     | 
| 
       85 
     | 
    
         
            -
                  :SDL_HasAVX =>  
     | 
| 
       86 
     | 
    
         
            -
                  :SDL_HasAVX2 =>  
     | 
| 
       87 
     | 
    
         
            -
                  :SDL_HasAVX512F =>  
     | 
| 
       88 
     | 
    
         
            -
                  :SDL_HasARMSIMD =>  
     | 
| 
       89 
     | 
    
         
            -
                  :SDL_HasNEON =>  
     | 
| 
       90 
     | 
    
         
            -
                  :SDL_GetSystemRAM =>  
     | 
| 
       91 
     | 
    
         
            -
                  :SDL_SIMDGetAlignment =>  
     | 
| 
       92 
     | 
    
         
            -
                  :SDL_SIMDAlloc => : 
     | 
| 
       93 
     | 
    
         
            -
                  :SDL_SIMDRealloc => :pointer,
         
     | 
| 
       94 
     | 
    
         
            -
                  :SDL_SIMDFree => : 
     | 
| 
       95 
     | 
    
         
            -
                }
         
     | 
| 
       96 
     | 
    
         
            -
                 
     | 
| 
       97 
     | 
    
         
            -
                   
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                   
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                   
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
      
 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 SDL
         
     | 
| 
      
 10 
     | 
    
         
            +
              extend FFI::Library
         
     | 
| 
      
 11 
     | 
    
         
            +
              # Define/Macro
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              CACHELINE_SIZE = 128
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def self.setup_cpuinfo_symbols(output_error = false)
         
     | 
| 
      
 27 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :SDL_GetCPUCount,
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :SDL_GetCPUCacheLineSize,
         
     | 
| 
      
 30 
     | 
    
         
            +
                  :SDL_HasRDTSC,
         
     | 
| 
      
 31 
     | 
    
         
            +
                  :SDL_HasAltiVec,
         
     | 
| 
      
 32 
     | 
    
         
            +
                  :SDL_HasMMX,
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :SDL_Has3DNow,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :SDL_HasSSE,
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :SDL_HasSSE2,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :SDL_HasSSE3,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  :SDL_HasSSE41,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :SDL_HasSSE42,
         
     | 
| 
      
 39 
     | 
    
         
            +
                  :SDL_HasAVX,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  :SDL_HasAVX2,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  :SDL_HasAVX512F,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  :SDL_HasARMSIMD,
         
     | 
| 
      
 43 
     | 
    
         
            +
                  :SDL_HasNEON,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  :SDL_GetSystemRAM,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  :SDL_SIMDGetAlignment,
         
     | 
| 
      
 46 
     | 
    
         
            +
                  :SDL_SIMDAlloc,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  :SDL_SIMDRealloc,
         
     | 
| 
      
 48 
     | 
    
         
            +
                  :SDL_SIMDFree,
         
     | 
| 
      
 49 
     | 
    
         
            +
                ]
         
     | 
| 
      
 50 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 51 
     | 
    
         
            +
                  :SDL_GetCPUCount => :GetCPUCount,
         
     | 
| 
      
 52 
     | 
    
         
            +
                  :SDL_GetCPUCacheLineSize => :GetCPUCacheLineSize,
         
     | 
| 
      
 53 
     | 
    
         
            +
                  :SDL_HasRDTSC => :HasRDTSC,
         
     | 
| 
      
 54 
     | 
    
         
            +
                  :SDL_HasAltiVec => :HasAltiVec,
         
     | 
| 
      
 55 
     | 
    
         
            +
                  :SDL_HasMMX => :HasMMX,
         
     | 
| 
      
 56 
     | 
    
         
            +
                  :SDL_Has3DNow => :Has3DNow,
         
     | 
| 
      
 57 
     | 
    
         
            +
                  :SDL_HasSSE => :HasSSE,
         
     | 
| 
      
 58 
     | 
    
         
            +
                  :SDL_HasSSE2 => :HasSSE2,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  :SDL_HasSSE3 => :HasSSE3,
         
     | 
| 
      
 60 
     | 
    
         
            +
                  :SDL_HasSSE41 => :HasSSE41,
         
     | 
| 
      
 61 
     | 
    
         
            +
                  :SDL_HasSSE42 => :HasSSE42,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :SDL_HasAVX => :HasAVX,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  :SDL_HasAVX2 => :HasAVX2,
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :SDL_HasAVX512F => :HasAVX512F,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  :SDL_HasARMSIMD => :HasARMSIMD,
         
     | 
| 
      
 66 
     | 
    
         
            +
                  :SDL_HasNEON => :HasNEON,
         
     | 
| 
      
 67 
     | 
    
         
            +
                  :SDL_GetSystemRAM => :GetSystemRAM,
         
     | 
| 
      
 68 
     | 
    
         
            +
                  :SDL_SIMDGetAlignment => :SIMDGetAlignment,
         
     | 
| 
      
 69 
     | 
    
         
            +
                  :SDL_SIMDAlloc => :SIMDAlloc,
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :SDL_SIMDRealloc => :SIMDRealloc,
         
     | 
| 
      
 71 
     | 
    
         
            +
                  :SDL_SIMDFree => :SIMDFree,
         
     | 
| 
      
 72 
     | 
    
         
            +
                }
         
     | 
| 
      
 73 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 74 
     | 
    
         
            +
                  :SDL_GetCPUCount => [],
         
     | 
| 
      
 75 
     | 
    
         
            +
                  :SDL_GetCPUCacheLineSize => [],
         
     | 
| 
      
 76 
     | 
    
         
            +
                  :SDL_HasRDTSC => [],
         
     | 
| 
      
 77 
     | 
    
         
            +
                  :SDL_HasAltiVec => [],
         
     | 
| 
      
 78 
     | 
    
         
            +
                  :SDL_HasMMX => [],
         
     | 
| 
      
 79 
     | 
    
         
            +
                  :SDL_Has3DNow => [],
         
     | 
| 
      
 80 
     | 
    
         
            +
                  :SDL_HasSSE => [],
         
     | 
| 
      
 81 
     | 
    
         
            +
                  :SDL_HasSSE2 => [],
         
     | 
| 
      
 82 
     | 
    
         
            +
                  :SDL_HasSSE3 => [],
         
     | 
| 
      
 83 
     | 
    
         
            +
                  :SDL_HasSSE41 => [],
         
     | 
| 
      
 84 
     | 
    
         
            +
                  :SDL_HasSSE42 => [],
         
     | 
| 
      
 85 
     | 
    
         
            +
                  :SDL_HasAVX => [],
         
     | 
| 
      
 86 
     | 
    
         
            +
                  :SDL_HasAVX2 => [],
         
     | 
| 
      
 87 
     | 
    
         
            +
                  :SDL_HasAVX512F => [],
         
     | 
| 
      
 88 
     | 
    
         
            +
                  :SDL_HasARMSIMD => [],
         
     | 
| 
      
 89 
     | 
    
         
            +
                  :SDL_HasNEON => [],
         
     | 
| 
      
 90 
     | 
    
         
            +
                  :SDL_GetSystemRAM => [],
         
     | 
| 
      
 91 
     | 
    
         
            +
                  :SDL_SIMDGetAlignment => [],
         
     | 
| 
      
 92 
     | 
    
         
            +
                  :SDL_SIMDAlloc => [:int],
         
     | 
| 
      
 93 
     | 
    
         
            +
                  :SDL_SIMDRealloc => [:pointer, :int],
         
     | 
| 
      
 94 
     | 
    
         
            +
                  :SDL_SIMDFree => [:pointer],
         
     | 
| 
      
 95 
     | 
    
         
            +
                }
         
     | 
| 
      
 96 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 97 
     | 
    
         
            +
                  :SDL_GetCPUCount => :int,
         
     | 
| 
      
 98 
     | 
    
         
            +
                  :SDL_GetCPUCacheLineSize => :int,
         
     | 
| 
      
 99 
     | 
    
         
            +
                  :SDL_HasRDTSC => :int,
         
     | 
| 
      
 100 
     | 
    
         
            +
                  :SDL_HasAltiVec => :int,
         
     | 
| 
      
 101 
     | 
    
         
            +
                  :SDL_HasMMX => :int,
         
     | 
| 
      
 102 
     | 
    
         
            +
                  :SDL_Has3DNow => :int,
         
     | 
| 
      
 103 
     | 
    
         
            +
                  :SDL_HasSSE => :int,
         
     | 
| 
      
 104 
     | 
    
         
            +
                  :SDL_HasSSE2 => :int,
         
     | 
| 
      
 105 
     | 
    
         
            +
                  :SDL_HasSSE3 => :int,
         
     | 
| 
      
 106 
     | 
    
         
            +
                  :SDL_HasSSE41 => :int,
         
     | 
| 
      
 107 
     | 
    
         
            +
                  :SDL_HasSSE42 => :int,
         
     | 
| 
      
 108 
     | 
    
         
            +
                  :SDL_HasAVX => :int,
         
     | 
| 
      
 109 
     | 
    
         
            +
                  :SDL_HasAVX2 => :int,
         
     | 
| 
      
 110 
     | 
    
         
            +
                  :SDL_HasAVX512F => :int,
         
     | 
| 
      
 111 
     | 
    
         
            +
                  :SDL_HasARMSIMD => :int,
         
     | 
| 
      
 112 
     | 
    
         
            +
                  :SDL_HasNEON => :int,
         
     | 
| 
      
 113 
     | 
    
         
            +
                  :SDL_GetSystemRAM => :int,
         
     | 
| 
      
 114 
     | 
    
         
            +
                  :SDL_SIMDGetAlignment => :int,
         
     | 
| 
      
 115 
     | 
    
         
            +
                  :SDL_SIMDAlloc => :pointer,
         
     | 
| 
      
 116 
     | 
    
         
            +
                  :SDL_SIMDRealloc => :pointer,
         
     | 
| 
      
 117 
     | 
    
         
            +
                  :SDL_SIMDFree => :void,
         
     | 
| 
      
 118 
     | 
    
         
            +
                }
         
     | 
| 
      
 119 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 120 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 121 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 122 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 123 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 124 
     | 
    
         
            +
                  end
         
     | 
| 
      
 125 
     | 
    
         
            +
                end
         
     | 
| 
      
 126 
     | 
    
         
            +
              end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
    
        data/lib/sdl2_error.rb
    CHANGED
    
    | 
         @@ -1,64 +1,71 @@ 
     | 
|
| 
       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  
     | 
| 
       10 
     | 
    
         
            -
              extend FFI::Library
         
     | 
| 
       11 
     | 
    
         
            -
              # Define/Macro
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              # Enum
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              typedef :int, :SDL_errorcode
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              # Struct
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              # Function
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              def self.setup_error_symbols()
         
     | 
| 
       33 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       34 
     | 
    
         
            -
                  :SDL_SetError,
         
     | 
| 
       35 
     | 
    
         
            -
                  :SDL_GetError,
         
     | 
| 
       36 
     | 
    
         
            -
                  :SDL_GetErrorMsg,
         
     | 
| 
       37 
     | 
    
         
            -
                  :SDL_ClearError,
         
     | 
| 
       38 
     | 
    
         
            -
                  :SDL_Error,
         
     | 
| 
       39 
     | 
    
         
            -
                ]
         
     | 
| 
       40 
     | 
    
         
            -
                 
     | 
| 
       41 
     | 
    
         
            -
                  :SDL_SetError =>  
     | 
| 
       42 
     | 
    
         
            -
                  :SDL_GetError =>  
     | 
| 
       43 
     | 
    
         
            -
                  :SDL_GetErrorMsg =>  
     | 
| 
       44 
     | 
    
         
            -
                  :SDL_ClearError =>  
     | 
| 
       45 
     | 
    
         
            -
                  :SDL_Error =>  
     | 
| 
       46 
     | 
    
         
            -
                }
         
     | 
| 
       47 
     | 
    
         
            -
                 
     | 
| 
       48 
     | 
    
         
            -
                  :SDL_SetError => : 
     | 
| 
       49 
     | 
    
         
            -
                  :SDL_GetError =>  
     | 
| 
       50 
     | 
    
         
            -
                  :SDL_GetErrorMsg => :pointer,
         
     | 
| 
       51 
     | 
    
         
            -
                  :SDL_ClearError =>  
     | 
| 
       52 
     | 
    
         
            -
                  :SDL_Error => :int,
         
     | 
| 
       53 
     | 
    
         
            -
                }
         
     | 
| 
       54 
     | 
    
         
            -
                 
     | 
| 
       55 
     | 
    
         
            -
                   
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                   
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                   
     | 
| 
       60 
     | 
    
         
            -
                 
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 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 SDL
         
     | 
| 
      
 10 
     | 
    
         
            +
              extend FFI::Library
         
     | 
| 
      
 11 
     | 
    
         
            +
              # Define/Macro
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              ENOMEM = 0
         
     | 
| 
      
 17 
     | 
    
         
            +
              EFREAD = 1
         
     | 
| 
      
 18 
     | 
    
         
            +
              EFWRITE = 2
         
     | 
| 
      
 19 
     | 
    
         
            +
              EFSEEK = 3
         
     | 
| 
      
 20 
     | 
    
         
            +
              UNSUPPORTED = 4
         
     | 
| 
      
 21 
     | 
    
         
            +
              LASTERROR = 5
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              typedef :int, :SDL_errorcode
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              def self.setup_error_symbols(output_error = false)
         
     | 
| 
      
 33 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :SDL_SetError,
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :SDL_GetError,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :SDL_GetErrorMsg,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  :SDL_ClearError,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :SDL_Error,
         
     | 
| 
      
 39 
     | 
    
         
            +
                ]
         
     | 
| 
      
 40 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 41 
     | 
    
         
            +
                  :SDL_SetError => :SetError,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  :SDL_GetError => :GetError,
         
     | 
| 
      
 43 
     | 
    
         
            +
                  :SDL_GetErrorMsg => :GetErrorMsg,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  :SDL_ClearError => :ClearError,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  :SDL_Error => :Error,
         
     | 
| 
      
 46 
     | 
    
         
            +
                }
         
     | 
| 
      
 47 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 48 
     | 
    
         
            +
                  :SDL_SetError => [:pointer],
         
     | 
| 
      
 49 
     | 
    
         
            +
                  :SDL_GetError => [],
         
     | 
| 
      
 50 
     | 
    
         
            +
                  :SDL_GetErrorMsg => [:pointer, :int],
         
     | 
| 
      
 51 
     | 
    
         
            +
                  :SDL_ClearError => [],
         
     | 
| 
      
 52 
     | 
    
         
            +
                  :SDL_Error => [:int],
         
     | 
| 
      
 53 
     | 
    
         
            +
                }
         
     | 
| 
      
 54 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 55 
     | 
    
         
            +
                  :SDL_SetError => :int,
         
     | 
| 
      
 56 
     | 
    
         
            +
                  :SDL_GetError => :pointer,
         
     | 
| 
      
 57 
     | 
    
         
            +
                  :SDL_GetErrorMsg => :pointer,
         
     | 
| 
      
 58 
     | 
    
         
            +
                  :SDL_ClearError => :void,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  :SDL_Error => :int,
         
     | 
| 
      
 60 
     | 
    
         
            +
                }
         
     | 
| 
      
 61 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 62 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 63 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 64 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 65 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     |