gosu 0.10.2-x86-mingw32 → 0.10.3-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/1.8/gosu.so +0 -0
- data/lib/1.9/gosu.so +0 -0
- data/lib/2.0/gosu.so +0 -0
- data/lib/2.1/gosu.so +0 -0
- data/lib/2.2/gosu.so +0 -0
- data/lib/gosu.rb +19 -19
- data/lib/gosu/patches.rb +129 -129
- data/lib/gosu/preview.rb +10 -10
- data/lib/gosu/run.rb +11 -11
- data/lib/gosu/swig_patches.rb +70 -70
- data/lib/gosu/zen.rb +89 -89
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0981f4e50dc04e0c76fcff1a31d38bc0877a0d4c
|
4
|
+
data.tar.gz: 215c95de67803448782fa2c9742e58e17f601c73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63312050f791ea084445d600db1078fb451518e925a8ac74ecfb6e33f21c39c0c442bdb4d24bb671ed2597619d8a8b8e275ffc0f627496939c0238ca070057ae
|
7
|
+
data.tar.gz: 0257e9c595b8725cd86ed39e14b338abeeb16feefb3e8943324e29fcd9966340e9ddf7d19de2d569c9e09b3764eda68d9cef1380392179f52945b43be72cff6b
|
data/lib/1.8/gosu.so
CHANGED
Binary file
|
data/lib/1.9/gosu.so
CHANGED
Binary file
|
data/lib/2.0/gosu.so
CHANGED
Binary file
|
data/lib/2.1/gosu.so
CHANGED
Binary file
|
data/lib/2.2/gosu.so
CHANGED
Binary file
|
data/lib/gosu.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
if RUBY_PLATFORM =~ /mswin$|mingw32|mingw64|win32\-|\-win32/ then
|
4
|
-
binary_path = File.dirname(__FILE__)
|
5
|
-
# 64-bit builds of Windows use "x64-mingw32" as RUBY_PLATFORM
|
6
|
-
binary_path += '64' if RUBY_PLATFORM =~ /^x64-/
|
7
|
-
|
8
|
-
# Add this gem to the PATH on Windows so that bundled DLLs can be found.
|
9
|
-
ENV['PATH'] = "#{binary_path};#{ENV['PATH']}"
|
10
|
-
|
11
|
-
# Add the correct directory
|
12
|
-
RUBY_VERSION =~ /(\d+.\d+)/
|
13
|
-
$LOAD_PATH.unshift "#{binary_path}/#{$1}"
|
14
|
-
end
|
15
|
-
|
16
|
-
require "gosu.#{RbConfig::CONFIG['DLEXT']}"
|
17
|
-
|
18
|
-
require "gosu/swig_patches"
|
19
|
-
require "gosu/patches"
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
if RUBY_PLATFORM =~ /mswin$|mingw32|mingw64|win32\-|\-win32/ then
|
4
|
+
binary_path = File.dirname(__FILE__)
|
5
|
+
# 64-bit builds of Windows use "x64-mingw32" as RUBY_PLATFORM
|
6
|
+
binary_path += '64' if RUBY_PLATFORM =~ /^x64-/
|
7
|
+
|
8
|
+
# Add this gem to the PATH on Windows so that bundled DLLs can be found.
|
9
|
+
ENV['PATH'] = "#{binary_path};#{ENV['PATH']}"
|
10
|
+
|
11
|
+
# Add the correct directory
|
12
|
+
RUBY_VERSION =~ /(\d+.\d+)/
|
13
|
+
$LOAD_PATH.unshift "#{binary_path}/#{$1}"
|
14
|
+
end
|
15
|
+
|
16
|
+
require "gosu.#{RbConfig::CONFIG['DLEXT']}"
|
17
|
+
|
18
|
+
require "gosu/swig_patches"
|
19
|
+
require "gosu/patches"
|
data/lib/gosu/patches.rb
CHANGED
@@ -1,129 +1,129 @@
|
|
1
|
-
# Extend Numeric with simple angle conversion methods,
|
2
|
-
# for easier integration with Chipmunk.
|
3
|
-
class ::Numeric
|
4
|
-
def degrees_to_radians
|
5
|
-
self * Math::PI / 180.0
|
6
|
-
end
|
7
|
-
|
8
|
-
def radians_to_degrees
|
9
|
-
self * 180.0 / Math::PI
|
10
|
-
end
|
11
|
-
|
12
|
-
def gosu_to_radians
|
13
|
-
(self - 90) * Math::PI / 180.0
|
14
|
-
end
|
15
|
-
|
16
|
-
def radians_to_gosu
|
17
|
-
self * 180.0 / Math::PI + 90
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Backwards compatibility:
|
22
|
-
# Import constants into Gosu::Button.
|
23
|
-
module Gosu::Button
|
24
|
-
Gosu.constants.each { |c| const_set(c, Gosu.const_get(c)) }
|
25
|
-
end
|
26
|
-
|
27
|
-
# Backwards compatibility:
|
28
|
-
# The old version of from_text has been deprecated in Gosu 0.9.
|
29
|
-
class Gosu::Image
|
30
|
-
class << self
|
31
|
-
alias from_text_without_window from_text
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.from_text(*args)
|
35
|
-
if args.size == 4
|
36
|
-
from_text_without_window(args[1], args[3], :font => args[2])
|
37
|
-
elsif args.size == 7
|
38
|
-
from_text_without_window(args[1], args[3], :font => args[2],
|
39
|
-
:spacing => args[4], :width => args[5], :align => args[6])
|
40
|
-
else
|
41
|
-
from_text_without_window(*args)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Backwards compatibility:
|
47
|
-
# Passing a Window Sample#initialize has been deprecated in Gosu 0.7.17.
|
48
|
-
class Gosu::Sample
|
49
|
-
alias initialize_without_window initialize
|
50
|
-
|
51
|
-
def initialize(*args)
|
52
|
-
args.shift if args.first.is_a? Gosu::Window
|
53
|
-
initialize_without_window(*args)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Backwards compatibility:
|
58
|
-
# Passing a Window to Song#initialize has been deprecated in Gosu 0.7.17.
|
59
|
-
class Gosu::Song
|
60
|
-
alias initialize_without_window initialize
|
61
|
-
|
62
|
-
def initialize(*args)
|
63
|
-
args.shift if args.first.is_a? Gosu::Window
|
64
|
-
initialize_without_window(*args)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Color constants.
|
69
|
-
# This is cleaner than having SWIG define them.
|
70
|
-
module Gosu
|
71
|
-
class ImmutableColor < Color
|
72
|
-
private :alpha=, :red=, :green=, :blue=, :hue=, :saturation=, :value=
|
73
|
-
end
|
74
|
-
|
75
|
-
class Color
|
76
|
-
NONE = Gosu::ImmutableColor.new(0x00_000000)
|
77
|
-
BLACK = Gosu::ImmutableColor.new(0xff_000000)
|
78
|
-
GRAY = Gosu::ImmutableColor.new(0xff_808080)
|
79
|
-
WHITE = Gosu::ImmutableColor.new(0xff_ffffff)
|
80
|
-
AQUA = Gosu::ImmutableColor.new(0xff_00ffff)
|
81
|
-
RED = Gosu::ImmutableColor.new(0xff_ff0000)
|
82
|
-
GREEN = Gosu::ImmutableColor.new(0xff_00ff00)
|
83
|
-
BLUE = Gosu::ImmutableColor.new(0xff_0000ff)
|
84
|
-
YELLOW = Gosu::ImmutableColor.new(0xff_ffff00)
|
85
|
-
FUCHSIA = Gosu::ImmutableColor.new(0xff_ff00ff)
|
86
|
-
CYAN = Gosu::ImmutableColor.new(0xff_00ffff)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
class Gosu::Window
|
91
|
-
# Backwards compatibility:
|
92
|
-
# Class methods that have been turned into module methods.
|
93
|
-
|
94
|
-
def self.button_id_to_char(id)
|
95
|
-
Gosu.button_id_to_char(id)
|
96
|
-
end
|
97
|
-
|
98
|
-
def self.char_to_button_id(ch)
|
99
|
-
Gosu.char_to_button_id(ch)
|
100
|
-
end
|
101
|
-
|
102
|
-
# Backwards compatibility:
|
103
|
-
# Instance methods that have been turned into module methods.
|
104
|
-
|
105
|
-
%w(draw_line draw_triangle draw_quad
|
106
|
-
flush gl clip_to record
|
107
|
-
transform translate rotate scale
|
108
|
-
button_id_to_char char_to_button_id button_down?).each do |method|
|
109
|
-
define_method method.to_sym do |*args, &block|
|
110
|
-
Gosu.send method, *args, &block
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# Call Thread.pass every tick, which may or may not be necessary for friendly co-existence with
|
115
|
-
# Ruby's Thread class.
|
116
|
-
|
117
|
-
alias _tick tick
|
118
|
-
|
119
|
-
def tick
|
120
|
-
Thread.pass
|
121
|
-
_tick
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
# Release OpenAL resources during Ruby's shutdown, not Gosu's.
|
126
|
-
at_exit do
|
127
|
-
Gosu::Song.current_song.stop if Gosu::Song.current_song
|
128
|
-
Gosu::_release_all_openal_resources
|
129
|
-
end
|
1
|
+
# Extend Numeric with simple angle conversion methods,
|
2
|
+
# for easier integration with Chipmunk.
|
3
|
+
class ::Numeric
|
4
|
+
def degrees_to_radians
|
5
|
+
self * Math::PI / 180.0
|
6
|
+
end
|
7
|
+
|
8
|
+
def radians_to_degrees
|
9
|
+
self * 180.0 / Math::PI
|
10
|
+
end
|
11
|
+
|
12
|
+
def gosu_to_radians
|
13
|
+
(self - 90) * Math::PI / 180.0
|
14
|
+
end
|
15
|
+
|
16
|
+
def radians_to_gosu
|
17
|
+
self * 180.0 / Math::PI + 90
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Backwards compatibility:
|
22
|
+
# Import constants into Gosu::Button.
|
23
|
+
module Gosu::Button
|
24
|
+
Gosu.constants.each { |c| const_set(c, Gosu.const_get(c)) }
|
25
|
+
end
|
26
|
+
|
27
|
+
# Backwards compatibility:
|
28
|
+
# The old version of from_text has been deprecated in Gosu 0.9.
|
29
|
+
class Gosu::Image
|
30
|
+
class << self
|
31
|
+
alias from_text_without_window from_text
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.from_text(*args)
|
35
|
+
if args.size == 4
|
36
|
+
from_text_without_window(args[1], args[3], :font => args[2])
|
37
|
+
elsif args.size == 7
|
38
|
+
from_text_without_window(args[1], args[3], :font => args[2],
|
39
|
+
:spacing => args[4], :width => args[5], :align => args[6])
|
40
|
+
else
|
41
|
+
from_text_without_window(*args)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Backwards compatibility:
|
47
|
+
# Passing a Window Sample#initialize has been deprecated in Gosu 0.7.17.
|
48
|
+
class Gosu::Sample
|
49
|
+
alias initialize_without_window initialize
|
50
|
+
|
51
|
+
def initialize(*args)
|
52
|
+
args.shift if args.first.is_a? Gosu::Window
|
53
|
+
initialize_without_window(*args)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Backwards compatibility:
|
58
|
+
# Passing a Window to Song#initialize has been deprecated in Gosu 0.7.17.
|
59
|
+
class Gosu::Song
|
60
|
+
alias initialize_without_window initialize
|
61
|
+
|
62
|
+
def initialize(*args)
|
63
|
+
args.shift if args.first.is_a? Gosu::Window
|
64
|
+
initialize_without_window(*args)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Color constants.
|
69
|
+
# This is cleaner than having SWIG define them.
|
70
|
+
module Gosu
|
71
|
+
class ImmutableColor < Color
|
72
|
+
private :alpha=, :red=, :green=, :blue=, :hue=, :saturation=, :value=
|
73
|
+
end
|
74
|
+
|
75
|
+
class Color
|
76
|
+
NONE = Gosu::ImmutableColor.new(0x00_000000)
|
77
|
+
BLACK = Gosu::ImmutableColor.new(0xff_000000)
|
78
|
+
GRAY = Gosu::ImmutableColor.new(0xff_808080)
|
79
|
+
WHITE = Gosu::ImmutableColor.new(0xff_ffffff)
|
80
|
+
AQUA = Gosu::ImmutableColor.new(0xff_00ffff)
|
81
|
+
RED = Gosu::ImmutableColor.new(0xff_ff0000)
|
82
|
+
GREEN = Gosu::ImmutableColor.new(0xff_00ff00)
|
83
|
+
BLUE = Gosu::ImmutableColor.new(0xff_0000ff)
|
84
|
+
YELLOW = Gosu::ImmutableColor.new(0xff_ffff00)
|
85
|
+
FUCHSIA = Gosu::ImmutableColor.new(0xff_ff00ff)
|
86
|
+
CYAN = Gosu::ImmutableColor.new(0xff_00ffff)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class Gosu::Window
|
91
|
+
# Backwards compatibility:
|
92
|
+
# Class methods that have been turned into module methods.
|
93
|
+
|
94
|
+
def self.button_id_to_char(id)
|
95
|
+
Gosu.button_id_to_char(id)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.char_to_button_id(ch)
|
99
|
+
Gosu.char_to_button_id(ch)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Backwards compatibility:
|
103
|
+
# Instance methods that have been turned into module methods.
|
104
|
+
|
105
|
+
%w(draw_line draw_triangle draw_quad
|
106
|
+
flush gl clip_to record
|
107
|
+
transform translate rotate scale
|
108
|
+
button_id_to_char char_to_button_id button_down?).each do |method|
|
109
|
+
define_method method.to_sym do |*args, &block|
|
110
|
+
Gosu.send method, *args, &block
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Call Thread.pass every tick, which may or may not be necessary for friendly co-existence with
|
115
|
+
# Ruby's Thread class.
|
116
|
+
|
117
|
+
alias _tick tick
|
118
|
+
|
119
|
+
def tick
|
120
|
+
Thread.pass
|
121
|
+
_tick
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Release OpenAL resources during Ruby's shutdown, not Gosu's.
|
126
|
+
at_exit do
|
127
|
+
Gosu::Song.current_song.stop if Gosu::Song.current_song
|
128
|
+
Gosu::_release_all_openal_resources
|
129
|
+
end
|
data/lib/gosu/preview.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
warn "gosu/preview.rb has been removed in Gosu 0.9.0, and Gosu itself \n" +
|
2
|
-
"provides a similar interface to what preview.rb used to offer.\n" +
|
3
|
-
"Notable differences:\n" +
|
4
|
-
"• no global $window variable\n" +
|
5
|
-
"• no global Gosu.mouse_x and Gosu.mouse_y functions\n" +
|
6
|
-
"• Image#initialize et.al. use an options hash now\n" +
|
7
|
-
"If you cannot update your code base right now, you should require \n" +
|
8
|
-
"Gosu 0.8.x in your Gemfile: gem 'gosu', '~> 0.8.0'";
|
9
|
-
|
10
|
-
require 'gosu'
|
1
|
+
warn "gosu/preview.rb has been removed in Gosu 0.9.0, and Gosu itself \n" +
|
2
|
+
"provides a similar interface to what preview.rb used to offer.\n" +
|
3
|
+
"Notable differences:\n" +
|
4
|
+
"• no global $window variable\n" +
|
5
|
+
"• no global Gosu.mouse_x and Gosu.mouse_y functions\n" +
|
6
|
+
"• Image#initialize et.al. use an options hash now\n" +
|
7
|
+
"If you cannot update your code base right now, you should require \n" +
|
8
|
+
"Gosu 0.8.x in your Gemfile: gem 'gosu', '~> 0.8.0'";
|
9
|
+
|
10
|
+
require 'gosu'
|
data/lib/gosu/run.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# Replace the load path
|
2
|
-
$LOAD_PATH.clear
|
3
|
-
$LOAD_PATH << File.dirname(__FILE__)[0..-6]
|
4
|
-
$LOAD_PATH << $LOAD_PATH[0] + '/lib'
|
5
|
-
# Ruby portions of Gosu
|
6
|
-
require 'gosu/patches'
|
7
|
-
require 'gosu/swig_patches'
|
8
|
-
# Let the application know it is being run from the Mac app wrapper.
|
9
|
-
OSX_EXECUTABLE = true
|
10
|
-
# Main application
|
11
|
-
require 'Main'
|
1
|
+
# Replace the load path
|
2
|
+
$LOAD_PATH.clear
|
3
|
+
$LOAD_PATH << File.dirname(__FILE__)[0..-6]
|
4
|
+
$LOAD_PATH << $LOAD_PATH[0] + '/lib'
|
5
|
+
# Ruby portions of Gosu
|
6
|
+
require 'gosu/patches'
|
7
|
+
require 'gosu/swig_patches'
|
8
|
+
# Let the application know it is being run from the Mac app wrapper.
|
9
|
+
OSX_EXECUTABLE = true
|
10
|
+
# Main application
|
11
|
+
require 'Main'
|
data/lib/gosu/swig_patches.rb
CHANGED
@@ -1,70 +1,70 @@
|
|
1
|
-
# SWIG workarounds
|
2
|
-
# These are offloaded into a separate file because rb_eval_string() is weird on Ruby 1.8.
|
3
|
-
|
4
|
-
# Exceptions in Window callbacks often get lost, this is especially annoying in draw/update.
|
5
|
-
# It is not clear whether this is a SWIG issue or if some stack frame is not exception
|
6
|
-
# compatible, but I just call protected_update etc. in the Ruby wrapper so I can add this
|
7
|
-
# custom debugging help:
|
8
|
-
class Gosu::Window
|
9
|
-
alias initialize_without_hash initialize
|
10
|
-
|
11
|
-
def initialize width, height, *args
|
12
|
-
if args.empty? or args.first.is_a? Hash then
|
13
|
-
options = args.first || {}
|
14
|
-
fullscreen = options[:fullscreen]
|
15
|
-
update_interval = options[:update_interval]
|
16
|
-
else
|
17
|
-
fullscreen, update_interval = *args
|
18
|
-
end
|
19
|
-
initialize_without_hash width, height, !!fullscreen, update_interval || 16.666666
|
20
|
-
end
|
21
|
-
|
22
|
-
%w(update draw needs_redraw? needs_cursor?
|
23
|
-
lose_focus button_down button_up).each do |callback|
|
24
|
-
define_method "protected_#{callback}" do |*args|
|
25
|
-
begin
|
26
|
-
# If there has been an exception, don't do anything as to not make matters worse.
|
27
|
-
# Conveniently turn the return value into a boolean result (for needs_cursor? etc).
|
28
|
-
defined?(@_exception) ? false : !!send(callback, *args)
|
29
|
-
rescue Exception => e
|
30
|
-
# Exit the message loop naturally, then re-throw
|
31
|
-
@_exception = e
|
32
|
-
close
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def protected_draw_2
|
38
|
-
protected_draw
|
39
|
-
$gosu_gl_blocks_2 = $gosu_gl_blocks
|
40
|
-
$gosu_gl_blocks = nil
|
41
|
-
end
|
42
|
-
|
43
|
-
alias show_internal show
|
44
|
-
def show
|
45
|
-
show_internal
|
46
|
-
# Try to format the message nicely, without any useless patching that we are
|
47
|
-
# doing here.
|
48
|
-
if defined? @_exception then
|
49
|
-
if @_exception.backtrace.is_a? Array and not @_exception.backtrace.frozen? then
|
50
|
-
@_exception.backtrace.reject! { |line| line.include? 'lib/gosu/swig_patches.rb' }
|
51
|
-
end
|
52
|
-
raise @_exception
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
module Gosu
|
58
|
-
# Keep a reference to these blocks that is only cleared after Window#draw.
|
59
|
-
# Otherwise, the GC might free these blocks while Gosu is still rendering.
|
60
|
-
def self.gl(*args, &block)
|
61
|
-
$gosu_gl_blocks ||= []
|
62
|
-
$gosu_gl_blocks << block
|
63
|
-
unsafe_gl(*args, &block)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# SWIG won't let me rename my method to '[]='.
|
68
|
-
class Gosu::Font
|
69
|
-
alias []= set_image
|
70
|
-
end
|
1
|
+
# SWIG workarounds
|
2
|
+
# These are offloaded into a separate file because rb_eval_string() is weird on Ruby 1.8.
|
3
|
+
|
4
|
+
# Exceptions in Window callbacks often get lost, this is especially annoying in draw/update.
|
5
|
+
# It is not clear whether this is a SWIG issue or if some stack frame is not exception
|
6
|
+
# compatible, but I just call protected_update etc. in the Ruby wrapper so I can add this
|
7
|
+
# custom debugging help:
|
8
|
+
class Gosu::Window
|
9
|
+
alias initialize_without_hash initialize
|
10
|
+
|
11
|
+
def initialize width, height, *args
|
12
|
+
if args.empty? or args.first.is_a? Hash then
|
13
|
+
options = args.first || {}
|
14
|
+
fullscreen = options[:fullscreen]
|
15
|
+
update_interval = options[:update_interval]
|
16
|
+
else
|
17
|
+
fullscreen, update_interval = *args
|
18
|
+
end
|
19
|
+
initialize_without_hash width, height, !!fullscreen, update_interval || 16.666666
|
20
|
+
end
|
21
|
+
|
22
|
+
%w(update draw needs_redraw? needs_cursor?
|
23
|
+
lose_focus button_down button_up).each do |callback|
|
24
|
+
define_method "protected_#{callback}" do |*args|
|
25
|
+
begin
|
26
|
+
# If there has been an exception, don't do anything as to not make matters worse.
|
27
|
+
# Conveniently turn the return value into a boolean result (for needs_cursor? etc).
|
28
|
+
defined?(@_exception) ? false : !!send(callback, *args)
|
29
|
+
rescue Exception => e
|
30
|
+
# Exit the message loop naturally, then re-throw
|
31
|
+
@_exception = e
|
32
|
+
close
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def protected_draw_2
|
38
|
+
protected_draw
|
39
|
+
$gosu_gl_blocks_2 = $gosu_gl_blocks
|
40
|
+
$gosu_gl_blocks = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
alias show_internal show
|
44
|
+
def show
|
45
|
+
show_internal
|
46
|
+
# Try to format the message nicely, without any useless patching that we are
|
47
|
+
# doing here.
|
48
|
+
if defined? @_exception then
|
49
|
+
if @_exception.backtrace.is_a? Array and not @_exception.backtrace.frozen? then
|
50
|
+
@_exception.backtrace.reject! { |line| line.include? 'lib/gosu/swig_patches.rb' }
|
51
|
+
end
|
52
|
+
raise @_exception
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module Gosu
|
58
|
+
# Keep a reference to these blocks that is only cleared after Window#draw.
|
59
|
+
# Otherwise, the GC might free these blocks while Gosu is still rendering.
|
60
|
+
def self.gl(*args, &block)
|
61
|
+
$gosu_gl_blocks ||= []
|
62
|
+
$gosu_gl_blocks << block
|
63
|
+
unsafe_gl(*args, &block)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# SWIG won't let me rename my method to '[]='.
|
68
|
+
class Gosu::Font
|
69
|
+
alias []= set_image
|
70
|
+
end
|
data/lib/gosu/zen.rb
CHANGED
@@ -1,89 +1,89 @@
|
|
1
|
-
require 'gosu/preview'
|
2
|
-
|
3
|
-
module Gosu
|
4
|
-
module Zen
|
5
|
-
|
6
|
-
@@window_args = [800, 600, {}]
|
7
|
-
@@options = {}
|
8
|
-
|
9
|
-
def window width, height, options = nil
|
10
|
-
if $window.nil?
|
11
|
-
@@window_args[0] = width
|
12
|
-
@@window_args[1] = height
|
13
|
-
@@window_args[2].merge! options if options
|
14
|
-
else
|
15
|
-
raise "window size can only be set before the window is created"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def set what, value
|
20
|
-
if $window.nil?
|
21
|
-
@@options[what.to_sym] = value
|
22
|
-
else
|
23
|
-
$window.send "#{what}=", value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def init &body
|
28
|
-
ZenWindow.send :define_method, :init, &body
|
29
|
-
end
|
30
|
-
|
31
|
-
def button_down id = nil, &body
|
32
|
-
m = id ? "button_down_#{id}" : :button_down_other
|
33
|
-
ZenWindow.send :define_method, m, &body
|
34
|
-
end
|
35
|
-
|
36
|
-
def button_up id = nil, &body
|
37
|
-
m = id ? "button_up_#{id}" : :button_up_other
|
38
|
-
ZenWindow.send :define_method, m, &body
|
39
|
-
end
|
40
|
-
|
41
|
-
def update &body
|
42
|
-
ZenWindow.send :define_method, :update, &body
|
43
|
-
end
|
44
|
-
|
45
|
-
def draw &body
|
46
|
-
ZenWindow.send :define_method, :draw, &body
|
47
|
-
end
|
48
|
-
|
49
|
-
def run!
|
50
|
-
window = ZenWindow.new *@@window_args
|
51
|
-
@@options.each do |opt, value|
|
52
|
-
window.send "#{opt}=", value
|
53
|
-
end
|
54
|
-
window.show
|
55
|
-
end
|
56
|
-
|
57
|
-
def Zen.included mod
|
58
|
-
at_exit { run! unless $! }
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
class ZenWindow < Window
|
64
|
-
def initialize *args
|
65
|
-
super
|
66
|
-
init
|
67
|
-
end
|
68
|
-
|
69
|
-
def init
|
70
|
-
end
|
71
|
-
|
72
|
-
def button_down id
|
73
|
-
m = :"button_down_#{id}"
|
74
|
-
respond_to?(m) ? send(m) : button_down_other(id)
|
75
|
-
end
|
76
|
-
|
77
|
-
def button_up id
|
78
|
-
m = :"button_up_#{id}"
|
79
|
-
respond_to?(m) ? send(m) : button_up_other(id)
|
80
|
-
end
|
81
|
-
|
82
|
-
def button_down_other id
|
83
|
-
end
|
84
|
-
|
85
|
-
def button_up_other id
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
1
|
+
require 'gosu/preview'
|
2
|
+
|
3
|
+
module Gosu
|
4
|
+
module Zen
|
5
|
+
|
6
|
+
@@window_args = [800, 600, {}]
|
7
|
+
@@options = {}
|
8
|
+
|
9
|
+
def window width, height, options = nil
|
10
|
+
if $window.nil?
|
11
|
+
@@window_args[0] = width
|
12
|
+
@@window_args[1] = height
|
13
|
+
@@window_args[2].merge! options if options
|
14
|
+
else
|
15
|
+
raise "window size can only be set before the window is created"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def set what, value
|
20
|
+
if $window.nil?
|
21
|
+
@@options[what.to_sym] = value
|
22
|
+
else
|
23
|
+
$window.send "#{what}=", value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def init &body
|
28
|
+
ZenWindow.send :define_method, :init, &body
|
29
|
+
end
|
30
|
+
|
31
|
+
def button_down id = nil, &body
|
32
|
+
m = id ? "button_down_#{id}" : :button_down_other
|
33
|
+
ZenWindow.send :define_method, m, &body
|
34
|
+
end
|
35
|
+
|
36
|
+
def button_up id = nil, &body
|
37
|
+
m = id ? "button_up_#{id}" : :button_up_other
|
38
|
+
ZenWindow.send :define_method, m, &body
|
39
|
+
end
|
40
|
+
|
41
|
+
def update &body
|
42
|
+
ZenWindow.send :define_method, :update, &body
|
43
|
+
end
|
44
|
+
|
45
|
+
def draw &body
|
46
|
+
ZenWindow.send :define_method, :draw, &body
|
47
|
+
end
|
48
|
+
|
49
|
+
def run!
|
50
|
+
window = ZenWindow.new *@@window_args
|
51
|
+
@@options.each do |opt, value|
|
52
|
+
window.send "#{opt}=", value
|
53
|
+
end
|
54
|
+
window.show
|
55
|
+
end
|
56
|
+
|
57
|
+
def Zen.included mod
|
58
|
+
at_exit { run! unless $! }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
class ZenWindow < Window
|
64
|
+
def initialize *args
|
65
|
+
super
|
66
|
+
init
|
67
|
+
end
|
68
|
+
|
69
|
+
def init
|
70
|
+
end
|
71
|
+
|
72
|
+
def button_down id
|
73
|
+
m = :"button_down_#{id}"
|
74
|
+
respond_to?(m) ? send(m) : button_down_other(id)
|
75
|
+
end
|
76
|
+
|
77
|
+
def button_up id
|
78
|
+
m = :"button_up_#{id}"
|
79
|
+
respond_to?(m) ? send(m) : button_up_other(id)
|
80
|
+
end
|
81
|
+
|
82
|
+
def button_down_other id
|
83
|
+
end
|
84
|
+
|
85
|
+
def button_up_other id
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
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.10.
|
4
|
+
version: 0.10.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: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
2D game development library.
|
@@ -23,12 +23,6 @@ executables: []
|
|
23
23
|
extensions: []
|
24
24
|
extra_rdoc_files: []
|
25
25
|
files:
|
26
|
-
- lib/gosu/patches.rb
|
27
|
-
- lib/gosu/preview.rb
|
28
|
-
- lib/gosu/run.rb
|
29
|
-
- lib/gosu/swig_patches.rb
|
30
|
-
- lib/gosu/zen.rb
|
31
|
-
- lib/gosu.rb
|
32
26
|
- lib/1.8/gosu.so
|
33
27
|
- lib/1.9/gosu.so
|
34
28
|
- lib/2.0/gosu.so
|
@@ -36,6 +30,12 @@ files:
|
|
36
30
|
- lib/2.2/gosu.so
|
37
31
|
- lib/OpenAL32.dll
|
38
32
|
- lib/SDL2.dll
|
33
|
+
- lib/gosu.rb
|
34
|
+
- lib/gosu/patches.rb
|
35
|
+
- lib/gosu/preview.rb
|
36
|
+
- lib/gosu/run.rb
|
37
|
+
- lib/gosu/swig_patches.rb
|
38
|
+
- lib/gosu/zen.rb
|
39
39
|
- lib/libsndfile.dll
|
40
40
|
homepage: http://www.libgosu.org/
|
41
41
|
licenses: []
|
@@ -46,17 +46,17 @@ require_paths:
|
|
46
46
|
- lib
|
47
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.4.8
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: 2D game development library.
|