gosu 0.7.36-i386-mingw32 → 0.7.36.1-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
  #define GOSU_MAJOR_VERSION 0
5
5
  #define GOSU_MINOR_VERSION 7
6
6
  #define GOSU_POINT_VERSION 36
7
- #define GOSU_VERSION "0.7.36"
7
+ #define GOSU_VERSION "0.7.36.1"
8
8
 
9
9
  #define GOSU_COPYRIGHT_NOTICE \
10
10
  "May contain `ogg', `vorbis' libraries (c) 2002-2008 Xiph.org Foundation" \
@@ -0,0 +1,75 @@
1
+ # Extend Numeric with simple angle conversion methods.
2
+ class ::Numeric
3
+ def degrees_to_radians
4
+ self * Math::PI / 180.0
5
+ end
6
+ def radians_to_degrees
7
+ self * 180.0 / Math::PI
8
+ end
9
+ def gosu_to_radians
10
+ (self - 90) * Math::PI / 180.0
11
+ end
12
+ def radians_to_gosu
13
+ self * 180.0 / Math::PI + 90
14
+ end
15
+ end
16
+
17
+ # Backwards compatibility: import constants into Gosu::Button.
18
+ module Gosu::Button
19
+ Gosu.constants.each { |c| const_set(c, Gosu.const_get(c)) }
20
+ end
21
+
22
+ # Backwards compatibility: Window arguments to Sample and Song
23
+ class Gosu::Sample
24
+ alias initialize_ initialize
25
+
26
+ def initialize(*args)
27
+ args.shift if args.first.is_a? Gosu::Window
28
+ initialize_(*args)
29
+ end
30
+ end
31
+ class Gosu::Song
32
+ alias initialize_ initialize
33
+
34
+ def initialize(*args)
35
+ args.shift if args.first.is_a? Gosu::Window
36
+ initialize_(*args)
37
+ end
38
+ end
39
+
40
+ # Color constants (SWIG messes up constants somehow)
41
+ class Gosu::Color
42
+ class Constant < Gosu::Color
43
+ private
44
+ def alpha=; end
45
+ def red=; end
46
+ def green=; end
47
+ def blue=; end
48
+ def hue=; end
49
+ def saturation=; end
50
+ def value=; end
51
+ end
52
+
53
+ NONE = Gosu::Color::Constant.argb(0x00000000)
54
+ BLACK = Gosu::Color::Constant.argb(0xff000000)
55
+ GRAY = Gosu::Color::Constant.argb(0xff808080)
56
+ WHITE = Gosu::Color::Constant.argb(0xffffffff)
57
+ AQUA = Gosu::Color::Constant.argb(0xff00ffff)
58
+ RED = Gosu::Color::Constant.argb(0xffff0000)
59
+ GREEN = Gosu::Color::Constant.argb(0xff00ff00)
60
+ BLUE = Gosu::Color::Constant.argb(0xff0000ff)
61
+ YELLOW = Gosu::Color::Constant.argb(0xffffff00)
62
+ FUCHSIA = Gosu::Color::Constant.argb(0xffff00ff)
63
+ CYAN = Gosu::Color::Constant.argb(0xff00ffff)
64
+ end
65
+
66
+ # Instance methods for button_id_to_char and char_to_button_id
67
+ class Gosu::Window
68
+ def button_id_to_char(id)
69
+ self.class.button_id_to_char(id)
70
+ end
71
+
72
+ def char_to_button_id(ch)
73
+ self.class.char_to_button_id(ch)
74
+ end
75
+ end
@@ -0,0 +1,116 @@
1
+ require 'gosu'
2
+
3
+ # Wrapper around Gosu 0.7 that provides the work-in-progress 0.8 interface
4
+
5
+ module Gosu
6
+ class Font
7
+ alias :initialize07 :initialize
8
+
9
+ def initialize *args
10
+ if args.first.is_a? Gosu::Window then
11
+ initialize07 *args
12
+ else
13
+ height = args[0]
14
+ options = args[1] || {}
15
+ name = options[:name] || Gosu::default_font_name
16
+ initialize07 $window, name, height
17
+ end
18
+ end
19
+ end
20
+
21
+ class Window
22
+ alias :initialize07 :initialize
23
+
24
+ def initialize width, height, *args
25
+ if args.empty? or args.first.is_a? Hash then
26
+ options = args.first || {}
27
+ fullscreen = !!options[:fullscreen]
28
+ update_interval = options[:update_interval] || 16.66
29
+ else
30
+ fullscreen, update_interval = *args
31
+ end
32
+ $window = initialize07 width, height, fullscreen, update_interval
33
+ end
34
+ end
35
+
36
+ class Image
37
+ alias :initialize07 :initialize
38
+
39
+ def initialize *args
40
+ if args.first.is_a? Gosu::Window then
41
+ initialize07 *args
42
+ else
43
+ source = args[0]
44
+ tileable = !args[1] || args[1][:tileable]
45
+ initialize07 $window, source, !!tileable
46
+ end
47
+ end
48
+
49
+ class <<self
50
+ alias load_tiles07 load_tiles
51
+ end
52
+
53
+ def self.load_tiles *args
54
+ if args.first.is_a? Gosu::Window then
55
+ load_tiles07 *args
56
+ else
57
+ source = args[0]
58
+ x, y = args[1..2]
59
+ tileable = !args[3] || args[3][:tileable]
60
+ load_tiles07 $window, source, x, y, !!tileable
61
+ end
62
+ end
63
+
64
+ def self.from_text *args
65
+ if args.first.is_a? Gosu::Window then
66
+ args.size == 4 ? from_text4(*args) : from_text7(*args)
67
+ else
68
+ text = args[0]
69
+ height = args[1]
70
+ options = args[2] || {}
71
+ font = options[:font] || Gosu::default_font_name
72
+ if width = options[:width] then
73
+ spacing = options[:spacing] || 0
74
+ align = options[:align] || :left
75
+ Gosu::Image.from_text7 $window, text, font, height, spacing, width, align
76
+ else
77
+ Gosu::Image.from_text4 $window, text, font, height
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ def self.draw_quad *args
84
+ $window.draw_quad *args
85
+ end
86
+
87
+ def self.clip_to *args
88
+ $window.clip_to *args do
89
+ yield
90
+ end
91
+ end
92
+
93
+ def self.translate *args
94
+ $window.translate *args do
95
+ yield
96
+ end
97
+ end
98
+
99
+ def self.scale *args
100
+ $window.scale *args do
101
+ yield
102
+ end
103
+ end
104
+
105
+ def self.rotate *args
106
+ $window.rotate *args do
107
+ yield
108
+ end
109
+ end
110
+
111
+ def self.transform *args
112
+ $window.transform *args do
113
+ yield
114
+ end
115
+ end
116
+ end
@@ -0,0 +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'
@@ -0,0 +1,43 @@
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
+ %w(update draw needs_redraw? needs_cursor?
10
+ lose_focus button_down button_up).each do |callback|
11
+ define_method "protected_#{callback}" do |*args|
12
+ begin
13
+ # Turn into a boolean result for needs_cursor? etc while we are at it.
14
+ # If there has been an exception, don't do anything as to not make matters worse.
15
+ defined?(@_exception) ? false : !!send(callback, *args)
16
+ rescue Exception => e
17
+ # Exit the message loop naturally, then re-throw
18
+ @_exception = e
19
+ close
20
+ end
21
+ end
22
+ end
23
+
24
+ alias show_internal show
25
+ def show
26
+ show_internal
27
+ # Try to format the message nicely, without any useless patching that we are
28
+ # doing here.
29
+ if defined? @_exception then
30
+ if @_exception.backtrace.is_a? Array and not @_exception.backtrace.frozen? then
31
+ @_exception.backtrace.reject! { |line| line.include? 'lib/gosu/swig_patches.rb' }
32
+ end
33
+ raise @_exception
34
+ end
35
+ end
36
+ end
37
+
38
+ # SWIG doesn't understand the C++ overloading, so we need this simple check in Ruby.
39
+ class Gosu::Image
40
+ def self.from_text(*args)
41
+ args.size == 4 ? from_text4(*args) : from_text7(*args)
42
+ end
43
+ end
@@ -0,0 +1,28 @@
1
+ require 'gosu'
2
+ require 'singleton'
3
+
4
+ module Gosu
5
+ class ZenWindow < Window
6
+ include Singleton
7
+
8
+ def initialize
9
+ super 800, 600, false
10
+ end
11
+ end
12
+ end
13
+
14
+ def set what, value
15
+ Gosu::ZenWindow.instance.send "#{what}=", value
16
+ end
17
+
18
+ def update(&proc)
19
+ Gosu::ZenWindow.send :define_method, :update, proc
20
+ end
21
+
22
+ # WIP - needs all other callbacks, even with arguments
23
+
24
+ # WIP - needs to be compatible with gosu/preview.rb later
25
+
26
+ at_exit do
27
+ Gosu::ZenWindow.instance.show
28
+ end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 75
4
+ hash: 229
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
9
  - 36
10
- version: 0.7.36
10
+ - 1
11
+ version: 0.7.36.1
11
12
  platform: i386-mingw32
12
13
  authors:
13
14
  - Julian Raschke
@@ -59,6 +60,11 @@ files:
59
60
  - Gosu/Version.hpp
60
61
  - Gosu/Window.hpp
61
62
  - Gosu/WinUtility.hpp
63
+ - lib/gosu/patches.rb
64
+ - lib/gosu/preview.rb
65
+ - lib/gosu/run.rb
66
+ - lib/gosu/swig_patches.rb
67
+ - lib/gosu/zen.rb
62
68
  - lib/gosu.rb
63
69
  - examples/ChipmunkIntegration.rb
64
70
  - examples/CptnRuby.rb
@@ -118,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
124
  requirements: []
119
125
 
120
126
  rubyforge_project:
121
- rubygems_version: 1.8.7
127
+ rubygems_version: 1.8.9
122
128
  signing_key:
123
129
  specification_version: 3
124
130
  summary: 2D game development library.