minigl 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/data/tileset/tileset1.png +0 -0
- data/lib/minigl/global.rb +9 -6
- data/test/res_tests.rb +22 -0
- metadata +16 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 820be7bb9e24c286a9ca663fbf70cc370a0d11a2
|
4
|
+
data.tar.gz: f372d5c224eff4a4626ab37927046e95a1856b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f74e6b225327cd6698ad5fefb440f6d7fdac65f03cc5ef5a316fd8cff853739c5a116d6c613c31a343142246efa1fd2a4bfdbe1ae6d7b12ef899d85f3d39ec89
|
7
|
+
data.tar.gz: bd8055ded3952b4029e44ec6710a52146fb54a04b2a6e89e3edcf1228b3fdda045270f62b82b1881b3cd6afb50b184fec644d73ac182dc504e63476a6d15ec90
|
Binary file
|
data/lib/minigl/global.rb
CHANGED
@@ -164,6 +164,8 @@ module AGL
|
|
164
164
|
def self.initialize
|
165
165
|
@@imgs = Hash.new
|
166
166
|
@@global_imgs = Hash.new
|
167
|
+
@@tilesets = Hash.new
|
168
|
+
@@global_tilesets = Hash.new
|
167
169
|
@@sounds = Hash.new
|
168
170
|
@@global_sounds = Hash.new
|
169
171
|
@@fonts = Hash.new
|
@@ -186,18 +188,18 @@ module AGL
|
|
186
188
|
a[id] = imgs
|
187
189
|
end
|
188
190
|
|
189
|
-
def self.tileset id, global = false
|
190
|
-
if global; a = @@
|
191
|
+
def self.tileset id, tile_width = 32, tile_height = 32, global = false, ext = ".png"
|
192
|
+
if global; a = @@global_tilesets; else; a = @@tilesets; end
|
191
193
|
return a[id] if a[id]
|
192
|
-
s = "data/
|
193
|
-
tileset = Gosu::Image.load_tiles Game.window, s,
|
194
|
+
s = "data/tileset/" + id.to_s.split('_').join('/') + ext
|
195
|
+
tileset = Gosu::Image.load_tiles Game.window, s, tile_width, tile_height, true
|
194
196
|
a[id] = tileset
|
195
197
|
end
|
196
198
|
|
197
199
|
def self.sound id, global = false, ext = ".wav"
|
198
200
|
if global; a = @@global_sounds; else; a = @@sounds; end
|
199
201
|
return a[id] if a[id]
|
200
|
-
s = "data/sound/
|
202
|
+
s = "data/sound/" + id.to_s.split('_').join('/') + ext
|
201
203
|
sound = Gosu::Sample.new Game.window, s
|
202
204
|
a[id] = sound
|
203
205
|
end
|
@@ -205,7 +207,7 @@ module AGL
|
|
205
207
|
def self.song id, global = false, ext = ".ogg"
|
206
208
|
if global; a = @@global_sounds; else; a = @@sounds; end
|
207
209
|
return a[id] if a[id]
|
208
|
-
s = "data/
|
210
|
+
s = "data/song/" + id.to_s.split('_').join('/') + ext
|
209
211
|
song = Gosu::Song.new Game.window, s
|
210
212
|
a[id] = song
|
211
213
|
end
|
@@ -224,6 +226,7 @@ module AGL
|
|
224
226
|
|
225
227
|
def self.clear
|
226
228
|
@@imgs.clear
|
229
|
+
@@tilesets.clear
|
227
230
|
@@sounds.clear
|
228
231
|
@@fonts.clear
|
229
232
|
end
|
data/test/res_tests.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../lib/minigl'
|
3
|
+
include AGL
|
4
|
+
|
5
|
+
class SpriteTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@window = Gosu::Window.new 800, 600, false
|
8
|
+
Game.initialize @window
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_tileset
|
12
|
+
t1 = Res.tileset :tileset1
|
13
|
+
assert_equal 9, t1.length
|
14
|
+
assert_equal 32, t1[0].width
|
15
|
+
assert_equal 32, t1[0].width
|
16
|
+
Res.clear
|
17
|
+
t1 = Res.tileset :tileset1, 48, 48
|
18
|
+
assert_equal 4, t1.length
|
19
|
+
assert_equal 48, t1[0].width
|
20
|
+
assert_equal 48, t1[0].width
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minigl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor David Santos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -36,21 +36,23 @@ executables: []
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
-
- LICENSE
|
40
|
-
- README.md
|
41
|
-
- Rakefile
|
42
|
-
- data/font/font1.ttf
|
43
|
-
- data/img/image.png
|
44
|
-
- data/img/img1.png
|
45
39
|
- lib/minigl.rb
|
46
40
|
- lib/minigl/forms.rb
|
47
|
-
- lib/minigl/game_object.rb
|
48
41
|
- lib/minigl/global.rb
|
42
|
+
- lib/minigl/text.rb
|
49
43
|
- lib/minigl/map.rb
|
50
44
|
- lib/minigl/movement.rb
|
51
|
-
- lib/minigl/
|
45
|
+
- lib/minigl/game_object.rb
|
46
|
+
- data/tileset/tileset1.png
|
47
|
+
- data/img/image.png
|
48
|
+
- data/img/img1.png
|
49
|
+
- data/font/font1.ttf
|
50
|
+
- Rakefile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
52
53
|
- test/game.rb
|
53
54
|
- test/game_object_tests.rb
|
55
|
+
- test/res_tests.rb
|
54
56
|
- test/map_tests.rb
|
55
57
|
- test/movement_tests.rb
|
56
58
|
homepage: https://github.com/victords/minigl
|
@@ -73,12 +75,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
75
|
version: '0'
|
74
76
|
requirements: []
|
75
77
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.0.14
|
77
79
|
signing_key:
|
78
80
|
specification_version: 4
|
79
81
|
summary: MiniGL
|
80
82
|
test_files:
|
81
|
-
- test/movement_tests.rb
|
82
|
-
- test/map_tests.rb
|
83
83
|
- test/game.rb
|
84
84
|
- test/game_object_tests.rb
|
85
|
+
- test/res_tests.rb
|
86
|
+
- test/map_tests.rb
|
87
|
+
- test/movement_tests.rb
|