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_log.rb
    CHANGED
    
    | 
         @@ -1,115 +1,131 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
               
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
               
     | 
| 
       29 
     | 
    
         
            -
               
     | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
               
     | 
| 
       33 
     | 
    
         
            -
               
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
       35 
     | 
    
         
            -
               
     | 
| 
       36 
     | 
    
         
            -
               
     | 
| 
       37 
     | 
    
         
            -
               
     | 
| 
       38 
     | 
    
         
            -
               
     | 
| 
       39 
     | 
    
         
            -
               
     | 
| 
       40 
     | 
    
         
            -
               
     | 
| 
       41 
     | 
    
         
            -
               
     | 
| 
       42 
     | 
    
         
            -
               
     | 
| 
       43 
     | 
    
         
            -
               
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
              typedef :int, :SDL_LogCategory
         
     | 
| 
       48 
     | 
    
         
            -
              typedef :int, :SDL_LogPriority
         
     | 
| 
       49 
     | 
    
         
            -
              callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
              # Struct
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
              # Function
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
              def self.setup_log_symbols()
         
     | 
| 
       57 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       58 
     | 
    
         
            -
                  :SDL_LogSetAllPriority,
         
     | 
| 
       59 
     | 
    
         
            -
                  :SDL_LogSetPriority,
         
     | 
| 
       60 
     | 
    
         
            -
                  :SDL_LogGetPriority,
         
     | 
| 
       61 
     | 
    
         
            -
                  :SDL_LogResetPriorities,
         
     | 
| 
       62 
     | 
    
         
            -
                  :SDL_Log,
         
     | 
| 
       63 
     | 
    
         
            -
                  :SDL_LogVerbose,
         
     | 
| 
       64 
     | 
    
         
            -
                  :SDL_LogDebug,
         
     | 
| 
       65 
     | 
    
         
            -
                  :SDL_LogInfo,
         
     | 
| 
       66 
     | 
    
         
            -
                  :SDL_LogWarn,
         
     | 
| 
       67 
     | 
    
         
            -
                  :SDL_LogError,
         
     | 
| 
       68 
     | 
    
         
            -
                  :SDL_LogCritical,
         
     | 
| 
       69 
     | 
    
         
            -
                  :SDL_LogMessage,
         
     | 
| 
       70 
     | 
    
         
            -
                  :SDL_LogGetOutputFunction,
         
     | 
| 
       71 
     | 
    
         
            -
                  :SDL_LogSetOutputFunction,
         
     | 
| 
       72 
     | 
    
         
            -
                ]
         
     | 
| 
       73 
     | 
    
         
            -
                 
     | 
| 
       74 
     | 
    
         
            -
                  :SDL_LogSetAllPriority =>  
     | 
| 
       75 
     | 
    
         
            -
                  :SDL_LogSetPriority =>  
     | 
| 
       76 
     | 
    
         
            -
                  :SDL_LogGetPriority =>  
     | 
| 
       77 
     | 
    
         
            -
                  :SDL_LogResetPriorities =>  
     | 
| 
       78 
     | 
    
         
            -
                  :SDL_Log =>  
     | 
| 
       79 
     | 
    
         
            -
                  :SDL_LogVerbose =>  
     | 
| 
       80 
     | 
    
         
            -
                  :SDL_LogDebug =>  
     | 
| 
       81 
     | 
    
         
            -
                  :SDL_LogInfo =>  
     | 
| 
       82 
     | 
    
         
            -
                  :SDL_LogWarn =>  
     | 
| 
       83 
     | 
    
         
            -
                  :SDL_LogError =>  
     | 
| 
       84 
     | 
    
         
            -
                  :SDL_LogCritical =>  
     | 
| 
       85 
     | 
    
         
            -
                  :SDL_LogMessage =>  
     | 
| 
       86 
     | 
    
         
            -
                  :SDL_LogGetOutputFunction =>  
     | 
| 
       87 
     | 
    
         
            -
                  :SDL_LogSetOutputFunction =>  
     | 
| 
       88 
     | 
    
         
            -
                }
         
     | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
       90 
     | 
    
         
            -
                  :SDL_LogSetAllPriority => : 
     | 
| 
       91 
     | 
    
         
            -
                  :SDL_LogSetPriority => : 
     | 
| 
       92 
     | 
    
         
            -
                  :SDL_LogGetPriority => :int,
         
     | 
| 
       93 
     | 
    
         
            -
                  :SDL_LogResetPriorities =>  
     | 
| 
       94 
     | 
    
         
            -
                  :SDL_Log => : 
     | 
| 
       95 
     | 
    
         
            -
                  :SDL_LogVerbose => : 
     | 
| 
       96 
     | 
    
         
            -
                  :SDL_LogDebug => : 
     | 
| 
       97 
     | 
    
         
            -
                  :SDL_LogInfo => : 
     | 
| 
       98 
     | 
    
         
            -
                  :SDL_LogWarn => : 
     | 
| 
       99 
     | 
    
         
            -
                  :SDL_LogError => : 
     | 
| 
       100 
     | 
    
         
            -
                  :SDL_LogCritical => : 
     | 
| 
       101 
     | 
    
         
            -
                  :SDL_LogMessage => : 
     | 
| 
       102 
     | 
    
         
            -
                  :SDL_LogGetOutputFunction => : 
     | 
| 
       103 
     | 
    
         
            -
                  :SDL_LogSetOutputFunction => : 
     | 
| 
       104 
     | 
    
         
            -
                }
         
     | 
| 
       105 
     | 
    
         
            -
                 
     | 
| 
       106 
     | 
    
         
            -
                   
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                   
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
                   
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            +
              MAX_LOG_MESSAGE = 4096
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              LOG_CATEGORY_APPLICATION = 0
         
     | 
| 
      
 18 
     | 
    
         
            +
              LOG_CATEGORY_ERROR = 1
         
     | 
| 
      
 19 
     | 
    
         
            +
              LOG_CATEGORY_ASSERT = 2
         
     | 
| 
      
 20 
     | 
    
         
            +
              LOG_CATEGORY_SYSTEM = 3
         
     | 
| 
      
 21 
     | 
    
         
            +
              LOG_CATEGORY_AUDIO = 4
         
     | 
| 
      
 22 
     | 
    
         
            +
              LOG_CATEGORY_VIDEO = 5
         
     | 
| 
      
 23 
     | 
    
         
            +
              LOG_CATEGORY_RENDER = 6
         
     | 
| 
      
 24 
     | 
    
         
            +
              LOG_CATEGORY_INPUT = 7
         
     | 
| 
      
 25 
     | 
    
         
            +
              LOG_CATEGORY_TEST = 8
         
     | 
| 
      
 26 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED1 = 9
         
     | 
| 
      
 27 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED2 = 10
         
     | 
| 
      
 28 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED3 = 11
         
     | 
| 
      
 29 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED4 = 12
         
     | 
| 
      
 30 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED5 = 13
         
     | 
| 
      
 31 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED6 = 14
         
     | 
| 
      
 32 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED7 = 15
         
     | 
| 
      
 33 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED8 = 16
         
     | 
| 
      
 34 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED9 = 17
         
     | 
| 
      
 35 
     | 
    
         
            +
              LOG_CATEGORY_RESERVED10 = 18
         
     | 
| 
      
 36 
     | 
    
         
            +
              LOG_CATEGORY_CUSTOM = 19
         
     | 
| 
      
 37 
     | 
    
         
            +
              LOG_PRIORITY_VERBOSE = 1
         
     | 
| 
      
 38 
     | 
    
         
            +
              LOG_PRIORITY_DEBUG = 2
         
     | 
| 
      
 39 
     | 
    
         
            +
              LOG_PRIORITY_INFO = 3
         
     | 
| 
      
 40 
     | 
    
         
            +
              LOG_PRIORITY_WARN = 4
         
     | 
| 
      
 41 
     | 
    
         
            +
              LOG_PRIORITY_ERROR = 5
         
     | 
| 
      
 42 
     | 
    
         
            +
              LOG_PRIORITY_CRITICAL = 6
         
     | 
| 
      
 43 
     | 
    
         
            +
              NUM_LOG_PRIORITIES = 7
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              typedef :int, :SDL_LogCategory
         
     | 
| 
      
 48 
     | 
    
         
            +
              typedef :int, :SDL_LogPriority
         
     | 
| 
      
 49 
     | 
    
         
            +
              callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              def self.setup_log_symbols(output_error = false)
         
     | 
| 
      
 57 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 58 
     | 
    
         
            +
                  :SDL_LogSetAllPriority,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  :SDL_LogSetPriority,
         
     | 
| 
      
 60 
     | 
    
         
            +
                  :SDL_LogGetPriority,
         
     | 
| 
      
 61 
     | 
    
         
            +
                  :SDL_LogResetPriorities,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :SDL_Log,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  :SDL_LogVerbose,
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :SDL_LogDebug,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  :SDL_LogInfo,
         
     | 
| 
      
 66 
     | 
    
         
            +
                  :SDL_LogWarn,
         
     | 
| 
      
 67 
     | 
    
         
            +
                  :SDL_LogError,
         
     | 
| 
      
 68 
     | 
    
         
            +
                  :SDL_LogCritical,
         
     | 
| 
      
 69 
     | 
    
         
            +
                  :SDL_LogMessage,
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :SDL_LogGetOutputFunction,
         
     | 
| 
      
 71 
     | 
    
         
            +
                  :SDL_LogSetOutputFunction,
         
     | 
| 
      
 72 
     | 
    
         
            +
                ]
         
     | 
| 
      
 73 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 74 
     | 
    
         
            +
                  :SDL_LogSetAllPriority => :LogSetAllPriority,
         
     | 
| 
      
 75 
     | 
    
         
            +
                  :SDL_LogSetPriority => :LogSetPriority,
         
     | 
| 
      
 76 
     | 
    
         
            +
                  :SDL_LogGetPriority => :LogGetPriority,
         
     | 
| 
      
 77 
     | 
    
         
            +
                  :SDL_LogResetPriorities => :LogResetPriorities,
         
     | 
| 
      
 78 
     | 
    
         
            +
                  :SDL_Log => :Log,
         
     | 
| 
      
 79 
     | 
    
         
            +
                  :SDL_LogVerbose => :LogVerbose,
         
     | 
| 
      
 80 
     | 
    
         
            +
                  :SDL_LogDebug => :LogDebug,
         
     | 
| 
      
 81 
     | 
    
         
            +
                  :SDL_LogInfo => :LogInfo,
         
     | 
| 
      
 82 
     | 
    
         
            +
                  :SDL_LogWarn => :LogWarn,
         
     | 
| 
      
 83 
     | 
    
         
            +
                  :SDL_LogError => :LogError,
         
     | 
| 
      
 84 
     | 
    
         
            +
                  :SDL_LogCritical => :LogCritical,
         
     | 
| 
      
 85 
     | 
    
         
            +
                  :SDL_LogMessage => :LogMessage,
         
     | 
| 
      
 86 
     | 
    
         
            +
                  :SDL_LogGetOutputFunction => :LogGetOutputFunction,
         
     | 
| 
      
 87 
     | 
    
         
            +
                  :SDL_LogSetOutputFunction => :LogSetOutputFunction,
         
     | 
| 
      
 88 
     | 
    
         
            +
                }
         
     | 
| 
      
 89 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 90 
     | 
    
         
            +
                  :SDL_LogSetAllPriority => [:int],
         
     | 
| 
      
 91 
     | 
    
         
            +
                  :SDL_LogSetPriority => [:int, :int],
         
     | 
| 
      
 92 
     | 
    
         
            +
                  :SDL_LogGetPriority => [:int],
         
     | 
| 
      
 93 
     | 
    
         
            +
                  :SDL_LogResetPriorities => [],
         
     | 
| 
      
 94 
     | 
    
         
            +
                  :SDL_Log => [:pointer],
         
     | 
| 
      
 95 
     | 
    
         
            +
                  :SDL_LogVerbose => [:int, :pointer],
         
     | 
| 
      
 96 
     | 
    
         
            +
                  :SDL_LogDebug => [:int, :pointer],
         
     | 
| 
      
 97 
     | 
    
         
            +
                  :SDL_LogInfo => [:int, :pointer],
         
     | 
| 
      
 98 
     | 
    
         
            +
                  :SDL_LogWarn => [:int, :pointer],
         
     | 
| 
      
 99 
     | 
    
         
            +
                  :SDL_LogError => [:int, :pointer],
         
     | 
| 
      
 100 
     | 
    
         
            +
                  :SDL_LogCritical => [:int, :pointer],
         
     | 
| 
      
 101 
     | 
    
         
            +
                  :SDL_LogMessage => [:int, :int, :pointer],
         
     | 
| 
      
 102 
     | 
    
         
            +
                  :SDL_LogGetOutputFunction => [:pointer, :pointer],
         
     | 
| 
      
 103 
     | 
    
         
            +
                  :SDL_LogSetOutputFunction => [:SDL_LogOutputFunction, :pointer],
         
     | 
| 
      
 104 
     | 
    
         
            +
                }
         
     | 
| 
      
 105 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 106 
     | 
    
         
            +
                  :SDL_LogSetAllPriority => :void,
         
     | 
| 
      
 107 
     | 
    
         
            +
                  :SDL_LogSetPriority => :void,
         
     | 
| 
      
 108 
     | 
    
         
            +
                  :SDL_LogGetPriority => :int,
         
     | 
| 
      
 109 
     | 
    
         
            +
                  :SDL_LogResetPriorities => :void,
         
     | 
| 
      
 110 
     | 
    
         
            +
                  :SDL_Log => :void,
         
     | 
| 
      
 111 
     | 
    
         
            +
                  :SDL_LogVerbose => :void,
         
     | 
| 
      
 112 
     | 
    
         
            +
                  :SDL_LogDebug => :void,
         
     | 
| 
      
 113 
     | 
    
         
            +
                  :SDL_LogInfo => :void,
         
     | 
| 
      
 114 
     | 
    
         
            +
                  :SDL_LogWarn => :void,
         
     | 
| 
      
 115 
     | 
    
         
            +
                  :SDL_LogError => :void,
         
     | 
| 
      
 116 
     | 
    
         
            +
                  :SDL_LogCritical => :void,
         
     | 
| 
      
 117 
     | 
    
         
            +
                  :SDL_LogMessage => :void,
         
     | 
| 
      
 118 
     | 
    
         
            +
                  :SDL_LogGetOutputFunction => :void,
         
     | 
| 
      
 119 
     | 
    
         
            +
                  :SDL_LogSetOutputFunction => :void,
         
     | 
| 
      
 120 
     | 
    
         
            +
                }
         
     | 
| 
      
 121 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 122 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 123 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 124 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 125 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 126 
     | 
    
         
            +
                  end
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
              end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
    
        data/lib/sdl2_main.rb
    CHANGED
    
    | 
         @@ -1,67 +1,74 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
               
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              # Enum
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              # Struct
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              # Function
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
              def self.setup_main_symbols()
         
     | 
| 
       36 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       37 
     | 
    
         
            -
                  :SDL_Init,
         
     | 
| 
       38 
     | 
    
         
            -
                  :SDL_InitSubSystem,
         
     | 
| 
       39 
     | 
    
         
            -
                  :SDL_QuitSubSystem,
         
     | 
| 
       40 
     | 
    
         
            -
                  :SDL_WasInit,
         
     | 
| 
       41 
     | 
    
         
            -
                  :SDL_Quit,
         
     | 
| 
       42 
     | 
    
         
            -
                ]
         
     | 
| 
       43 
     | 
    
         
            -
                 
     | 
| 
       44 
     | 
    
         
            -
                  :SDL_Init =>  
     | 
| 
       45 
     | 
    
         
            -
                  :SDL_InitSubSystem =>  
     | 
| 
       46 
     | 
    
         
            -
                  :SDL_QuitSubSystem =>  
     | 
| 
       47 
     | 
    
         
            -
                  :SDL_WasInit =>  
     | 
| 
       48 
     | 
    
         
            -
                  :SDL_Quit =>  
     | 
| 
       49 
     | 
    
         
            -
                }
         
     | 
| 
       50 
     | 
    
         
            -
                 
     | 
| 
       51 
     | 
    
         
            -
                  :SDL_Init => : 
     | 
| 
       52 
     | 
    
         
            -
                  :SDL_InitSubSystem => : 
     | 
| 
       53 
     | 
    
         
            -
                  :SDL_QuitSubSystem => : 
     | 
| 
       54 
     | 
    
         
            -
                  :SDL_WasInit => :uint,
         
     | 
| 
       55 
     | 
    
         
            -
                  :SDL_Quit =>  
     | 
| 
       56 
     | 
    
         
            -
                }
         
     | 
| 
       57 
     | 
    
         
            -
                 
     | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                   
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                   
     | 
| 
       63 
     | 
    
         
            -
                 
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            +
              INIT_TIMER = 0x00000001
         
     | 
| 
      
 14 
     | 
    
         
            +
              INIT_AUDIO = 0x00000010
         
     | 
| 
      
 15 
     | 
    
         
            +
              INIT_VIDEO = 0x00000020
         
     | 
| 
      
 16 
     | 
    
         
            +
              INIT_JOYSTICK = 0x00000200
         
     | 
| 
      
 17 
     | 
    
         
            +
              INIT_HAPTIC = 0x00001000
         
     | 
| 
      
 18 
     | 
    
         
            +
              INIT_GAMECONTROLLER = 0x00002000
         
     | 
| 
      
 19 
     | 
    
         
            +
              INIT_EVENTS = 0x00004000
         
     | 
| 
      
 20 
     | 
    
         
            +
              INIT_SENSOR = 0x00008000
         
     | 
| 
      
 21 
     | 
    
         
            +
              INIT_NOPARACHUTE = 0x00100000
         
     | 
| 
      
 22 
     | 
    
         
            +
              INIT_EVERYTHING = ( INIT_TIMER | INIT_AUDIO | INIT_VIDEO | INIT_EVENTS | INIT_JOYSTICK | INIT_HAPTIC | INIT_GAMECONTROLLER | INIT_SENSOR )
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              # Enum
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              def self.setup_main_symbols(output_error = false)
         
     | 
| 
      
 36 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 37 
     | 
    
         
            +
                  :SDL_Init,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :SDL_InitSubSystem,
         
     | 
| 
      
 39 
     | 
    
         
            +
                  :SDL_QuitSubSystem,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  :SDL_WasInit,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  :SDL_Quit,
         
     | 
| 
      
 42 
     | 
    
         
            +
                ]
         
     | 
| 
      
 43 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 44 
     | 
    
         
            +
                  :SDL_Init => :Init,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  :SDL_InitSubSystem => :InitSubSystem,
         
     | 
| 
      
 46 
     | 
    
         
            +
                  :SDL_QuitSubSystem => :QuitSubSystem,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  :SDL_WasInit => :WasInit,
         
     | 
| 
      
 48 
     | 
    
         
            +
                  :SDL_Quit => :Quit,
         
     | 
| 
      
 49 
     | 
    
         
            +
                }
         
     | 
| 
      
 50 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 51 
     | 
    
         
            +
                  :SDL_Init => [:uint],
         
     | 
| 
      
 52 
     | 
    
         
            +
                  :SDL_InitSubSystem => [:uint],
         
     | 
| 
      
 53 
     | 
    
         
            +
                  :SDL_QuitSubSystem => [:uint],
         
     | 
| 
      
 54 
     | 
    
         
            +
                  :SDL_WasInit => [:uint],
         
     | 
| 
      
 55 
     | 
    
         
            +
                  :SDL_Quit => [],
         
     | 
| 
      
 56 
     | 
    
         
            +
                }
         
     | 
| 
      
 57 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 58 
     | 
    
         
            +
                  :SDL_Init => :int,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  :SDL_InitSubSystem => :int,
         
     | 
| 
      
 60 
     | 
    
         
            +
                  :SDL_QuitSubSystem => :void,
         
     | 
| 
      
 61 
     | 
    
         
            +
                  :SDL_WasInit => :uint,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :SDL_Quit => :void,
         
     | 
| 
      
 63 
     | 
    
         
            +
                }
         
     | 
| 
      
 64 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 65 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 66 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 67 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 68 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
    
        data/lib/sdl2_messagebox.rb
    CHANGED
    
    | 
         @@ -1,98 +1,102 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
               
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
               
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              # Typedef
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              typedef :int, :SDL_MessageBoxFlags
         
     | 
| 
       33 
     | 
    
         
            -
              typedef :int, :SDL_MessageBoxButtonFlags
         
     | 
| 
       34 
     | 
    
         
            -
              typedef :int, :SDL_MessageBoxColorType
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              # Struct
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              class  
     | 
| 
       39 
     | 
    
         
            -
                layout(
         
     | 
| 
       40 
     | 
    
         
            -
                  :flags, :uint,
         
     | 
| 
       41 
     | 
    
         
            -
                  :buttonid, :int,
         
     | 
| 
       42 
     | 
    
         
            -
                  :text, :pointer,
         
     | 
| 
       43 
     | 
    
         
            -
                )
         
     | 
| 
       44 
     | 
    
         
            -
              end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
              class  
     | 
| 
       47 
     | 
    
         
            -
                layout(
         
     | 
| 
       48 
     | 
    
         
            -
                  :r, :uchar,
         
     | 
| 
       49 
     | 
    
         
            -
                  :g, :uchar,
         
     | 
| 
       50 
     | 
    
         
            -
                  :b, :uchar,
         
     | 
| 
       51 
     | 
    
         
            -
                )
         
     | 
| 
       52 
     | 
    
         
            -
              end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
              class  
     | 
| 
       55 
     | 
    
         
            -
                layout(
         
     | 
| 
       56 
     | 
    
         
            -
                  :colors, [ 
     | 
| 
       57 
     | 
    
         
            -
                )
         
     | 
| 
       58 
     | 
    
         
            -
              end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
              class  
     | 
| 
       61 
     | 
    
         
            -
                layout(
         
     | 
| 
       62 
     | 
    
         
            -
                  :flags, :uint,
         
     | 
| 
       63 
     | 
    
         
            -
                  :window, :pointer,
         
     | 
| 
       64 
     | 
    
         
            -
                  :title, :pointer,
         
     | 
| 
       65 
     | 
    
         
            -
                  :message, :pointer,
         
     | 
| 
       66 
     | 
    
         
            -
                  :numbuttons, :int,
         
     | 
| 
       67 
     | 
    
         
            -
                  :buttons, :pointer,
         
     | 
| 
       68 
     | 
    
         
            -
                  :colorScheme, :pointer,
         
     | 
| 
       69 
     | 
    
         
            -
                )
         
     | 
| 
       70 
     | 
    
         
            -
              end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
              # Function
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
              def self.setup_messagebox_symbols()
         
     | 
| 
       76 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       77 
     | 
    
         
            -
                  :SDL_ShowMessageBox,
         
     | 
| 
       78 
     | 
    
         
            -
                  :SDL_ShowSimpleMessageBox,
         
     | 
| 
       79 
     | 
    
         
            -
                ]
         
     | 
| 
       80 
     | 
    
         
            -
                 
     | 
| 
       81 
     | 
    
         
            -
                  :SDL_ShowMessageBox =>  
     | 
| 
       82 
     | 
    
         
            -
                  :SDL_ShowSimpleMessageBox =>  
     | 
| 
       83 
     | 
    
         
            -
                }
         
     | 
| 
       84 
     | 
    
         
            -
                 
     | 
| 
       85 
     | 
    
         
            -
                  :SDL_ShowMessageBox => : 
     | 
| 
       86 
     | 
    
         
            -
                  :SDL_ShowSimpleMessageBox => : 
     | 
| 
       87 
     | 
    
         
            -
                }
         
     | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
       89 
     | 
    
         
            -
                   
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
                   
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
            end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            +
              MESSAGEBOX_ERROR = 16
         
     | 
| 
      
 17 
     | 
    
         
            +
              MESSAGEBOX_WARNING = 32
         
     | 
| 
      
 18 
     | 
    
         
            +
              MESSAGEBOX_INFORMATION = 64
         
     | 
| 
      
 19 
     | 
    
         
            +
              MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 128
         
     | 
| 
      
 20 
     | 
    
         
            +
              MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 256
         
     | 
| 
      
 21 
     | 
    
         
            +
              MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 1
         
     | 
| 
      
 22 
     | 
    
         
            +
              MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 2
         
     | 
| 
      
 23 
     | 
    
         
            +
              MESSAGEBOX_COLOR_BACKGROUND = 0
         
     | 
| 
      
 24 
     | 
    
         
            +
              MESSAGEBOX_COLOR_TEXT = 1
         
     | 
| 
      
 25 
     | 
    
         
            +
              MESSAGEBOX_COLOR_BUTTON_BORDER = 2
         
     | 
| 
      
 26 
     | 
    
         
            +
              MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
         
     | 
| 
      
 27 
     | 
    
         
            +
              MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
         
     | 
| 
      
 28 
     | 
    
         
            +
              MESSAGEBOX_COLOR_MAX = 5
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              # Typedef
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              typedef :int, :SDL_MessageBoxFlags
         
     | 
| 
      
 33 
     | 
    
         
            +
              typedef :int, :SDL_MessageBoxButtonFlags
         
     | 
| 
      
 34 
     | 
    
         
            +
              typedef :int, :SDL_MessageBoxColorType
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              # Struct
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              class MessageBoxButtonData < FFI::Struct
         
     | 
| 
      
 39 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 40 
     | 
    
         
            +
                  :flags, :uint,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  :buttonid, :int,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  :text, :pointer,
         
     | 
| 
      
 43 
     | 
    
         
            +
                )
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              class MessageBoxColor < FFI::Struct
         
     | 
| 
      
 47 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 48 
     | 
    
         
            +
                  :r, :uchar,
         
     | 
| 
      
 49 
     | 
    
         
            +
                  :g, :uchar,
         
     | 
| 
      
 50 
     | 
    
         
            +
                  :b, :uchar,
         
     | 
| 
      
 51 
     | 
    
         
            +
                )
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              class MessageBoxColorScheme < FFI::Struct
         
     | 
| 
      
 55 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 56 
     | 
    
         
            +
                  :colors, [MessageBoxColor, 5],
         
     | 
| 
      
 57 
     | 
    
         
            +
                )
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              class MessageBoxData < FFI::Struct
         
     | 
| 
      
 61 
     | 
    
         
            +
                layout(
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :flags, :uint,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  :window, :pointer,
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :title, :pointer,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  :message, :pointer,
         
     | 
| 
      
 66 
     | 
    
         
            +
                  :numbuttons, :int,
         
     | 
| 
      
 67 
     | 
    
         
            +
                  :buttons, :pointer,
         
     | 
| 
      
 68 
     | 
    
         
            +
                  :colorScheme, :pointer,
         
     | 
| 
      
 69 
     | 
    
         
            +
                )
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              # Function
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
              def self.setup_messagebox_symbols(output_error = false)
         
     | 
| 
      
 76 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 77 
     | 
    
         
            +
                  :SDL_ShowMessageBox,
         
     | 
| 
      
 78 
     | 
    
         
            +
                  :SDL_ShowSimpleMessageBox,
         
     | 
| 
      
 79 
     | 
    
         
            +
                ]
         
     | 
| 
      
 80 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 81 
     | 
    
         
            +
                  :SDL_ShowMessageBox => :ShowMessageBox,
         
     | 
| 
      
 82 
     | 
    
         
            +
                  :SDL_ShowSimpleMessageBox => :ShowSimpleMessageBox,
         
     | 
| 
      
 83 
     | 
    
         
            +
                }
         
     | 
| 
      
 84 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 85 
     | 
    
         
            +
                  :SDL_ShowMessageBox => [:pointer, :pointer],
         
     | 
| 
      
 86 
     | 
    
         
            +
                  :SDL_ShowSimpleMessageBox => [:uint, :pointer, :pointer, :pointer],
         
     | 
| 
      
 87 
     | 
    
         
            +
                }
         
     | 
| 
      
 88 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 89 
     | 
    
         
            +
                  :SDL_ShowMessageBox => :int,
         
     | 
| 
      
 90 
     | 
    
         
            +
                  :SDL_ShowSimpleMessageBox => :int,
         
     | 
| 
      
 91 
     | 
    
         
            +
                }
         
     | 
| 
      
 92 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 93 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 94 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 95 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 96 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 97 
     | 
    
         
            +
                  end
         
     | 
| 
      
 98 
     | 
    
         
            +
                end
         
     | 
| 
      
 99 
     | 
    
         
            +
              end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
    
        data/lib/sdl2_misc.rb
    CHANGED
    
    | 
         @@ -1,45 +1,48 @@ 
     | 
|
| 
       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_misc_symbols()
         
     | 
| 
       26 
     | 
    
         
            -
                symbols = [
         
     | 
| 
       27 
     | 
    
         
            -
                  :SDL_OpenURL,
         
     | 
| 
       28 
     | 
    
         
            -
                ]
         
     | 
| 
       29 
     | 
    
         
            -
                 
     | 
| 
       30 
     | 
    
         
            -
                  :SDL_OpenURL =>  
     | 
| 
       31 
     | 
    
         
            -
                }
         
     | 
| 
       32 
     | 
    
         
            -
                 
     | 
| 
       33 
     | 
    
         
            -
                  :SDL_OpenURL => : 
     | 
| 
       34 
     | 
    
         
            -
                }
         
     | 
| 
       35 
     | 
    
         
            -
                 
     | 
| 
       36 
     | 
    
         
            -
                   
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
            end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 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_misc_symbols(output_error = false)
         
     | 
| 
      
 26 
     | 
    
         
            +
                symbols = [
         
     | 
| 
      
 27 
     | 
    
         
            +
                  :SDL_OpenURL,
         
     | 
| 
      
 28 
     | 
    
         
            +
                ]
         
     | 
| 
      
 29 
     | 
    
         
            +
                apis = {
         
     | 
| 
      
 30 
     | 
    
         
            +
                  :SDL_OpenURL => :OpenURL,
         
     | 
| 
      
 31 
     | 
    
         
            +
                }
         
     | 
| 
      
 32 
     | 
    
         
            +
                args = {
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :SDL_OpenURL => [:pointer],
         
     | 
| 
      
 34 
     | 
    
         
            +
                }
         
     | 
| 
      
 35 
     | 
    
         
            +
                retvals = {
         
     | 
| 
      
 36 
     | 
    
         
            +
                  :SDL_OpenURL => :int,
         
     | 
| 
      
 37 
     | 
    
         
            +
                }
         
     | 
| 
      
 38 
     | 
    
         
            +
                symbols.each do |sym|
         
     | 
| 
      
 39 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 40 
     | 
    
         
            +
                    attach_function apis[sym], sym, args[sym], retvals[sym]
         
     | 
| 
      
 41 
     | 
    
         
            +
                  rescue FFI::NotFoundError => error
         
     | 
| 
      
 42 
     | 
    
         
            +
                    $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     |