gosu 0.7.6-universal-darwin8.0 → 0.7.7-universal-darwin8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,282 @@
1
+ ## File: ChipmunkIntegration.rb
2
+ ## Author: Dirk Johnson
3
+ ## Version: 1.0.0
4
+ ## Date: 2007-10-05
5
+ ## License: Same as for Gosu (MIT)
6
+ ## Comments: Based on the Gosu Ruby Tutorial, but incorporating the Chipmunk Physics Engine
7
+
8
+ require 'rubygems'
9
+ require 'gosu'
10
+ require 'chipmunk'
11
+
12
+ SCREEN_WIDTH = 640
13
+ SCREEN_HEIGHT = 480
14
+
15
+ # The number of steps to process every Gosu update
16
+ # The Player ship can get going so fast as to "move through" a
17
+ # star without triggering a collision; an increased number of
18
+ # Chipmunk step calls per update will effectively avoid this issue
19
+ SUBSTEPS = 6
20
+
21
+ # Convenience methods for converting between Gosu degrees, radians, and Vec2 vectors
22
+ class Numeric
23
+ def gosu_to_radians
24
+ (self - 90) * Math::PI / 180.0
25
+ end
26
+
27
+ def radians_to_gosu
28
+ self * 180.0 / Math::PI + 90
29
+ end
30
+
31
+ def radians_to_vec2
32
+ CP::Vec2.new(Math::cos(self), Math::sin(self))
33
+ end
34
+ end
35
+
36
+ # Layering of sprites
37
+ module ZOrder
38
+ Background, Stars, Player, UI = *0..3
39
+ end
40
+
41
+ # This game will have one Player in the form of a ship
42
+ class Player
43
+ attr_reader :shape
44
+
45
+ def initialize(window, shape)
46
+ @image = Gosu::Image.new(window, "media/Starfighter.bmp", false)
47
+ @shape = shape
48
+ @shape.body.p = CP::Vec2.new(0.0, 0.0) # position
49
+ @shape.body.v = CP::Vec2.new(0.0, 0.0) # velocity
50
+
51
+ # Keep in mind that down the screen is positive y, which means that PI/2 radians,
52
+ # which you might consider the top in the traditional Trig unit circle sense is actually
53
+ # the bottom; thus 3PI/2 is the top
54
+ @shape.body.a = (3*Math::PI/2.0) # angle in radians; faces towards top of screen
55
+ end
56
+
57
+ # Directly set the position of our Player
58
+ def warp(vect)
59
+ @shape.body.p = vect
60
+ end
61
+
62
+ # Apply negative Torque; Chipmunk will do the rest
63
+ # SUBSTEPS is used as a divisor to keep turning rate constant
64
+ # even if the number of steps per update are adjusted
65
+ def turn_left
66
+ @shape.body.t -= 400.0/SUBSTEPS
67
+ end
68
+
69
+ # Apply positive Torque; Chipmunk will do the rest
70
+ # SUBSTEPS is used as a divisor to keep turning rate constant
71
+ # even if the number of steps per update are adjusted
72
+ def turn_right
73
+ @shape.body.t += 400.0/SUBSTEPS
74
+ end
75
+
76
+ # Apply forward force; Chipmunk will do the rest
77
+ # SUBSTEPS is used as a divisor to keep acceleration rate constant
78
+ # even if the number of steps per update are adjusted
79
+ # Here we must convert the angle (facing) of the body into
80
+ # forward momentum by creating a vector in the direction of the facing
81
+ # and with a magnitude representing the force we want to apply
82
+ def accelerate
83
+ @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (3000.0/SUBSTEPS)), CP::Vec2.new(0.0, 0.0))
84
+ end
85
+
86
+ # Apply even more forward force
87
+ # See accelerate for more details
88
+ def boost
89
+ @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (3000.0)), CP::Vec2.new(0.0, 0.0))
90
+ end
91
+
92
+ # Apply reverse force
93
+ # See accelerate for more details
94
+ def reverse
95
+ @shape.body.apply_force(-(@shape.body.a.radians_to_vec2 * (1000.0/SUBSTEPS)), CP::Vec2.new(0.0, 0.0))
96
+ end
97
+
98
+ # Wrap to the other side of the screen when we fly off the edge
99
+ def validate_position
100
+ l_position = CP::Vec2.new(@shape.body.p.x % SCREEN_WIDTH, @shape.body.p.y % SCREEN_HEIGHT)
101
+ @shape.body.p = l_position
102
+ end
103
+
104
+ def draw
105
+ @image.draw_rot(@shape.body.p.x, @shape.body.p.y, ZOrder::Player, @shape.body.a.radians_to_gosu)
106
+ end
107
+ end
108
+
109
+ # See how simple our Star is?
110
+ # Of course... it just sits around and looks good...
111
+ class Star
112
+ attr_reader :shape
113
+
114
+ def initialize(animation, shape)
115
+ @animation = animation
116
+ @color = Gosu::Color.new(0xff000000)
117
+ @color.red = rand(255 - 40) + 40
118
+ @color.green = rand(255 - 40) + 40
119
+ @color.blue = rand(255 - 40) + 40
120
+ @shape = shape
121
+ @shape.body.p = CP::Vec2.new(rand * SCREEN_WIDTH, rand * SCREEN_HEIGHT) # position
122
+ @shape.body.v = CP::Vec2.new(0.0, 0.0) # velocity
123
+ @shape.body.a = (3*Math::PI/2.0) # angle in radians; faces towards top of screen
124
+ end
125
+
126
+ def draw
127
+ img = @animation[Gosu::milliseconds / 100 % @animation.size];
128
+ img.draw(@shape.body.p.x - img.width / 2.0, @shape.body.p.y - img.height / 2.0, ZOrder::Stars, 1, 1, @color, :additive)
129
+ end
130
+ end
131
+
132
+ # The Gosu::Window is always the "environment" of our game
133
+ # It also provides the pulse of our game
134
+ class GameWindow < Gosu::Window
135
+ def initialize
136
+ super(SCREEN_WIDTH, SCREEN_HEIGHT, false, 16)
137
+ self.caption = "Gosu & Chipmunk Integration Demo"
138
+ @background_image = Gosu::Image.new(self, "media/Space.png", true)
139
+
140
+ # Put the beep here, as it is the environment now that determines collision
141
+ @beep = Gosu::Sample.new(self, "media/Beep.wav")
142
+
143
+ # Put the score here, as it is the environment that tracks this now
144
+ @score = 0
145
+ @font = Gosu::Font.new(self, Gosu::default_font_name, 20)
146
+
147
+ # Time increment over which to apply a physics "step" ("delta t")
148
+ @dt = (1.0/60.0)
149
+
150
+ # Create our Space and set its damping
151
+ # A damping of 0.8 causes the ship bleed off its force and torque over time
152
+ # This is not realistic behavior in a vacuum of space, but it gives the game
153
+ # the feel I'd like in this situation
154
+ @space = CP::Space.new
155
+ @space.damping = 0.8
156
+
157
+ # Create the Body for the Player
158
+ body = CP::Body.new(10.0, 150.0)
159
+
160
+ # In order to create a shape, we must first define it
161
+ # Chipmunk defines 3 types of Shapes: Segments, Circles and Polys
162
+ # We'll use s simple, 4 sided Poly for our Player (ship)
163
+ # You need to define the vectors so that the "top" of the Shape is towards 0 radians (the right)
164
+ shape_array = [CP::Vec2.new(-25.0, -25.0), CP::Vec2.new(-25.0, 25.0), CP::Vec2.new(25.0, 1.0), CP::Vec2.new(25.0, -1.0)]
165
+ shape = CP::Shape::Poly.new(body, shape_array, CP::Vec2.new(0,0))
166
+
167
+ # The collision_type of a shape allows us to set up special collision behavior
168
+ # based on these types. The actual value for the collision_type is arbitrary
169
+ # and, as long as it is consistent, will work for us; of course, it helps to have it make sense
170
+ shape.collision_type = :ship
171
+
172
+ @space.add_body(body)
173
+ @space.add_shape(shape)
174
+
175
+ @player = Player.new(self, shape)
176
+ @player.warp(CP::Vec2.new(320, 240)) # move to the center of the window
177
+
178
+ @star_anim = Gosu::Image::load_tiles(self, "media/Star.png", 25, 25, false)
179
+ @stars = Array.new
180
+
181
+ # Here we define what is supposed to happen when a Player (ship) collides with a Star
182
+ # I create a @remove_shapes array because we cannot remove either Shapes or Bodies
183
+ # from Space within a collision closure, rather, we have to wait till the closure
184
+ # is through executing, then we can remove the Shapes and Bodies
185
+ # In this case, the Shapes and the Bodies they own are removed in the Gosu::Window.update phase
186
+ # by iterating over the @remove_shapes array
187
+ # Also note that both Shapes involved in the collision are passed into the closure
188
+ # in the same order that their collision_types are defined in the add_collision_func call
189
+ @remove_shapes = []
190
+ @space.add_collision_func(:ship, :star) do |ship_shape, star_shape|
191
+ @score += 10
192
+ @beep.play
193
+ @remove_shapes << star_shape
194
+ end
195
+
196
+ # Here we tell Space that we don't want one star bumping into another
197
+ # The reason we need to do this is because when the Player hits a Star,
198
+ # the Star will travel until it is removed in the update cycle below
199
+ # which means it may collide and therefore push other Stars
200
+ # To see the effect, remove this line and play the game, every once in a while
201
+ # you'll see a Star moving
202
+ @space.add_collision_func(:star, :star, &nil)
203
+ end
204
+
205
+ def update
206
+ # Step the physics environment SUBSTEPS times each update
207
+ SUBSTEPS.times do
208
+ # This iterator makes an assumption of one Shape per Star making it safe to remove
209
+ # each Shape's Body as it comes up
210
+ # If our Stars had multiple Shapes, as would be required if we were to meticulously
211
+ # define their true boundaries, we couldn't do this as we would remove the Body
212
+ # multiple times
213
+ # We would probably solve this by creating a separate @remove_bodies array to remove the Bodies
214
+ # of the Stars that were gathered by the Player
215
+ @remove_shapes.each do |shape|
216
+ @stars.delete_if { |star| star.shape == shape }
217
+ @space.remove_body(shape.body)
218
+ @space.remove_shape(shape)
219
+ end
220
+ @remove_shapes.clear # clear out the shapes for next pass
221
+
222
+ # When a force or torque is set on a Body, it is cumulative
223
+ # This means that the force you applied last SUBSTEP will compound with the
224
+ # force applied this SUBSTEP; which is probably not the behavior you want
225
+ # We reset the forces on the Player each SUBSTEP for this reason
226
+ @player.shape.body.reset_forces
227
+
228
+ # Wrap around the screen to the other side
229
+ @player.validate_position
230
+
231
+ # Check keyboard
232
+ if button_down? Gosu::Button::KbLeft
233
+ @player.turn_left
234
+ end
235
+ if button_down? Gosu::Button::KbRight
236
+ @player.turn_right
237
+ end
238
+
239
+ if button_down? Gosu::Button::KbUp
240
+ if ( (button_down? Gosu::Button::KbRightShift) || (button_down? Gosu::Button::KbLeftShift) )
241
+ @player.boost
242
+ else
243
+ @player.accelerate
244
+ end
245
+ elsif button_down? Gosu::Button::KbDown
246
+ @player.reverse
247
+ end
248
+
249
+ # Perform the step over @dt period of time
250
+ # For best performance @dt should remain consistent for the game
251
+ @space.step(@dt)
252
+ end
253
+
254
+ # Each update (not SUBSTEP) we see if we need to add more Stars
255
+ if rand(100) < 4 and @stars.size < 25 then
256
+ body = CP::Body.new(0.0001, 0.0001)
257
+ shape = CP::Shape::Circle.new(body, 25/2, CP::Vec2.new(0.0, 0.0))
258
+ shape.collision_type = :star
259
+
260
+ @space.add_body(body)
261
+ @space.add_shape(shape)
262
+
263
+ @stars.push(Star.new(@star_anim, shape))
264
+ end
265
+ end
266
+
267
+ def draw
268
+ @background_image.draw(0, 0, ZOrder::Background)
269
+ @player.draw
270
+ @stars.each { |star| star.draw }
271
+ @font.draw("Score: #{@score}", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)
272
+ end
273
+
274
+ def button_down(id)
275
+ if id == Gosu::Button::KbEscape
276
+ close
277
+ end
278
+ end
279
+ end
280
+
281
+ window = GameWindow.new
282
+ window.show
data/examples/CptnRuby.rb CHANGED
@@ -1,10 +1,3 @@
1
- begin
2
- # In case you use Gosu via rubygems.
3
- require 'rubygems'
4
- rescue LoadError
5
- # In case you don't.
6
- end
7
-
8
1
  # Basically, the tutorial game taken to a jump'n'run perspective.
9
2
 
10
3
  # Shows how to
@@ -32,6 +25,13 @@ end
32
25
  # ...Enemies, a more sophisticated object system, weapons, title and credits
33
26
  # screens...
34
27
 
28
+ begin
29
+ # In case you use Gosu via rubygems.
30
+ require 'rubygems'
31
+ rescue LoadError
32
+ # In case you don't.
33
+ end
34
+
35
35
  require 'gosu'
36
36
  include Gosu
37
37
 
@@ -0,0 +1,232 @@
1
+ # The tutorial game over a landscape rendered with OpenGL.
2
+ # Basically shows how arbitrary OpenGL calls can be put into
3
+ # the block given to Window#gl, and that Gosu Images can be
4
+ # used as textures using the gl_tex_info call.
5
+
6
+ begin
7
+ # In case you use Gosu via RubyGems.
8
+ require 'rubygems'
9
+ rescue LoadError
10
+ # In case you don't.
11
+ end
12
+
13
+ require 'gosu'
14
+ require 'gl'
15
+ require 'glu'
16
+
17
+ include Gl
18
+ include Glu
19
+
20
+ module ZOrder
21
+ Stars, Player, UI = *0..3
22
+ end
23
+
24
+ # The only really new class here.
25
+ # Draws a scrolling, repeating texture with a randomized height map.
26
+ class GLBackground
27
+ # Height map size
28
+ POINTS_X = 7
29
+ POINTS_Y = 7
30
+ # Scrolling speed
31
+ SCROLLS_PER_STEP = 50
32
+
33
+ def initialize(window)
34
+ @image = Gosu::Image.new(window, "media/Earth.png", true)
35
+ @scrolls = 0
36
+ @height_map = Array.new(POINTS_Y) { Array.new(POINTS_X) { rand } }
37
+ end
38
+
39
+ def scroll
40
+ @scrolls += 1
41
+ if @scrolls == SCROLLS_PER_STEP then
42
+ @scrolls = 0
43
+ @height_map.shift
44
+ @height_map.push Array.new(POINTS_X) { rand }
45
+ end
46
+ end
47
+
48
+ def exec_gl
49
+ # Get the name of the OpenGL texture the Image resides on, and the
50
+ # u/v coordinates of the rect it occupies.
51
+ # gl_tex_info can return nil if the image was too large to fit onto
52
+ # a single OpenGL texture and was internally split up.
53
+ info = @image.gl_tex_info
54
+ return unless info
55
+
56
+ # Pretty straightforward OpenGL code.
57
+
58
+ glDepthFunc(GL_GEQUAL)
59
+ glEnable(GL_DEPTH_TEST)
60
+ glEnable(GL_BLEND)
61
+
62
+ glMatrixMode(GL_PROJECTION)
63
+ glLoadIdentity
64
+ glFrustum(-0.10, 0.10, -0.075, 0.075, 1, 100)
65
+
66
+ glMatrixMode(GL_MODELVIEW)
67
+ glLoadIdentity
68
+ glTranslate(0, 0, -4)
69
+
70
+ glEnable(GL_TEXTURE_2D)
71
+ glBindTexture(GL_TEXTURE_2D, info.tex_name)
72
+
73
+ offs_y = 1.0 * @scrolls / SCROLLS_PER_STEP
74
+
75
+ 0.upto(POINTS_Y - 2) do |y|
76
+ 0.upto(POINTS_X - 2) do |x|
77
+ glBegin(GL_TRIANGLE_STRIP)
78
+ z = @height_map[y][x]
79
+ glColor4d(1, 1, 1, z)
80
+ glTexCoord2d(info.left, info.top)
81
+ glVertex3d(-0.5 + (x - 0.0) / (POINTS_X-1), -0.5 + (y - offs_y - 0.0) / (POINTS_Y-2), z)
82
+
83
+ z = @height_map[y+1][x]
84
+ glColor4d(1, 1, 1, z)
85
+ glTexCoord2d(info.left, info.bottom)
86
+ glVertex3d(-0.5 + (x - 0.0) / (POINTS_X-1), -0.5 + (y - offs_y + 1.0) / (POINTS_Y-2), z)
87
+
88
+ z = @height_map[y][x + 1]
89
+ glColor4d(1, 1, 1, z)
90
+ glTexCoord2d(info.right, info.top)
91
+ glVertex3d(-0.5 + (x + 1.0) / (POINTS_X-1), -0.5 + (y - offs_y - 0.0) / (POINTS_Y-2), z)
92
+
93
+ z = @height_map[y+1][x + 1]
94
+ glColor4d(1, 1, 1, z)
95
+ glTexCoord2d(info.right, info.bottom)
96
+ glVertex3d(-0.5 + (x + 1.0) / (POINTS_X-1), -0.5 + (y - offs_y + 1.0) / (POINTS_Y-2), z)
97
+ glEnd
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ # Roughly adapted from the tutorial game. Always faces north.
104
+ class Player
105
+ Speed = 7
106
+
107
+ attr_reader :score
108
+
109
+ def initialize(window, x, y)
110
+ @image = Gosu::Image.new(window, "media/Starfighter.bmp", false)
111
+ @beep = Gosu::Sample.new(window, "media/Beep.wav")
112
+ @x, @y = x, y
113
+ @score = 0
114
+ end
115
+
116
+ def move_left
117
+ @x = [@x - Speed, 0].max
118
+ end
119
+
120
+ def move_right
121
+ @x = [@x + Speed, 800].min
122
+ end
123
+
124
+ def accelerate
125
+ @y = [@y - Speed, 50].max
126
+ end
127
+
128
+ def brake
129
+ @y = [@y + Speed, 600].min
130
+ end
131
+
132
+ def draw
133
+ @image.draw(@x - @image.width / 2, @y - @image.height / 2, ZOrder::Player)
134
+ end
135
+
136
+ def collect_stars(stars)
137
+ stars.reject! do |star|
138
+ if Gosu::distance(@x, @y, star.x, star.y) < 35 then
139
+ @score += 10
140
+ @beep.play
141
+ true
142
+ else
143
+ false
144
+ end
145
+ end
146
+ end
147
+ end
148
+
149
+ # Also taken from the tutorial, but drawn with draw_rot and an increasing angle
150
+ # for extra rotation coolness!
151
+ class Star
152
+ attr_reader :x, :y
153
+
154
+ def initialize(animation)
155
+ @animation = animation
156
+ @color = Gosu::Color.new(0xff000000)
157
+ @color.red = rand(255 - 40) + 40
158
+ @color.green = rand(255 - 40) + 40
159
+ @color.blue = rand(255 - 40) + 40
160
+ @x = rand * 800
161
+ @y = 0
162
+ end
163
+
164
+ def draw
165
+ img = @animation[Gosu::milliseconds / 100 % @animation.size];
166
+ img.draw_rot(@x, @y, ZOrder::Stars, @y, 0.5, 0.5, 1, 1, @color, :additive)
167
+ end
168
+
169
+ def update
170
+ # Move towards bottom of screen
171
+ @y += 3
172
+ # Return false when out of screen (gets deleted then)
173
+ @y < 650
174
+ end
175
+ end
176
+
177
+ class GameWindow < Gosu::Window
178
+ def initialize
179
+ super(800, 600, false)
180
+ self.caption = "Gosu & OpenGL Integration Demo"
181
+
182
+ @gl_background = GLBackground.new(self)
183
+
184
+ @player = Player.new(self, 400, 500)
185
+
186
+ @star_anim = Gosu::Image::load_tiles(self, "media/Star.png", 25, 25, false)
187
+ @stars = Array.new
188
+
189
+ @font = Gosu::Font.new(self, Gosu::default_font_name, 20)
190
+ end
191
+
192
+ def update
193
+ @player.move_left if button_down? Gosu::Button::KbLeft or button_down? Gosu::Button::GpLeft
194
+ @player.move_right if button_down? Gosu::Button::KbRight or button_down? Gosu::Button::GpRight
195
+ @player.accelerate if button_down? Gosu::Button::KbUp or button_down? Gosu::Button::GpUp
196
+ @player.brake if button_down? Gosu::Button::KbDown or button_down? Gosu::Button::GpDown
197
+
198
+ @player.collect_stars(@stars)
199
+
200
+ @stars.reject! { |star| !star.update }
201
+
202
+ @gl_background.scroll
203
+
204
+ @stars.push(Star.new(@star_anim)) if rand(20) == 0
205
+ end
206
+
207
+ def draw
208
+ # gl will execute the given block in a clean OpenGL environment, then reset
209
+ # everything so Gosu's rendering can take place again.
210
+
211
+ gl do
212
+ glClearColor(0.0, 0.2, 0.5, 1.0)
213
+ glClearDepth(0)
214
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
215
+
216
+ @gl_background.exec_gl
217
+ end
218
+
219
+ @player.draw
220
+ @stars.each { |star| star.draw }
221
+ @font.draw("Score: #{@player.score}", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)
222
+ end
223
+
224
+ def button_down(id)
225
+ if id == Gosu::Button::KbEscape
226
+ close
227
+ end
228
+ end
229
+ end
230
+
231
+ window = GameWindow.new
232
+ window.show
@@ -1,10 +1,3 @@
1
- begin
2
- # In case you use Gosu via RubyGems.
3
- require 'rubygems'
4
- rescue LoadError
5
- # In case you don't.
6
- end
7
-
8
1
  # A (too) simple Gorilla-style shooter for two players.
9
2
  # Shows how Gosu and RMagick can be used together to generate a map, implement
10
3
  # a dynamic landscape and generally look great.
@@ -18,6 +11,13 @@ end
18
11
  # * The look of dead soldiers is, err, by accident. Soldier.png needs to be
19
12
  # designed in a less obfuscated way :)
20
13
 
14
+ begin
15
+ # In case you use Gosu via RubyGems.
16
+ require 'rubygems'
17
+ rescue LoadError
18
+ # In case you don't.
19
+ end
20
+
21
21
  require 'gosu'
22
22
  require 'rmagick'
23
23
 
@@ -130,12 +130,14 @@ class Map
130
130
  top = (y - SH_RADIUS) / TILE_SIZE
131
131
  bottom = (y + SH_RADIUS) / TILE_SIZE
132
132
 
133
- # Set affected images to nil. (A 'double-free' doesn't hurt!)
133
+ # Set affected images to nil.
134
+ # A 'double-free' doesn't hurt if e.g. left == right! However, we have to watch out
135
+ # for out-of-bounds errors.
134
136
 
135
- @gosu_images[left][top] = nil
136
- @gosu_images[right][top] = nil
137
- @gosu_images[left][bottom] = nil
138
- @gosu_images[right][bottom] = nil
137
+ @gosu_images[left][top] = nil unless left < 0 or top < 0
138
+ @gosu_images[right][top] = nil unless right >= TILES_X or top < 0
139
+ @gosu_images[left][bottom] = nil unless left < 0 or bottom >= TILES_Y
140
+ @gosu_images[right][bottom] = nil unless right >= TILES_X or bottom >= TILES_Y
139
141
 
140
142
  # Create the crater image (basically a circle shape that is used to erase
141
143
  # parts of the map) and the crater shadow image, if they don't exist
@@ -364,7 +366,7 @@ class GameWindow < Gosu::Window
364
366
 
365
367
  def initialize()
366
368
  super(800, 600, false)
367
- self.caption = "Medal of Anna - Gosu & RMagick integration demo"
369
+ self.caption = "Medal of Anna - Gosu & RMagick Integration Demo"
368
370
 
369
371
  # Texts to display in the appropriate situations.
370
372
  @player_instructions = []
data/examples/Tutorial.rb CHANGED
@@ -79,7 +79,7 @@ class Star
79
79
  end
80
80
 
81
81
  def draw
82
- img = @animation[Gosu::milliseconds / 100 % @animation.size];
82
+ img = @animation[Gosu::milliseconds / 100 % @animation.size]
83
83
  img.draw(@x - img.width / 2.0, @y - img.height / 2.0,
84
84
  ZOrder::Stars, 1, 1, @color, :additive)
85
85
  end
@@ -127,7 +127,7 @@ class GameWindow < Gosu::Window
127
127
  end
128
128
 
129
129
  def button_down(id)
130
- if id == Gosu::Button::KbEscape
130
+ if id == Gosu::Button::KbEscape then
131
131
  close
132
132
  end
133
133
  end
data/lib/gosu.bundle CHANGED
Binary file
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: gosu
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.6
7
- date: 2007-09-29 00:00:00 +02:00
6
+ version: 0.7.7
7
+ date: 2007-10-29 00:00:00 +01:00
8
8
  summary: 2D game development library.
9
9
  require_paths:
10
10
  - lib
11
11
  email: julian@raschke.de
12
12
  homepage: http://code.google.com/p/gosu/
13
13
  rubyforge_project:
14
- description: 2D game development library. The library features easy to use and game-friendly interfaces to 2D graphics and text (accelerated by 3D hardware), sound samples and music as well as keyboard, mouse and gamepad/joystick input. Integrates with RMagick.
14
+ description: 2D game development library. The library features easy to use and game-friendly interfaces to 2D graphics and text (accelerated by 3D hardware), sound samples and music as well as keyboard, mouse and gamepad/joystick input. Includes demos for integration with RMagick, Chipmunk and Ruby-OpenGL.
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -30,27 +30,14 @@ authors:
30
30
  - Julian Raschke
31
31
  - Jan Luecker
32
32
  files:
33
- - examples/media/Beep.wav
34
- - examples/media/CptnRuby Gem.png
35
- - examples/media/CptnRuby Map.txt
36
- - examples/media/CptnRuby Tileset.bmp
37
- - examples/media/CptnRuby Tileset.png
38
- - examples/media/CptnRuby.png
39
- - examples/media/Earth.png
40
- - examples/media/Explosion.wav
41
- - examples/media/LargeStar.png
42
- - examples/media/Sky.jpg
43
- - examples/media/Smoke.png
44
- - examples/media/Soldier.png
45
- - examples/media/Space.png
46
- - examples/media/Star.png
47
- - examples/media/Starfighter.bmp
48
- - examples/Tutorial.rb
49
- - examples/CptnRuby.rb
50
- - examples/RMagickIntegration.rb
51
33
  - lib/gosu.bundle
52
34
  - README
53
35
  - LICENSE
36
+ - examples/ChipmunkIntegration.rb
37
+ - examples/CptnRuby.rb
38
+ - examples/OpenGLIntegration.rb
39
+ - examples/RMagickIntegration.rb
40
+ - examples/Tutorial.rb
54
41
  test_files: []
55
42
 
56
43
  rdoc_options: []
Binary file
Binary file
@@ -1,25 +0,0 @@
1
- #....................................................#
2
- #....................................................#
3
- #.............xx......x.x............................#
4
- #............x..x....................................#
5
- #x....x...x..x.......#####..xxx....................x.#
6
- #.x.........................xxx.........##.........x.#
7
- #...............""..........###...##..........##.....#
8
- #..##..###..##..##...................................#
9
- #........................................xx........###
10
- #.............................###....................#
11
- ##....##.............................................#
12
- #....................##....##......##....##....##....#
13
- #.................................................x..#
14
- #...x....##....##.......x...x.....................x..#
15
- #.....x...............x...x...x...................x..#
16
- #......x...##.....##.................................#
17
- #.......x.........................................#..#
18
- #...........##........#...#...#..#.......x...........#
19
- #...#................................................#
20
- #....."""".................x.......#..#####...###....#
21
- #x....#......................##......................#
22
- #"""""#.....#.....x..................#...............#
23
- ##xxxx......#........................................#
24
- ##xxxx...#####............."...""""".................#
25
- ######"""#############################################
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file