raylib-bindings 0.5.8pre1-aarch64-linux → 0.6.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
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)
21
- lib_paths = [libpath, raygui_libpath, physac_libpath].compact
22
-
23
- ffi_lib_flags :now, :global
24
- ffi_lib(*lib_paths)
25
- setup_symbols
26
-
27
- setup_raygui_symbols unless raygui_libpath.nil?
28
- setup_physac_symbols unless physac_libpath.nil?
29
- rescue LoadError => e
30
- warn e
31
- end
32
-
33
- def self.setup_symbols
34
- setup_raylib_symbols
35
- setup_raymath_symbols
36
- setup_rcamera_symbols
37
- setup_rlgl_symbols
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)
21
+ lib_paths = [libpath, raygui_libpath, physac_libpath].compact
22
+
23
+ ffi_lib_flags :now, :global
24
+ ffi_lib(*lib_paths)
25
+ setup_symbols
26
+
27
+ setup_raygui_symbols unless raygui_libpath.nil?
28
+ setup_physac_symbols unless physac_libpath.nil?
29
+ rescue LoadError => e
30
+ warn e
31
+ end
32
+
33
+ def self.setup_symbols
34
+ setup_raylib_symbols
35
+ setup_raymath_symbols
36
+ setup_rcamera_symbols
37
+ setup_rlgl_symbols
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