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_surface.rb
    CHANGED
    
    | 
         @@ -1,188 +1,229 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
            require_relative 'sdl2_rect'
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            module  
     | 
| 
       11 
     | 
    
         
            -
              extend FFI::Library
         
     | 
| 
       12 
     | 
    
         
            -
              # Define/Macro
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
              # Enum
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
              callback :SDL_blit, [:pointer, :pointer, :pointer, :pointer], :int
         
     | 
| 
       30 
     | 
    
         
            -
              typedef :int, :SDL_YUV_CONVERSION_MODE
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              # Struct
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
              class  
     | 
| 
       35 
     | 
    
         
            -
                layout(
         
     | 
| 
       36 
     | 
    
         
            -
                  :flags, :uint,
         
     | 
| 
       37 
     | 
    
         
            -
                  :format, :pointer,
         
     | 
| 
       38 
     | 
    
         
            -
                  :w, :int,
         
     | 
| 
       39 
     | 
    
         
            -
                  :h, :int,
         
     | 
| 
       40 
     | 
    
         
            -
                  :pitch, :int,
         
     | 
| 
       41 
     | 
    
         
            -
                  :pixels, :pointer,
         
     | 
| 
       42 
     | 
    
         
            -
                  :userdata, :pointer,
         
     | 
| 
       43 
     | 
    
         
            -
                  :locked, :int,
         
     | 
| 
       44 
     | 
    
         
            -
                  :list_blitmap, :pointer,
         
     | 
| 
       45 
     | 
    
         
            -
                  :clip_rect,  
     | 
| 
       46 
     | 
    
         
            -
                  :map, :pointer,
         
     | 
| 
       47 
     | 
    
         
            -
                  :refcount, :int,
         
     | 
| 
       48 
     | 
    
         
            -
                )
         
     | 
| 
       49 
     | 
    
         
            -
              end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
              # Function
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
              def self.setup_surface_symbols()
         
     | 
| 
       55 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       56 
     | 
    
         
            -
                  :SDL_CreateRGBSurface,
         
     | 
| 
       57 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceWithFormat,
         
     | 
| 
       58 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceFrom,
         
     | 
| 
       59 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceWithFormatFrom,
         
     | 
| 
       60 
     | 
    
         
            -
                  :SDL_FreeSurface,
         
     | 
| 
       61 
     | 
    
         
            -
                  :SDL_SetSurfacePalette,
         
     | 
| 
       62 
     | 
    
         
            -
                  :SDL_LockSurface,
         
     | 
| 
       63 
     | 
    
         
            -
                  :SDL_UnlockSurface,
         
     | 
| 
       64 
     | 
    
         
            -
                  :SDL_LoadBMP_RW,
         
     | 
| 
       65 
     | 
    
         
            -
                  :SDL_SaveBMP_RW,
         
     | 
| 
       66 
     | 
    
         
            -
                  :SDL_SetSurfaceRLE,
         
     | 
| 
       67 
     | 
    
         
            -
                  :SDL_HasSurfaceRLE,
         
     | 
| 
       68 
     | 
    
         
            -
                  :SDL_SetColorKey,
         
     | 
| 
       69 
     | 
    
         
            -
                  :SDL_HasColorKey,
         
     | 
| 
       70 
     | 
    
         
            -
                  :SDL_GetColorKey,
         
     | 
| 
       71 
     | 
    
         
            -
                  :SDL_SetSurfaceColorMod,
         
     | 
| 
       72 
     | 
    
         
            -
                  :SDL_GetSurfaceColorMod,
         
     | 
| 
       73 
     | 
    
         
            -
                  :SDL_SetSurfaceAlphaMod,
         
     | 
| 
       74 
     | 
    
         
            -
                  :SDL_GetSurfaceAlphaMod,
         
     | 
| 
       75 
     | 
    
         
            -
                  :SDL_SetSurfaceBlendMode,
         
     | 
| 
       76 
     | 
    
         
            -
                  :SDL_GetSurfaceBlendMode,
         
     | 
| 
       77 
     | 
    
         
            -
                  :SDL_SetClipRect,
         
     | 
| 
       78 
     | 
    
         
            -
                  :SDL_GetClipRect,
         
     | 
| 
       79 
     | 
    
         
            -
                  :SDL_DuplicateSurface,
         
     | 
| 
       80 
     | 
    
         
            -
                  :SDL_ConvertSurface,
         
     | 
| 
       81 
     | 
    
         
            -
                  :SDL_ConvertSurfaceFormat,
         
     | 
| 
       82 
     | 
    
         
            -
                  :SDL_ConvertPixels,
         
     | 
| 
       83 
     | 
    
         
            -
                  :SDL_PremultiplyAlpha,
         
     | 
| 
       84 
     | 
    
         
            -
                  :SDL_FillRect,
         
     | 
| 
       85 
     | 
    
         
            -
                  :SDL_FillRects,
         
     | 
| 
       86 
     | 
    
         
            -
                  :SDL_UpperBlit,
         
     | 
| 
       87 
     | 
    
         
            -
                  :SDL_LowerBlit,
         
     | 
| 
       88 
     | 
    
         
            -
                  :SDL_SoftStretch,
         
     | 
| 
       89 
     | 
    
         
            -
                  :SDL_SoftStretchLinear,
         
     | 
| 
       90 
     | 
    
         
            -
                  :SDL_UpperBlitScaled,
         
     | 
| 
       91 
     | 
    
         
            -
                  :SDL_LowerBlitScaled,
         
     | 
| 
       92 
     | 
    
         
            -
                  :SDL_SetYUVConversionMode,
         
     | 
| 
       93 
     | 
    
         
            -
                  :SDL_GetYUVConversionMode,
         
     | 
| 
       94 
     | 
    
         
            -
                  :SDL_GetYUVConversionModeForResolution,
         
     | 
| 
       95 
     | 
    
         
            -
                ]
         
     | 
| 
       96 
     | 
    
         
            -
                 
     | 
| 
       97 
     | 
    
         
            -
                  :SDL_CreateRGBSurface =>  
     | 
| 
       98 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceWithFormat =>  
     | 
| 
       99 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceFrom =>  
     | 
| 
       100 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceWithFormatFrom =>  
     | 
| 
       101 
     | 
    
         
            -
                  :SDL_FreeSurface =>  
     | 
| 
       102 
     | 
    
         
            -
                  :SDL_SetSurfacePalette =>  
     | 
| 
       103 
     | 
    
         
            -
                  :SDL_LockSurface =>  
     | 
| 
       104 
     | 
    
         
            -
                  :SDL_UnlockSurface =>  
     | 
| 
       105 
     | 
    
         
            -
                  :SDL_LoadBMP_RW =>  
     | 
| 
       106 
     | 
    
         
            -
                  :SDL_SaveBMP_RW =>  
     | 
| 
       107 
     | 
    
         
            -
                  :SDL_SetSurfaceRLE =>  
     | 
| 
       108 
     | 
    
         
            -
                  :SDL_HasSurfaceRLE =>  
     | 
| 
       109 
     | 
    
         
            -
                  :SDL_SetColorKey =>  
     | 
| 
       110 
     | 
    
         
            -
                  :SDL_HasColorKey =>  
     | 
| 
       111 
     | 
    
         
            -
                  :SDL_GetColorKey =>  
     | 
| 
       112 
     | 
    
         
            -
                  :SDL_SetSurfaceColorMod =>  
     | 
| 
       113 
     | 
    
         
            -
                  :SDL_GetSurfaceColorMod =>  
     | 
| 
       114 
     | 
    
         
            -
                  :SDL_SetSurfaceAlphaMod =>  
     | 
| 
       115 
     | 
    
         
            -
                  :SDL_GetSurfaceAlphaMod =>  
     | 
| 
       116 
     | 
    
         
            -
                  :SDL_SetSurfaceBlendMode =>  
     | 
| 
       117 
     | 
    
         
            -
                  :SDL_GetSurfaceBlendMode =>  
     | 
| 
       118 
     | 
    
         
            -
                  :SDL_SetClipRect =>  
     | 
| 
       119 
     | 
    
         
            -
                  :SDL_GetClipRect =>  
     | 
| 
       120 
     | 
    
         
            -
                  :SDL_DuplicateSurface =>  
     | 
| 
       121 
     | 
    
         
            -
                  :SDL_ConvertSurface =>  
     | 
| 
       122 
     | 
    
         
            -
                  :SDL_ConvertSurfaceFormat =>  
     | 
| 
       123 
     | 
    
         
            -
                  :SDL_ConvertPixels =>  
     | 
| 
       124 
     | 
    
         
            -
                  :SDL_PremultiplyAlpha =>  
     | 
| 
       125 
     | 
    
         
            -
                  :SDL_FillRect =>  
     | 
| 
       126 
     | 
    
         
            -
                  :SDL_FillRects =>  
     | 
| 
       127 
     | 
    
         
            -
                  :SDL_UpperBlit =>  
     | 
| 
       128 
     | 
    
         
            -
                  :SDL_LowerBlit =>  
     | 
| 
       129 
     | 
    
         
            -
                  :SDL_SoftStretch =>  
     | 
| 
       130 
     | 
    
         
            -
                  :SDL_SoftStretchLinear =>  
     | 
| 
       131 
     | 
    
         
            -
                  :SDL_UpperBlitScaled =>  
     | 
| 
       132 
     | 
    
         
            -
                  :SDL_LowerBlitScaled =>  
     | 
| 
       133 
     | 
    
         
            -
                  :SDL_SetYUVConversionMode =>  
     | 
| 
       134 
     | 
    
         
            -
                  :SDL_GetYUVConversionMode =>  
     | 
| 
       135 
     | 
    
         
            -
                  :SDL_GetYUVConversionModeForResolution =>  
     | 
| 
       136 
     | 
    
         
            -
                }
         
     | 
| 
       137 
     | 
    
         
            -
                 
     | 
| 
       138 
     | 
    
         
            -
                  :SDL_CreateRGBSurface => : 
     | 
| 
       139 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceWithFormat => : 
     | 
| 
       140 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceFrom => :pointer,
         
     | 
| 
       141 
     | 
    
         
            -
                  :SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
         
     | 
| 
       142 
     | 
    
         
            -
                  :SDL_FreeSurface => : 
     | 
| 
       143 
     | 
    
         
            -
                  :SDL_SetSurfacePalette => : 
     | 
| 
       144 
     | 
    
         
            -
                  :SDL_LockSurface => : 
     | 
| 
       145 
     | 
    
         
            -
                  :SDL_UnlockSurface => : 
     | 
| 
       146 
     | 
    
         
            -
                  :SDL_LoadBMP_RW => :pointer,
         
     | 
| 
       147 
     | 
    
         
            -
                  :SDL_SaveBMP_RW => :int,
         
     | 
| 
       148 
     | 
    
         
            -
                  :SDL_SetSurfaceRLE => :int,
         
     | 
| 
       149 
     | 
    
         
            -
                  :SDL_HasSurfaceRLE => : 
     | 
| 
       150 
     | 
    
         
            -
                  :SDL_SetColorKey => :int,
         
     | 
| 
       151 
     | 
    
         
            -
                  :SDL_HasColorKey => : 
     | 
| 
       152 
     | 
    
         
            -
                  :SDL_GetColorKey => : 
     | 
| 
       153 
     | 
    
         
            -
                  :SDL_SetSurfaceColorMod => : 
     | 
| 
       154 
     | 
    
         
            -
                  :SDL_GetSurfaceColorMod => : 
     | 
| 
       155 
     | 
    
         
            -
                  :SDL_SetSurfaceAlphaMod => : 
     | 
| 
       156 
     | 
    
         
            -
                  :SDL_GetSurfaceAlphaMod => : 
     | 
| 
       157 
     | 
    
         
            -
                  :SDL_SetSurfaceBlendMode => :int,
         
     | 
| 
       158 
     | 
    
         
            -
                  :SDL_GetSurfaceBlendMode => : 
     | 
| 
       159 
     | 
    
         
            -
                  :SDL_SetClipRect => : 
     | 
| 
       160 
     | 
    
         
            -
                  :SDL_GetClipRect => : 
     | 
| 
       161 
     | 
    
         
            -
                  :SDL_DuplicateSurface => :pointer,
         
     | 
| 
       162 
     | 
    
         
            -
                  :SDL_ConvertSurface => :pointer,
         
     | 
| 
       163 
     | 
    
         
            -
                  :SDL_ConvertSurfaceFormat => :pointer,
         
     | 
| 
       164 
     | 
    
         
            -
                  :SDL_ConvertPixels => :int,
         
     | 
| 
       165 
     | 
    
         
            -
                  :SDL_PremultiplyAlpha => :int,
         
     | 
| 
       166 
     | 
    
         
            -
                  :SDL_FillRect => : 
     | 
| 
       167 
     | 
    
         
            -
                  :SDL_FillRects => :int,
         
     | 
| 
       168 
     | 
    
         
            -
                  :SDL_UpperBlit => : 
     | 
| 
       169 
     | 
    
         
            -
                  :SDL_LowerBlit => : 
     | 
| 
       170 
     | 
    
         
            -
                  :SDL_SoftStretch => : 
     | 
| 
       171 
     | 
    
         
            -
                  :SDL_SoftStretchLinear => : 
     | 
| 
       172 
     | 
    
         
            -
                  :SDL_UpperBlitScaled => : 
     | 
| 
       173 
     | 
    
         
            -
                  :SDL_LowerBlitScaled => : 
     | 
| 
       174 
     | 
    
         
            -
                  :SDL_SetYUVConversionMode => : 
     | 
| 
       175 
     | 
    
         
            -
                  :SDL_GetYUVConversionMode =>  
     | 
| 
       176 
     | 
    
         
            -
                  :SDL_GetYUVConversionModeForResolution => :int,
         
     | 
| 
       177 
     | 
    
         
            -
                }
         
     | 
| 
       178 
     | 
    
         
            -
                 
     | 
| 
       179 
     | 
    
         
            -
                   
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
                   
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
                   
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            +
            require_relative 'sdl2_rect'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module SDL
         
     | 
| 
      
 11 
     | 
    
         
            +
              extend FFI::Library
         
     | 
| 
      
 12 
     | 
    
         
            +
              # Define/Macro
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              SWSURFACE = 0
         
     | 
| 
      
 15 
     | 
    
         
            +
              PREALLOC = 0x00000001
         
     | 
| 
      
 16 
     | 
    
         
            +
              RLEACCEL = 0x00000002
         
     | 
| 
      
 17 
     | 
    
         
            +
              DONTFREE = 0x00000004
         
     | 
| 
      
 18 
     | 
    
         
            +
              SIMD_ALIGNED = 0x00000008
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              YUV_CONVERSION_JPEG = 0
         
     | 
| 
      
 23 
     | 
    
         
            +
              YUV_CONVERSION_BT601 = 1
         
     | 
| 
      
 24 
     | 
    
         
            +
              YUV_CONVERSION_BT709 = 2
         
     | 
| 
      
 25 
     | 
    
         
            +
              YUV_CONVERSION_AUTOMATIC = 3
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              callback :SDL_blit, [:pointer, :pointer, :pointer, :pointer], :int
         
     | 
| 
      
 30 
     | 
    
         
            +
              typedef :int, :SDL_YUV_CONVERSION_MODE
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              class Surface < FFI::Struct
         
     | 
| 
      
 35 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :flags, :uint,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  :format, :pointer,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :w, :int,
         
     | 
| 
      
 39 
     | 
    
         
            +
                  :h, :int,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  :pitch, :int,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  :pixels, :pointer,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  :userdata, :pointer,
         
     | 
| 
      
 43 
     | 
    
         
            +
                  :locked, :int,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  :list_blitmap, :pointer,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  :clip_rect, Rect,
         
     | 
| 
      
 46 
     | 
    
         
            +
                  :map, :pointer,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  :refcount, :int,
         
     | 
| 
      
 48 
     | 
    
         
            +
                )
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              def self.setup_surface_symbols(output_error = false)
         
     | 
| 
      
 55 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 56 
     | 
    
         
            +
                  :SDL_CreateRGBSurface,
         
     | 
| 
      
 57 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormat,
         
     | 
| 
      
 58 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceFrom,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormatFrom,
         
     | 
| 
      
 60 
     | 
    
         
            +
                  :SDL_FreeSurface,
         
     | 
| 
      
 61 
     | 
    
         
            +
                  :SDL_SetSurfacePalette,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :SDL_LockSurface,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  :SDL_UnlockSurface,
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :SDL_LoadBMP_RW,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  :SDL_SaveBMP_RW,
         
     | 
| 
      
 66 
     | 
    
         
            +
                  :SDL_SetSurfaceRLE,
         
     | 
| 
      
 67 
     | 
    
         
            +
                  :SDL_HasSurfaceRLE,
         
     | 
| 
      
 68 
     | 
    
         
            +
                  :SDL_SetColorKey,
         
     | 
| 
      
 69 
     | 
    
         
            +
                  :SDL_HasColorKey,
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :SDL_GetColorKey,
         
     | 
| 
      
 71 
     | 
    
         
            +
                  :SDL_SetSurfaceColorMod,
         
     | 
| 
      
 72 
     | 
    
         
            +
                  :SDL_GetSurfaceColorMod,
         
     | 
| 
      
 73 
     | 
    
         
            +
                  :SDL_SetSurfaceAlphaMod,
         
     | 
| 
      
 74 
     | 
    
         
            +
                  :SDL_GetSurfaceAlphaMod,
         
     | 
| 
      
 75 
     | 
    
         
            +
                  :SDL_SetSurfaceBlendMode,
         
     | 
| 
      
 76 
     | 
    
         
            +
                  :SDL_GetSurfaceBlendMode,
         
     | 
| 
      
 77 
     | 
    
         
            +
                  :SDL_SetClipRect,
         
     | 
| 
      
 78 
     | 
    
         
            +
                  :SDL_GetClipRect,
         
     | 
| 
      
 79 
     | 
    
         
            +
                  :SDL_DuplicateSurface,
         
     | 
| 
      
 80 
     | 
    
         
            +
                  :SDL_ConvertSurface,
         
     | 
| 
      
 81 
     | 
    
         
            +
                  :SDL_ConvertSurfaceFormat,
         
     | 
| 
      
 82 
     | 
    
         
            +
                  :SDL_ConvertPixels,
         
     | 
| 
      
 83 
     | 
    
         
            +
                  :SDL_PremultiplyAlpha,
         
     | 
| 
      
 84 
     | 
    
         
            +
                  :SDL_FillRect,
         
     | 
| 
      
 85 
     | 
    
         
            +
                  :SDL_FillRects,
         
     | 
| 
      
 86 
     | 
    
         
            +
                  :SDL_UpperBlit,
         
     | 
| 
      
 87 
     | 
    
         
            +
                  :SDL_LowerBlit,
         
     | 
| 
      
 88 
     | 
    
         
            +
                  :SDL_SoftStretch,
         
     | 
| 
      
 89 
     | 
    
         
            +
                  :SDL_SoftStretchLinear,
         
     | 
| 
      
 90 
     | 
    
         
            +
                  :SDL_UpperBlitScaled,
         
     | 
| 
      
 91 
     | 
    
         
            +
                  :SDL_LowerBlitScaled,
         
     | 
| 
      
 92 
     | 
    
         
            +
                  :SDL_SetYUVConversionMode,
         
     | 
| 
      
 93 
     | 
    
         
            +
                  :SDL_GetYUVConversionMode,
         
     | 
| 
      
 94 
     | 
    
         
            +
                  :SDL_GetYUVConversionModeForResolution,
         
     | 
| 
      
 95 
     | 
    
         
            +
                ]
         
     | 
| 
      
 96 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 97 
     | 
    
         
            +
                  :SDL_CreateRGBSurface => :CreateRGBSurface,
         
     | 
| 
      
 98 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormat => :CreateRGBSurfaceWithFormat,
         
     | 
| 
      
 99 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceFrom => :CreateRGBSurfaceFrom,
         
     | 
| 
      
 100 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormatFrom => :CreateRGBSurfaceWithFormatFrom,
         
     | 
| 
      
 101 
     | 
    
         
            +
                  :SDL_FreeSurface => :FreeSurface,
         
     | 
| 
      
 102 
     | 
    
         
            +
                  :SDL_SetSurfacePalette => :SetSurfacePalette,
         
     | 
| 
      
 103 
     | 
    
         
            +
                  :SDL_LockSurface => :LockSurface,
         
     | 
| 
      
 104 
     | 
    
         
            +
                  :SDL_UnlockSurface => :UnlockSurface,
         
     | 
| 
      
 105 
     | 
    
         
            +
                  :SDL_LoadBMP_RW => :LoadBMP_RW,
         
     | 
| 
      
 106 
     | 
    
         
            +
                  :SDL_SaveBMP_RW => :SaveBMP_RW,
         
     | 
| 
      
 107 
     | 
    
         
            +
                  :SDL_SetSurfaceRLE => :SetSurfaceRLE,
         
     | 
| 
      
 108 
     | 
    
         
            +
                  :SDL_HasSurfaceRLE => :HasSurfaceRLE,
         
     | 
| 
      
 109 
     | 
    
         
            +
                  :SDL_SetColorKey => :SetColorKey,
         
     | 
| 
      
 110 
     | 
    
         
            +
                  :SDL_HasColorKey => :HasColorKey,
         
     | 
| 
      
 111 
     | 
    
         
            +
                  :SDL_GetColorKey => :GetColorKey,
         
     | 
| 
      
 112 
     | 
    
         
            +
                  :SDL_SetSurfaceColorMod => :SetSurfaceColorMod,
         
     | 
| 
      
 113 
     | 
    
         
            +
                  :SDL_GetSurfaceColorMod => :GetSurfaceColorMod,
         
     | 
| 
      
 114 
     | 
    
         
            +
                  :SDL_SetSurfaceAlphaMod => :SetSurfaceAlphaMod,
         
     | 
| 
      
 115 
     | 
    
         
            +
                  :SDL_GetSurfaceAlphaMod => :GetSurfaceAlphaMod,
         
     | 
| 
      
 116 
     | 
    
         
            +
                  :SDL_SetSurfaceBlendMode => :SetSurfaceBlendMode,
         
     | 
| 
      
 117 
     | 
    
         
            +
                  :SDL_GetSurfaceBlendMode => :GetSurfaceBlendMode,
         
     | 
| 
      
 118 
     | 
    
         
            +
                  :SDL_SetClipRect => :SetClipRect,
         
     | 
| 
      
 119 
     | 
    
         
            +
                  :SDL_GetClipRect => :GetClipRect,
         
     | 
| 
      
 120 
     | 
    
         
            +
                  :SDL_DuplicateSurface => :DuplicateSurface,
         
     | 
| 
      
 121 
     | 
    
         
            +
                  :SDL_ConvertSurface => :ConvertSurface,
         
     | 
| 
      
 122 
     | 
    
         
            +
                  :SDL_ConvertSurfaceFormat => :ConvertSurfaceFormat,
         
     | 
| 
      
 123 
     | 
    
         
            +
                  :SDL_ConvertPixels => :ConvertPixels,
         
     | 
| 
      
 124 
     | 
    
         
            +
                  :SDL_PremultiplyAlpha => :PremultiplyAlpha,
         
     | 
| 
      
 125 
     | 
    
         
            +
                  :SDL_FillRect => :FillRect,
         
     | 
| 
      
 126 
     | 
    
         
            +
                  :SDL_FillRects => :FillRects,
         
     | 
| 
      
 127 
     | 
    
         
            +
                  :SDL_UpperBlit => :UpperBlit,
         
     | 
| 
      
 128 
     | 
    
         
            +
                  :SDL_LowerBlit => :LowerBlit,
         
     | 
| 
      
 129 
     | 
    
         
            +
                  :SDL_SoftStretch => :SoftStretch,
         
     | 
| 
      
 130 
     | 
    
         
            +
                  :SDL_SoftStretchLinear => :SoftStretchLinear,
         
     | 
| 
      
 131 
     | 
    
         
            +
                  :SDL_UpperBlitScaled => :UpperBlitScaled,
         
     | 
| 
      
 132 
     | 
    
         
            +
                  :SDL_LowerBlitScaled => :LowerBlitScaled,
         
     | 
| 
      
 133 
     | 
    
         
            +
                  :SDL_SetYUVConversionMode => :SetYUVConversionMode,
         
     | 
| 
      
 134 
     | 
    
         
            +
                  :SDL_GetYUVConversionMode => :GetYUVConversionMode,
         
     | 
| 
      
 135 
     | 
    
         
            +
                  :SDL_GetYUVConversionModeForResolution => :GetYUVConversionModeForResolution,
         
     | 
| 
      
 136 
     | 
    
         
            +
                }
         
     | 
| 
      
 137 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 138 
     | 
    
         
            +
                  :SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
         
     | 
| 
      
 139 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
         
     | 
| 
      
 140 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
         
     | 
| 
      
 141 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
         
     | 
| 
      
 142 
     | 
    
         
            +
                  :SDL_FreeSurface => [:pointer],
         
     | 
| 
      
 143 
     | 
    
         
            +
                  :SDL_SetSurfacePalette => [:pointer, :pointer],
         
     | 
| 
      
 144 
     | 
    
         
            +
                  :SDL_LockSurface => [:pointer],
         
     | 
| 
      
 145 
     | 
    
         
            +
                  :SDL_UnlockSurface => [:pointer],
         
     | 
| 
      
 146 
     | 
    
         
            +
                  :SDL_LoadBMP_RW => [:pointer, :int],
         
     | 
| 
      
 147 
     | 
    
         
            +
                  :SDL_SaveBMP_RW => [:pointer, :pointer, :int],
         
     | 
| 
      
 148 
     | 
    
         
            +
                  :SDL_SetSurfaceRLE => [:pointer, :int],
         
     | 
| 
      
 149 
     | 
    
         
            +
                  :SDL_HasSurfaceRLE => [:pointer],
         
     | 
| 
      
 150 
     | 
    
         
            +
                  :SDL_SetColorKey => [:pointer, :int, :uint],
         
     | 
| 
      
 151 
     | 
    
         
            +
                  :SDL_HasColorKey => [:pointer],
         
     | 
| 
      
 152 
     | 
    
         
            +
                  :SDL_GetColorKey => [:pointer, :pointer],
         
     | 
| 
      
 153 
     | 
    
         
            +
                  :SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
         
     | 
| 
      
 154 
     | 
    
         
            +
                  :SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 155 
     | 
    
         
            +
                  :SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
         
     | 
| 
      
 156 
     | 
    
         
            +
                  :SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
         
     | 
| 
      
 157 
     | 
    
         
            +
                  :SDL_SetSurfaceBlendMode => [:pointer, :int],
         
     | 
| 
      
 158 
     | 
    
         
            +
                  :SDL_GetSurfaceBlendMode => [:pointer, :pointer],
         
     | 
| 
      
 159 
     | 
    
         
            +
                  :SDL_SetClipRect => [:pointer, :pointer],
         
     | 
| 
      
 160 
     | 
    
         
            +
                  :SDL_GetClipRect => [:pointer, :pointer],
         
     | 
| 
      
 161 
     | 
    
         
            +
                  :SDL_DuplicateSurface => [:pointer],
         
     | 
| 
      
 162 
     | 
    
         
            +
                  :SDL_ConvertSurface => [:pointer, :pointer, :uint],
         
     | 
| 
      
 163 
     | 
    
         
            +
                  :SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
         
     | 
| 
      
 164 
     | 
    
         
            +
                  :SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
         
     | 
| 
      
 165 
     | 
    
         
            +
                  :SDL_PremultiplyAlpha => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
         
     | 
| 
      
 166 
     | 
    
         
            +
                  :SDL_FillRect => [:pointer, :pointer, :uint],
         
     | 
| 
      
 167 
     | 
    
         
            +
                  :SDL_FillRects => [:pointer, :pointer, :int, :uint],
         
     | 
| 
      
 168 
     | 
    
         
            +
                  :SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 169 
     | 
    
         
            +
                  :SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 170 
     | 
    
         
            +
                  :SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 171 
     | 
    
         
            +
                  :SDL_SoftStretchLinear => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 172 
     | 
    
         
            +
                  :SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 173 
     | 
    
         
            +
                  :SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
         
     | 
| 
      
 174 
     | 
    
         
            +
                  :SDL_SetYUVConversionMode => [:int],
         
     | 
| 
      
 175 
     | 
    
         
            +
                  :SDL_GetYUVConversionMode => [],
         
     | 
| 
      
 176 
     | 
    
         
            +
                  :SDL_GetYUVConversionModeForResolution => [:int, :int],
         
     | 
| 
      
 177 
     | 
    
         
            +
                }
         
     | 
| 
      
 178 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 179 
     | 
    
         
            +
                  :SDL_CreateRGBSurface => :pointer,
         
     | 
| 
      
 180 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormat => :pointer,
         
     | 
| 
      
 181 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceFrom => :pointer,
         
     | 
| 
      
 182 
     | 
    
         
            +
                  :SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
         
     | 
| 
      
 183 
     | 
    
         
            +
                  :SDL_FreeSurface => :void,
         
     | 
| 
      
 184 
     | 
    
         
            +
                  :SDL_SetSurfacePalette => :int,
         
     | 
| 
      
 185 
     | 
    
         
            +
                  :SDL_LockSurface => :int,
         
     | 
| 
      
 186 
     | 
    
         
            +
                  :SDL_UnlockSurface => :void,
         
     | 
| 
      
 187 
     | 
    
         
            +
                  :SDL_LoadBMP_RW => :pointer,
         
     | 
| 
      
 188 
     | 
    
         
            +
                  :SDL_SaveBMP_RW => :int,
         
     | 
| 
      
 189 
     | 
    
         
            +
                  :SDL_SetSurfaceRLE => :int,
         
     | 
| 
      
 190 
     | 
    
         
            +
                  :SDL_HasSurfaceRLE => :int,
         
     | 
| 
      
 191 
     | 
    
         
            +
                  :SDL_SetColorKey => :int,
         
     | 
| 
      
 192 
     | 
    
         
            +
                  :SDL_HasColorKey => :int,
         
     | 
| 
      
 193 
     | 
    
         
            +
                  :SDL_GetColorKey => :int,
         
     | 
| 
      
 194 
     | 
    
         
            +
                  :SDL_SetSurfaceColorMod => :int,
         
     | 
| 
      
 195 
     | 
    
         
            +
                  :SDL_GetSurfaceColorMod => :int,
         
     | 
| 
      
 196 
     | 
    
         
            +
                  :SDL_SetSurfaceAlphaMod => :int,
         
     | 
| 
      
 197 
     | 
    
         
            +
                  :SDL_GetSurfaceAlphaMod => :int,
         
     | 
| 
      
 198 
     | 
    
         
            +
                  :SDL_SetSurfaceBlendMode => :int,
         
     | 
| 
      
 199 
     | 
    
         
            +
                  :SDL_GetSurfaceBlendMode => :int,
         
     | 
| 
      
 200 
     | 
    
         
            +
                  :SDL_SetClipRect => :int,
         
     | 
| 
      
 201 
     | 
    
         
            +
                  :SDL_GetClipRect => :void,
         
     | 
| 
      
 202 
     | 
    
         
            +
                  :SDL_DuplicateSurface => :pointer,
         
     | 
| 
      
 203 
     | 
    
         
            +
                  :SDL_ConvertSurface => :pointer,
         
     | 
| 
      
 204 
     | 
    
         
            +
                  :SDL_ConvertSurfaceFormat => :pointer,
         
     | 
| 
      
 205 
     | 
    
         
            +
                  :SDL_ConvertPixels => :int,
         
     | 
| 
      
 206 
     | 
    
         
            +
                  :SDL_PremultiplyAlpha => :int,
         
     | 
| 
      
 207 
     | 
    
         
            +
                  :SDL_FillRect => :int,
         
     | 
| 
      
 208 
     | 
    
         
            +
                  :SDL_FillRects => :int,
         
     | 
| 
      
 209 
     | 
    
         
            +
                  :SDL_UpperBlit => :int,
         
     | 
| 
      
 210 
     | 
    
         
            +
                  :SDL_LowerBlit => :int,
         
     | 
| 
      
 211 
     | 
    
         
            +
                  :SDL_SoftStretch => :int,
         
     | 
| 
      
 212 
     | 
    
         
            +
                  :SDL_SoftStretchLinear => :int,
         
     | 
| 
      
 213 
     | 
    
         
            +
                  :SDL_UpperBlitScaled => :int,
         
     | 
| 
      
 214 
     | 
    
         
            +
                  :SDL_LowerBlitScaled => :int,
         
     | 
| 
      
 215 
     | 
    
         
            +
                  :SDL_SetYUVConversionMode => :void,
         
     | 
| 
      
 216 
     | 
    
         
            +
                  :SDL_GetYUVConversionMode => :int,
         
     | 
| 
      
 217 
     | 
    
         
            +
                  :SDL_GetYUVConversionModeForResolution => :int,
         
     | 
| 
      
 218 
     | 
    
         
            +
                }
         
     | 
| 
      
 219 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 220 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 221 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 222 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 223 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 224 
     | 
    
         
            +
                  end
         
     | 
| 
      
 225 
     | 
    
         
            +
                end
         
     | 
| 
      
 226 
     | 
    
         
            +
              end
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
            end
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     |