gosu 0.10.1.2-x64-mingw32 → 0.10.2.pre2-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gosu/patches.rb +117 -117
- 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
- data/lib/gosu.rb +19 -19
- data/lib64/2.1/gosu.so +0 -0
- data/lib64/2.2/gosu.so +0 -0
- data/lib64/SDL2.dll +0 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62ed5947636487b4d32b92b4b0ddf6de4111d390
|
4
|
+
data.tar.gz: e3d72750e8c035e6fc1ec130504efdf3279a84f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e5fbc12fce04b9bb7796e198b4444c252f6b7ed38de5fd48dda120b237e4953e53f03544987b662e5c952409c8673e20a07b55de61cdca8fbc83039e24a2c7
|
7
|
+
data.tar.gz: ab566f22c48ccdf2054bc01b5d5596a58a7cb4913aa22ba69b2a2157023650c9afa76c1a43ccbd6205819128874c05ef1a60672540a794b2a4492a953bc5291c
|
data/lib/gosu/patches.rb
CHANGED
@@ -1,117 +1,117 @@
|
|
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
|
-
def self.button_id_to_char(id)
|
94
|
-
Gosu.button_id_to_char(id)
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.char_to_button_id(ch)
|
98
|
-
Gosu.char_to_button_id(ch)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Backwards compatibility:
|
102
|
-
# Instance methods taht have been turned into module methods.
|
103
|
-
%w(draw_line draw_triangle draw_quad
|
104
|
-
flush gl clip_to record
|
105
|
-
transform translate rotate scale
|
106
|
-
button_id_to_char char_to_button_id button_down?).each do |method|
|
107
|
-
define_method method.to_sym do |*args, &block|
|
108
|
-
Gosu.send method, *args, &block
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
# Release OpenAL resources during Ruby's shutdown, not Gosu's.
|
114
|
-
at_exit do
|
115
|
-
Gosu::Song.current_song.stop if Gosu::Song.current_song
|
116
|
-
Gosu::_release_all_openal_resources
|
117
|
-
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
|
+
def self.button_id_to_char(id)
|
94
|
+
Gosu.button_id_to_char(id)
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.char_to_button_id(ch)
|
98
|
+
Gosu.char_to_button_id(ch)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Backwards compatibility:
|
102
|
+
# Instance methods taht have been turned into module methods.
|
103
|
+
%w(draw_line draw_triangle draw_quad
|
104
|
+
flush gl clip_to record
|
105
|
+
transform translate rotate scale
|
106
|
+
button_id_to_char char_to_button_id button_down?).each do |method|
|
107
|
+
define_method method.to_sym do |*args, &block|
|
108
|
+
Gosu.send method, *args, &block
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Release OpenAL resources during Ruby's shutdown, not Gosu's.
|
114
|
+
at_exit do
|
115
|
+
Gosu::Song.current_song.stop if Gosu::Song.current_song
|
116
|
+
Gosu::_release_all_openal_resources
|
117
|
+
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
|
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/lib64/2.1/gosu.so
CHANGED
Binary file
|
data/lib64/2.2/gosu.so
CHANGED
Binary file
|
data/lib64/SDL2.dll
CHANGED
Binary file
|
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.2.pre2
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Julian Raschke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
2D game development library.
|
@@ -23,12 +23,12 @@ executables: []
|
|
23
23
|
extensions: []
|
24
24
|
extra_rdoc_files: []
|
25
25
|
files:
|
26
|
+
- lib/gosu.rb
|
26
27
|
- lib/gosu/patches.rb
|
27
28
|
- lib/gosu/preview.rb
|
28
29
|
- lib/gosu/run.rb
|
29
30
|
- lib/gosu/swig_patches.rb
|
30
31
|
- lib/gosu/zen.rb
|
31
|
-
- lib/gosu.rb
|
32
32
|
- lib64/2.1/gosu.so
|
33
33
|
- lib64/2.2/gosu.so
|
34
34
|
- lib64/OpenAL32.dll
|
@@ -43,17 +43,17 @@ require_paths:
|
|
43
43
|
- lib
|
44
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 2.1.0
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 1.3.1
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.4.8
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: 2D game development library.
|