raylib-bindings 0.7.8-x64-mingw → 0.7.10-x64-mingw

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.
data/lib/raylib.rb CHANGED
@@ -1,62 +1,62 @@
1
- # Yet another raylib wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/raylib-bindings
4
-
5
- require 'ffi'
6
- require 'fileutils'
7
- require_relative 'raylib_main'
8
- require_relative 'config'
9
- require_relative 'raymath'
10
- require_relative 'rcamera'
11
- require_relative 'rlgl'
12
- require_relative 'raygui_main'
13
- require_relative 'physac'
14
- require_relative 'raylib_helper'
15
- require_relative 'raygui_helper'
16
-
17
- module Raylib
18
- extend FFI::Library
19
-
20
- def self.load_lib(libpath, raygui_libpath: nil, physac_libpath: nil, method_naming: :original)
21
- lib_paths = [libpath, raygui_libpath, physac_libpath].compact
22
-
23
- ffi_lib_flags :now, :global
24
- ffi_lib(*lib_paths)
25
- setup_symbols(method_naming: method_naming)
26
-
27
- setup_raygui_symbols(method_naming: method_naming) unless raygui_libpath.nil?
28
- setup_physac_symbols(method_naming: method_naming) unless physac_libpath.nil?
29
- rescue LoadError => e
30
- warn e
31
- end
32
-
33
- def self.setup_symbols(method_naming: :original)
34
- setup_raylib_symbols(method_naming: method_naming)
35
- setup_raymath_symbols(method_naming: method_naming)
36
- setup_rcamera_symbols(method_naming: method_naming)
37
- setup_rlgl_symbols(method_naming: method_naming)
38
- end
39
-
40
- #
41
- # Generate sample code
42
- #
43
- def self.template
44
- # Copy template code to user's current directory
45
- example_path = "#{Gem::Specification.find_by_name('raylib-bindings').full_gem_path}/examples"
46
- template_code_src = "#{example_path}/template.rb"
47
- unless File.exist? template_code_src
48
- warn "[Error] Raylib.template : Template source #{template_code_src} not found"
49
- return false
50
- end
51
-
52
- template_code_dst = "#{Dir.getwd}/template.rb"
53
- if File.exist? template_code_dst
54
- warn "[Error] Raylib.template : Template destination #{template_code_dst} already exists"
55
- return false
56
- end
57
-
58
- warn "[Info] Raylib.template : #{template_code_src} => #{template_code_dst}"
59
- FileUtils.copy template_code_src, template_code_dst
60
- warn '[Info] Raylib.template : Done'
61
- end
62
- end
1
+ # Yet another raylib wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/raylib-bindings
4
+
5
+ require 'ffi'
6
+ require 'fileutils'
7
+ require_relative 'raylib_main'
8
+ require_relative 'config'
9
+ require_relative 'raymath'
10
+ require_relative 'rcamera'
11
+ require_relative 'rlgl'
12
+ require_relative 'raygui_main'
13
+ require_relative 'physac'
14
+ require_relative 'raylib_helper'
15
+ require_relative 'raygui_helper'
16
+
17
+ module Raylib
18
+ extend FFI::Library
19
+
20
+ def self.load_lib(libpath, raygui_libpath: nil, physac_libpath: nil, method_naming: :original)
21
+ lib_paths = [libpath, raygui_libpath, physac_libpath].compact
22
+
23
+ ffi_lib_flags :now, :global
24
+ ffi_lib(*lib_paths)
25
+ setup_symbols(method_naming: method_naming)
26
+
27
+ setup_raygui_symbols(method_naming: method_naming) unless raygui_libpath.nil?
28
+ setup_physac_symbols(method_naming: method_naming) unless physac_libpath.nil?
29
+ rescue LoadError => e
30
+ warn e
31
+ end
32
+
33
+ def self.setup_symbols(method_naming: :original)
34
+ setup_raylib_symbols(method_naming: method_naming)
35
+ setup_raymath_symbols(method_naming: method_naming)
36
+ setup_rcamera_symbols(method_naming: method_naming)
37
+ setup_rlgl_symbols(method_naming: method_naming)
38
+ end
39
+
40
+ #
41
+ # Generate sample code
42
+ #
43
+ def self.template
44
+ # Copy template code to user's current directory
45
+ example_path = "#{Gem::Specification.find_by_name('raylib-bindings').full_gem_path}/examples"
46
+ template_code_src = "#{example_path}/template.rb"
47
+ unless File.exist? template_code_src
48
+ warn "[Error] Raylib.template : Template source #{template_code_src} not found"
49
+ return false
50
+ end
51
+
52
+ template_code_dst = "#{Dir.getwd}/template.rb"
53
+ if File.exist? template_code_dst
54
+ warn "[Error] Raylib.template : Template destination #{template_code_dst} already exists"
55
+ return false
56
+ end
57
+
58
+ warn "[Info] Raylib.template : #{template_code_src} => #{template_code_dst}"
59
+ FileUtils.copy template_code_src, template_code_dst
60
+ warn '[Info] Raylib.template : Done'
61
+ end
62
+ end