gosu 0.7.20-i386-mingw32 → 0.7.21-i386-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/examples/CptnRuby.rb +27 -28
- data/lib/gosu.for_1_8.so +0 -0
- data/lib/gosu.for_1_9.so +0 -0
- data/lib/gosu.rb +1 -1
- metadata +19 -5
data/examples/CptnRuby.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Shows how to
|
4
4
|
# * implement jumping/gravity
|
5
|
-
# * implement scrolling
|
5
|
+
# * implement scrolling using Window#translate
|
6
6
|
# * implement a simple tile-based map
|
7
7
|
# * load levels from primitive text files
|
8
8
|
|
@@ -25,14 +25,15 @@
|
|
25
25
|
# ...Enemies, a more sophisticated object system, weapons, title and credits
|
26
26
|
# screens...
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
require '../lib/gosu'
|
29
|
+
# begin
|
30
|
+
# # In case you use Gosu via rubygems.
|
31
|
+
# require 'rubygems'
|
32
|
+
# rescue LoadError
|
33
|
+
# # In case you don't.
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# require 'gosu'
|
36
37
|
include Gosu
|
37
38
|
|
38
39
|
module Tiles
|
@@ -48,10 +49,9 @@ class CollectibleGem
|
|
48
49
|
@x, @y = x, y
|
49
50
|
end
|
50
51
|
|
51
|
-
def draw
|
52
|
+
def draw
|
52
53
|
# Draw, slowly rotating
|
53
|
-
@image.draw_rot(@x
|
54
|
-
25 * Math.sin(milliseconds / 133.7))
|
54
|
+
@image.draw_rot(@x, @y, 0, 25 * Math.sin(milliseconds / 133.7))
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -72,7 +72,7 @@ class CptnRuby
|
|
72
72
|
@cur_image = @standing
|
73
73
|
end
|
74
74
|
|
75
|
-
def draw
|
75
|
+
def draw
|
76
76
|
# Flip vertically when facing to the left.
|
77
77
|
if @dir == :left then
|
78
78
|
offs_x = -25
|
@@ -81,7 +81,7 @@ class CptnRuby
|
|
81
81
|
offs_x = 25
|
82
82
|
factor = -1.0
|
83
83
|
end
|
84
|
-
@cur_image.draw(@x
|
84
|
+
@cur_image.draw(@x + offs_x, @y - 49, 0, factor, 1.0)
|
85
85
|
end
|
86
86
|
|
87
87
|
# Could the object be placed at x + offs_x/y + offs_y without being stuck?
|
@@ -146,7 +146,6 @@ class Map
|
|
146
146
|
def initialize(window, filename)
|
147
147
|
# Load 60x60 tiles, 5px overlap in all four directions.
|
148
148
|
@tileset = Image.load_tiles(window, "media/CptnRuby Tileset.png", 60, 60, true)
|
149
|
-
@sky = Image.new(window, "media/Space.png", true)
|
150
149
|
|
151
150
|
gem_img = Image.new(window, "media/CptnRuby Gem.png", false)
|
152
151
|
@gems = []
|
@@ -171,11 +170,7 @@ class Map
|
|
171
170
|
end
|
172
171
|
end
|
173
172
|
|
174
|
-
def draw
|
175
|
-
# Sigh, stars!
|
176
|
-
@sky.draw(0, 0, 0)
|
177
|
-
|
178
|
-
|
173
|
+
def draw
|
179
174
|
# Very primitive drawing function:
|
180
175
|
# Draws all the tiles, some off-screen, some on-screen.
|
181
176
|
@height.times do |y|
|
@@ -184,11 +179,11 @@ class Map
|
|
184
179
|
if tile
|
185
180
|
# Draw the tile with an offset (tile images have some overlap)
|
186
181
|
# Scrolling is implemented here just as in the game objects.
|
187
|
-
@tileset[tile].draw(x * 50 -
|
182
|
+
@tileset[tile].draw(x * 50 - 5, y * 50 - 5, 0)
|
188
183
|
end
|
189
184
|
end
|
190
185
|
end
|
191
|
-
@gems.each { |c| c.draw
|
186
|
+
@gems.each { |c| c.draw }
|
192
187
|
end
|
193
188
|
|
194
189
|
# Solid at a given pixel position?
|
@@ -203,10 +198,11 @@ class Game < Window
|
|
203
198
|
def initialize
|
204
199
|
super(640, 480, false)
|
205
200
|
self.caption = "Cptn. Ruby"
|
201
|
+
@sky = Image.new(self, "media/Space.png", true)
|
206
202
|
@map = Map.new(self, "media/CptnRuby Map.txt")
|
207
203
|
@cptn = CptnRuby.new(self, 400, 100)
|
208
|
-
#
|
209
|
-
@
|
204
|
+
# The scrolling position is stored as top left corner of the screen.
|
205
|
+
@camera_x = @camera_y = 0
|
210
206
|
end
|
211
207
|
def update
|
212
208
|
move_x = 0
|
@@ -215,12 +211,15 @@ class Game < Window
|
|
215
211
|
@cptn.update(move_x)
|
216
212
|
@cptn.collect_gems(@map.gems)
|
217
213
|
# Scrolling follows player
|
218
|
-
@
|
219
|
-
@
|
214
|
+
@camera_x = [[@cptn.x - 320, 0].max, @map.width * 50 - 640].min
|
215
|
+
@camera_y = [[@cptn.y - 240, 0].max, @map.height * 50 - 480].min
|
220
216
|
end
|
221
217
|
def draw
|
222
|
-
@
|
223
|
-
|
218
|
+
@sky.draw 0, 0, 0
|
219
|
+
translate(-@camera_x, -@camera_y) do
|
220
|
+
@map.draw
|
221
|
+
@cptn.draw
|
222
|
+
end
|
224
223
|
end
|
225
224
|
def button_down(id)
|
226
225
|
if id == KbUp then @cptn.try_to_jump end
|
data/lib/gosu.for_1_8.so
CHANGED
Binary file
|
data/lib/gosu.for_1_9.so
CHANGED
Binary file
|
data/lib/gosu.rb
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
require "#{File.dirname(__FILE__)}/gosu.for_#{version}.#{Config::CONFIG['DLEXT']}"
|
10
10
|
require "#{File.dirname(__FILE__)}/gosu/swig_patches.rb"
|
11
11
|
rescue LoadError => e
|
12
|
-
require "#{File.dirname(__FILE__)}/gosu
|
12
|
+
require "#{File.dirname(__FILE__)}/gosu.#{Config::CONFIG['DLEXT']}"
|
13
13
|
require "#{File.dirname(__FILE__)}/gosu/swig_patches.rb"
|
14
14
|
end
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 41
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 21
|
10
|
+
version: 0.7.21
|
5
11
|
platform: i386-mingw32
|
6
12
|
authors:
|
7
13
|
- Julian Raschke
|
@@ -10,7 +16,7 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date: 2010-
|
19
|
+
date: 2010-06-13 00:00:00 +08:00
|
14
20
|
default_executable:
|
15
21
|
dependencies: []
|
16
22
|
|
@@ -63,21 +69,29 @@ rdoc_options: []
|
|
63
69
|
require_paths:
|
64
70
|
- lib
|
65
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
66
73
|
requirements:
|
67
74
|
- - ">="
|
68
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 51
|
77
|
+
segments:
|
78
|
+
- 1
|
79
|
+
- 8
|
80
|
+
- 2
|
69
81
|
version: 1.8.2
|
70
|
-
version:
|
71
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
72
84
|
requirements:
|
73
85
|
- - ">="
|
74
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
75
90
|
version: "0"
|
76
|
-
version:
|
77
91
|
requirements: []
|
78
92
|
|
79
93
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.3.
|
94
|
+
rubygems_version: 1.3.7
|
81
95
|
signing_key:
|
82
96
|
specification_version: 3
|
83
97
|
summary: 2D game development library.
|