ruby2d 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3248849ba536b5f8b806a92b6020c9177feb4b8415241cc5579240b9d25f771
4
- data.tar.gz: f934d3eaef436fd21de2a120fc4ec392e670f3e123865b3aea251d2b5f1f4459
3
+ metadata.gz: '083de7264ef6e1144cd11683c383edf8fbac309d9cd648637301ce3bfcc804a8'
4
+ data.tar.gz: c0b437bd8f4dfe93994645308a44ea299dfd72259d2d00b67a162cdc2cefb758
5
5
  SHA512:
6
- metadata.gz: f844b95a670393b87a606bfd098b9abbd2f2758a3e255e30527339202e46affc2cc9caedc8c3fcdd4a486cdefd06d4cab7af579cacdc9a38e86fcb8e97d8a603
7
- data.tar.gz: ed7598cce5629acf38a346b95feb86e1c9b402cc380448f2f031b4f2c6c4c0ed8eb3ac633e8c1e4a0caf1d8ef003ec3ac8b50b387154e075287ac02c5f9459ff
6
+ metadata.gz: 17010953aceed980d3c6c01856a375c98e964f11eebf53eccf4fef7b6244cb4797e0bb8bc5202ccee16882f9d1e3fce55d741b78a15f28ba780dd69715e90332
7
+ data.tar.gz: 324e529ed71ce795ce8c86d281a245e569e8f1fd491f25d011089a8ed8fb1734b4abc288008355d6bbbd4548bbb231ff01e4711c9f10600f93a90ea4f383c69a
@@ -1,6 +1,6 @@
1
1
  require 'mkmf'
2
2
 
3
- S2D_VERSION = '0.8.0' # Simple 2D minimum version required
3
+ S2D_VERSION = '0.9.0' # Simple 2D minimum version required
4
4
  $errors = []
5
5
 
6
6
  class String
@@ -11,9 +11,9 @@ end
11
11
 
12
12
  def print_errors
13
13
  puts "
14
- #{"== #{"Ruby 2D Installation Errors".red} =====================================\n"}
14
+ #{"== #{"Ruby 2D Installation Errors".red} =======================================\n"}
15
15
  #{$errors.join("\n ")}\n
16
- #{"===================================================================="}"
16
+ #{"======================================================================="}"
17
17
  end
18
18
 
19
19
  def check_s2d_version
@@ -38,8 +38,8 @@ when /darwin/
38
38
 
39
39
  # Homebrew not installed
40
40
  if `which brew`.empty?
41
- $errors << "Ruby 2D uses a native library called Simple 2D." <<
42
- "On OS X, this can be installed using Homebrew.\n" <<
41
+ $errors << "Ruby 2D uses a native library called Simple 2D, which was not found." <<
42
+ "On macOS, it can be installed using Homebrew.\n" <<
43
43
  "First, install #{"Homebrew".bold}. See instructions at #{"http://brew.sh".bold}" <<
44
44
  "Then, run the following:\n" <<
45
45
  " brew tap simple2d/tap".bold <<
@@ -49,8 +49,8 @@ when /darwin/
49
49
 
50
50
  # Homebrew installed, instruct to install Simple 2D
51
51
  else
52
- $errors << "Ruby 2D uses a native library called Simple 2D." <<
53
- "Install with Homebrew using:\n" <<
52
+ $errors << "Ruby 2D uses a native library called Simple 2D, which was not found." <<
53
+ "Install it with Homebrew using:\n" <<
54
54
  " brew tap simple2d/tap".bold <<
55
55
  " brew install simple2d".bold
56
56
  print_errors
@@ -63,9 +63,8 @@ when /linux|mingw/
63
63
 
64
64
  # Simple 2D not installed
65
65
  if `which simple2d`.empty?
66
- $errors << "Ruby 2D uses a native library called Simple 2D.\n" <<
67
- "To install Simple 2D, follow the instructions in the README:" <<
68
- " #{"https://github.com/simple2d/simple2d".bold}"
66
+ $errors << "Ruby 2D uses a native library called Simple 2D, which was not found." <<
67
+ "To install, follow the instructions at #{"ruby2d.com/learn".bold}"
69
68
  print_errors
70
69
  exit
71
70
  end
@@ -909,6 +909,12 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) {
909
909
  S2D_Diagnostics(true);
910
910
  }
911
911
 
912
+ // Load controller mappings, if DB file exists
913
+ char *controller_mappings_path = RSTRING_PTR(r_iv_get(self, "@controller_mappings_path"));
914
+ if (S2D_FileExists(controller_mappings_path)) {
915
+ S2D_LoadControllerMappingsFromFile(controller_mappings_path);
916
+ }
917
+
912
918
  // Get window attributes
913
919
  char *title = RSTRING_PTR(r_iv_get(self, "@title"));
914
920
  int width = NUM2INT(r_iv_get(self, "@width"));
@@ -16,6 +16,18 @@ require 'ruby2d/sprite'
16
16
  require 'ruby2d/text'
17
17
  require 'ruby2d/sound'
18
18
  require 'ruby2d/music'
19
+
20
+ if RUBY_PLATFORM =~ /mingw/
21
+ # When using the Windows CI AppVeyor
22
+ if ENV['APPVEYOR']
23
+ s2d_dll_path = 'C:\msys64\usr\local\bin'
24
+ # When in a standard MinGW shell
25
+ else
26
+ s2d_dll_path = '~/../../usr/local/bin'
27
+ end
28
+ RubyInstaller::Runtime.add_dll_directory(File.expand_path(s2d_dll_path))
29
+ end
30
+
19
31
  require 'ruby2d/ruby2d' # load native extension
20
32
 
21
33
  include Ruby2D
@@ -8,9 +8,11 @@ module Ruby2D
8
8
 
9
9
  def initialize(x, y, path, z=0)
10
10
 
11
- # unless File.exists? path
12
- # raise Error, "Cannot find image file `#{path}`"
13
- # end
11
+ unless RUBY_ENGINE == 'opal'
12
+ unless File.exists? path
13
+ raise Error, "Cannot find sprite image file `#{path}`"
14
+ end
15
+ end
14
16
 
15
17
  @x, @y, @path = x, y, path
16
18
  @clip_x, @clip_y, @clip_w, @clip_h = 0, 0, 0, 0
@@ -63,6 +65,14 @@ module Ruby2D
63
65
  end
64
66
  end
65
67
 
68
+ def width
69
+ @current_animation ? @animations[@current_animation][@current_frame][2] : @default[2]
70
+ end
71
+
72
+ def height
73
+ @current_animation ? @animations[@current_animation][@current_frame][3] : @default[3]
74
+ end
75
+
66
76
  private
67
77
 
68
78
  def clip(x, y, w, h)
@@ -1,5 +1,5 @@
1
1
  # version.rb
2
2
 
3
3
  module Ruby2D
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
@@ -48,6 +48,7 @@ module Ruby2D
48
48
  }
49
49
  @update_proc = Proc.new {}
50
50
  @diagnostics = false
51
+ @controller_mappings_path = File.join(Dir.home, ".ruby2d", "controllers.txt")
51
52
  end
52
53
 
53
54
  def new_event_key
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2d
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Black
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.10'
19
+ version: '0.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.10'
26
+ version: '0.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.7.3
193
+ rubygems_version: 2.7.4
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Ruby 2D