raylib-bindings 0.2.0 → 0.4.0

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