Method: SDL.setup_platform_symbols

Defined in:
lib/sdl2_platform.rb

.setup_platform_symbols(output_error = false) ⇒ Object

Function



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/sdl2_platform.rb', line 25

def self.setup_platform_symbols(output_error = false)
  symbols = [
    :SDL_GetPlatform,
  ]
  apis = {
    :SDL_GetPlatform => :GetPlatform,
  }
  args = {
    :SDL_GetPlatform => [],
  }
  retvals = {
    :SDL_GetPlatform => :pointer,
  }
  symbols.each do |sym|
    begin
      attach_function apis[sym], sym, args[sym], retvals[sym]
    rescue FFI::NotFoundError => error
      $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
    end
  end
end