gosu 0.11.2-x86-mingw32 → 0.11.3-x86-mingw32

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
  SHA1:
3
- metadata.gz: a5cce2123fbc80fcacc531a3b251de79c59b6c98
4
- data.tar.gz: 04d187898fb6334855e90fff6be5b618bc45591b
3
+ metadata.gz: 41dc7f5ff7fb2ab36d6ef380b59bd9170603d720
4
+ data.tar.gz: 42430746cfd434a8eeeeef53f9f83c806d9c581a
5
5
  SHA512:
6
- metadata.gz: a22022a8d48056143c2918412ed1b228ab8152a01e89a074b7680930c65d1d6443865dae18f03158a640f7329ef9e442e926b8cdbc7becd44567480d8d94ea5c
7
- data.tar.gz: 0dcb5c22c435c612acb113e7775b49212a527fe84d1689de451b48ac6b978336e7a358bf67075905ea3d188f3ad762643c3fdfd96b0aed26b30668c2dd2a959c
6
+ metadata.gz: 9acc963a16b4547e41108329e99113a4788656f4c81ff2ff1a65e50190400661d47c80d50a21e5cd040f5ea421c10d08464be250e27100c14370e6480b9d4e1b
7
+ data.tar.gz: bfe0a3fcba8cb3dc9369136fcc74ad8b192bc7db4950c51a432e1e9e0384e3591cb2f0f04ed39bd1179020bec323bfbf4961595889fd65a60eb0947309f13433
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,19 +1,21 @@
1
- require 'rbconfig'
1
+ require "rbconfig"
2
2
 
3
3
  if RUBY_PLATFORM =~ /mswin$|mingw32|mingw64|win32\-|\-win32/
4
4
  binary_path = File.dirname(__FILE__)
5
5
  # 64-bit builds of Windows use "x64-mingw32" as RUBY_PLATFORM
6
- binary_path += '64' if RUBY_PLATFORM =~ /^x64-/
6
+ binary_path += "64" if RUBY_PLATFORM =~ /^x64-/
7
7
 
8
8
  # Add this gem to the PATH on Windows so that bundled DLLs can be found.
9
- ENV['PATH'] = "#{binary_path};#{ENV['PATH']}"
9
+ # When running through Ocra on Windows, we need to be careful to preserve the ENV["PATH"]
10
+ # encoding (see #385).
11
+ ENV["PATH"] = "#{binary_path.encode ENV["PATH"].encoding};#{ENV["PATH"]}"
10
12
 
11
- # Add the correct directory
12
- RUBY_VERSION =~ /(\d+.\d+)/
13
- $LOAD_PATH.unshift "#{binary_path}/#{$1}"
13
+ # Add the correct lib directory for the current version of Ruby (major.minor).
14
+ $LOAD_PATH.unshift File.join(binary_path, RUBY_VERSION[/^\d+.\d+/])
14
15
  end
15
16
 
16
- require "gosu.#{RbConfig::CONFIG['DLEXT']}"
17
+ require "gosu.#{RbConfig::CONFIG["DLEXT"]}"
17
18
 
18
19
  require "gosu/swig_patches"
19
20
  require "gosu/patches"
21
+ require "gosu/compat"
@@ -0,0 +1,183 @@
1
+ # This whole file is about backward compatibility.
2
+
3
+ # Define some helpers to deprecate code.
4
+ module Gosu
5
+ DEPRECATION_STACKTRACE_LINES = 1
6
+
7
+ # Adapted from RubyGems, but without the date part.
8
+ def self.deprecate(klass, name, repl)
9
+ klass.class_eval {
10
+ old = "_deprecated_#{name}"
11
+ alias_method old, name
12
+ define_method name do |*args, &block|
13
+ Gosu.deprecation_message(self, name, repl)
14
+ send old, *args, &block
15
+ end
16
+ }
17
+ end
18
+
19
+ def self.deprecate_const(name, repl)
20
+ send(:remove_const, name) if const_defined?(name)
21
+
22
+ @@_deprecated_constants ||= {}
23
+ @@_deprecated_constants[name] = repl
24
+ end
25
+
26
+ # Constant deprecation works by undefining the original constant and then re-adding it in
27
+ # const_missing, so that each deprecation warning is only printed once.
28
+ def self.const_missing(const_name)
29
+ if @@_deprecated_constants && repl = @@_deprecated_constants[const_name]
30
+ Gosu.deprecation_message(self, const_name, repl)
31
+ const_get(repl)
32
+ else
33
+ super
34
+ end
35
+ end
36
+
37
+ def self.deprecation_message(klass_or_full_message, name=nil, repl=nil)
38
+ @@_deprecations_shown ||= {}
39
+
40
+ msg = if klass_or_full_message.is_a?(String) and name.nil? and repl.nil?
41
+ [ "DEPRECATION WARNING: #{klass_or_full_message},
42
+ \n#Called from #{caller[1, DEPRECATION_STACKTRACE_LINES]}"
43
+ ]
44
+ else
45
+ # Class method deprecation warnings result in something like this:
46
+ # #<Class:Gosu::Window>::button_id_to_char is deprecated
47
+ # Remove the instance-inspect stuff to make it look a bit better:
48
+ if klass_or_full_message.kind_of?(Module)
49
+ target = "#{klass_or_full_message.to_s.gsub(/#<Class:(.*)>/, '\1')}::"
50
+ else
51
+ "#{klass_or_full_message.class}#"
52
+ end
53
+ [ "DEPRECATION WARNING: #{target}#{name} is deprecated",
54
+ repl == :none ? " with no replacement." : "; use #{repl} instead.",
55
+ "\n#{target}#{name} called from #{Gosu.deprecation_caller.join("\n")}",
56
+ ]
57
+ end
58
+ return if @@_deprecations_shown.has_key?(msg[0])
59
+ @@_deprecations_shown[msg[0]] = true
60
+
61
+ warn "#{msg.join}."
62
+ end
63
+
64
+ # This method removes the deprecation methods themselves from the stacktrace.
65
+ def self.deprecation_caller
66
+ caller.delete_if { |trace_line| trace_line =~ /(deprecat|const_missing)/ }
67
+ .first(DEPRECATION_STACKTRACE_LINES)
68
+ end
69
+ end
70
+
71
+ # No need to pass a Window to Image.
72
+ class Gosu::Image
73
+ alias initialize_without_window initialize
74
+
75
+ def initialize(*args)
76
+ if args[0].is_a? Gosu::Window
77
+ Gosu.deprecation_message("Passing a Window to Image#initialize has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html.")
78
+ if args.size == 7
79
+ initialize_without_window args[1], :tileable => args[2], :rect => args[3..-1]
80
+ else
81
+ initialize_without_window args[1], :tileable => args[2]
82
+ end
83
+ else
84
+ initialize_without_window(*args)
85
+ end
86
+ end
87
+
88
+ class << self
89
+ alias from_text_without_window from_text
90
+ end
91
+
92
+ def self.from_text(*args)
93
+ if args.size == 4
94
+ Gosu.deprecation_message("Passing a Window to Image.from_text has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html.")
95
+ from_text_without_window(args[1], args[3], :font => args[2])
96
+ elsif args.size == 7
97
+ Gosu.deprecation_message("Passing a Window to Image.from_text has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html.")
98
+ from_text_without_window(args[1], args[3], :font => args[2],
99
+ :spacing => args[4], :width => args[5], :align => args[6])
100
+ else
101
+ from_text_without_window(*args)
102
+ end
103
+ end
104
+ end
105
+
106
+ # No need to pass a Window to Sample.
107
+ class Gosu::Sample
108
+ alias initialize_without_window initialize
109
+
110
+ def initialize(*args)
111
+ if args.first.is_a? Gosu::Window
112
+ args.shift
113
+ Gosu.deprecation_message("Passing a Window to Sample#initialize has been deprecated in Gosu 0.7.17.")
114
+ end
115
+ initialize_without_window(*args)
116
+ end
117
+ end
118
+
119
+ # No need to pass a Window to Song.
120
+ class Gosu::Song
121
+ alias initialize_without_window initialize
122
+
123
+ def initialize(*args)
124
+ if args.first.is_a? Gosu::Window
125
+ args.shift
126
+ Gosu.deprecation_message("Passing a Window to Song#initialize has been deprecated in Gosu 0.7.17.")
127
+ end
128
+ initialize_without_window(*args)
129
+ end
130
+ end
131
+
132
+ # Moved some Window-methods to the Gosu::Module
133
+ class Gosu::Window
134
+ # Class methods that have been turned into module methods.
135
+ class << self
136
+ def button_id_to_char(id)
137
+ Gosu.button_id_to_char(id)
138
+ end
139
+
140
+ def char_to_button_id(ch)
141
+ Gosu.char_to_button_id(ch)
142
+ end
143
+ end
144
+
145
+ # Instance methods that have been turned into module methods.
146
+ %w(draw_line draw_triangle draw_quad
147
+ flush gl clip_to record
148
+ transform translate rotate scale
149
+ button_id_to_char char_to_button_id button_down?).each do |method|
150
+ define_method method.to_sym do |*args, &block|
151
+ Gosu.send method, *args, &block
152
+ end
153
+ end
154
+ end
155
+
156
+ # Constants
157
+ module Gosu
158
+ Gosu.deprecate Window, :set_mouse_position, "Window#mouse_x= and Window#mouse_y="
159
+ Gosu.deprecate Font, :draw_rot, "Font#draw with Gosu.rotate"
160
+
161
+ # This was renamed because it's not actually a "copyright notice".
162
+ # (https://en.wikipedia.org/wiki/Copyright_notice)
163
+ deprecate_const :GOSU_COPYRIGHT_NOTICE, :LICENSES
164
+
165
+ module Button; end
166
+
167
+ # Support for KbLeft instead of KB_LEFT and Gp3Button2 instead of GP_3_BUTTON_2.
168
+ Gosu.constants.grep(/^KB_|MS_|GP_/).each do |new_name|
169
+ old_name = case new_name
170
+ when :KB_ISO then "KbISO"
171
+ when :KB_NUMPAD_PLUS then "KbNumpadAdd"
172
+ when :KB_NUMPAD_MINUS then "KbNumpadSubtract"
173
+ when :KB_EQUALS then "KbEqual"
174
+ when :KB_LEFT_BRACKET then "KbBracketLeft"
175
+ when :KB_RIGHT_BRACKET then "KbBracketRight"
176
+ else new_name.to_s.capitalize.gsub(/_(.)/) { $1.upcase }
177
+ end
178
+ Gosu.const_set old_name, new_name
179
+
180
+ # Also import old-style constants into Gosu::Button.
181
+ Gosu::Button.const_set old_name, Gosu.const_get(new_name)
182
+ end
183
+ end
@@ -18,79 +18,6 @@ class ::Numeric
18
18
  end
19
19
  end
20
20
 
21
- # Backwards compatibility:
22
- # Support for KbLeft instead of KB_LEFT and Gp3Button2 instead of GP_3_BUTTON_2.
23
- # Also import old-style constants into Gosu::Button.
24
- module Gosu::Button; end
25
- Gosu.constants.grep(/^KB_|MS_|GP_/).each do |c|
26
- old_name = case c
27
- when :KB_ISO then "KbISO"
28
- when :KB_NUMPAD_PLUS then "KbNumpadAdd"
29
- when :KB_NUMPAD_MINUS then "KbNumpadSubtract"
30
- when :KB_EQUALS then "KbEqual"
31
- when :KB_LEFT_BRACKET then "KbBracketLeft"
32
- when :KB_RIGHT_BRACKET then "KbBracketRight"
33
- else c.to_s.capitalize.gsub(/_(.)/) { $1.upcase }
34
- end
35
- Gosu.const_set old_name, Gosu.const_get(c)
36
- Gosu::Button.const_set old_name, Gosu.const_get(c)
37
- end
38
-
39
- # Backwards compatibility:
40
- # Passing a Window to initialize and from_text has been deprecated in Gosu 0.9.
41
- class Gosu::Image
42
- alias initialize_without_window initialize
43
-
44
- def initialize(*args)
45
- if args[0].is_a? Gosu::Window
46
- if args.size == 7
47
- initialize_without_window args[1], :tileable => args[2], :rect => args[3..-1]
48
- else
49
- initialize_without_window args[1], :tileable => args[2]
50
- end
51
- else
52
- initialize_without_window(*args)
53
- end
54
- end
55
-
56
- class << self
57
- alias from_text_without_window from_text
58
- end
59
-
60
- def self.from_text(*args)
61
- if args.size == 4
62
- from_text_without_window(args[1], args[3], :font => args[2])
63
- elsif args.size == 7
64
- from_text_without_window(args[1], args[3], :font => args[2],
65
- :spacing => args[4], :width => args[5], :align => args[6])
66
- else
67
- from_text_without_window(*args)
68
- end
69
- end
70
- end
71
-
72
- # Backwards compatibility:
73
- # Passing a Window to Sample#initialize has been deprecated in Gosu 0.7.17.
74
- class Gosu::Sample
75
- alias initialize_without_window initialize
76
-
77
- def initialize(*args)
78
- args.shift if args.first.is_a? Gosu::Window
79
- initialize_without_window(*args)
80
- end
81
- end
82
-
83
- # Backwards compatibility:
84
- # Passing a Window to Song#initialize has been deprecated in Gosu 0.7.17.
85
- class Gosu::Song
86
- alias initialize_without_window initialize
87
-
88
- def initialize(*args)
89
- args.shift if args.first.is_a? Gosu::Window
90
- initialize_without_window(*args)
91
- end
92
- end
93
-
94
21
  # Color constants.
95
22
  # This is cleaner than having SWIG define them.
96
23
  module Gosu
@@ -119,29 +46,6 @@ module Gosu
119
46
  end
120
47
 
121
48
  class Gosu::Window
122
- # Backwards compatibility:
123
- # Class methods that have been turned into module methods.
124
-
125
- def self.button_id_to_char(id)
126
- Gosu.button_id_to_char(id)
127
- end
128
-
129
- def self.char_to_button_id(ch)
130
- Gosu.char_to_button_id(ch)
131
- end
132
-
133
- # Backwards compatibility:
134
- # Instance methods that have been turned into module methods.
135
-
136
- %w(draw_line draw_triangle draw_quad
137
- flush gl clip_to record
138
- transform translate rotate scale
139
- button_id_to_char char_to_button_id button_down?).each do |method|
140
- define_method method.to_sym do |*args, &block|
141
- Gosu.send method, *args, &block
142
- end
143
- end
144
-
145
49
  # Call Thread.pass every tick, which may or may not be necessary for friendly co-existence with
146
50
  # Ruby's Thread class.
147
51
 
@@ -153,10 +57,6 @@ class Gosu::Window
153
57
  end
154
58
  end
155
59
 
156
- # Backwards compatibility:
157
- # This was renamed, because it's not actually a "copyright notice" (Wikipedia: https://en.wikipedia.org/wiki/Copyright_notice).
158
- Gosu::GOSU_COPYRIGHT_NOTICE = Gosu::LICENSES
159
-
160
60
  # Release OpenAL resources during Ruby's shutdown, not Gosu's.
161
61
  at_exit do
162
62
  begin
@@ -28,7 +28,7 @@ class Gosu::Window
28
28
  # Conveniently turn the return value into a boolean result (for needs_cursor? etc).
29
29
  defined?(@_exception) ? false : !!send(callback, *args)
30
30
  rescue Exception => e
31
- # Exit the message loop naturally, then re-throw
31
+ # Exit the message loop naturally, then re-throw during the next tick.
32
32
  @_exception = e
33
33
  close
34
34
  false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Julian Raschke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-26 00:00:00.000000000 Z
11
+ date: 2017-03-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  2D game development library.
@@ -30,6 +30,7 @@ files:
30
30
  - lib/OpenAL32.dll
31
31
  - lib/SDL2.dll
32
32
  - lib/gosu.rb
33
+ - lib/gosu/compat.rb
33
34
  - lib/gosu/patches.rb
34
35
  - lib/gosu/preview.rb
35
36
  - lib/gosu/run.rb