minigl 2.0.14 → 2.0.15
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/README.md +2 -2
- data/lib/minigl/game_object.rb +6 -5
- data/lib/minigl/global.rb +15 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22d1f8116b124e88af0f118061d03fdec42e53e699adb6b941873ea4111f777a
|
4
|
+
data.tar.gz: 8c1baf3090485e58fcec0cbde92d1be87d29269facce261156a021f2452da553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7cd5d8f4d85825ce2797b9f9cda4016a2f135b74f319b09f6fd3f96d26ab4715d57544ed730077c703961b2813d4f97d49b1e7772f4cc11079f0d1ea693ff5c
|
7
|
+
data.tar.gz: 17582310ae650eeb9b4269893985a252be3839b5c80803aaa6c32ba89df35a94da64dd4202b402697529cb6d89f78851ac6c97b23963e767b7cdddc90acaa8ef
|
data/README.md
CHANGED
@@ -29,6 +29,6 @@ After installing the Gosu dependencies, you can just `gem install minigl`.
|
|
29
29
|
* The [wiki](https://github.com/victords/minigl/wiki) is a work in progress with tutorials and examples.
|
30
30
|
* Test package and examples aren't complete!
|
31
31
|
|
32
|
-
## Version 2.0.
|
32
|
+
## Version 2.0.15
|
33
33
|
|
34
|
-
*
|
34
|
+
* Added the `retro_images` global option to `Res` and the `retro` option to `Res::img`, `Res::imgs` and `Res::tileset`.
|
data/lib/minigl/game_object.rb
CHANGED
@@ -32,13 +32,14 @@ module MiniGL
|
|
32
32
|
# image is not a spritesheet.
|
33
33
|
# [sprite_rows] The number of rows in the spritesheet. Use +nil+ if the
|
34
34
|
# image is not a spritesheet.
|
35
|
-
def initialize(x, y, img, sprite_cols = nil, sprite_rows = nil)
|
35
|
+
def initialize(x, y, img, sprite_cols = nil, sprite_rows = nil, retro = nil)
|
36
36
|
@x = x; @y = y
|
37
|
+
retro = Res.retro_images if retro.nil?
|
37
38
|
@img =
|
38
39
|
if sprite_cols.nil?
|
39
|
-
[Res.img(img)]
|
40
|
+
[Res.img(img, false, false, '.png', retro)]
|
40
41
|
else
|
41
|
-
Res.imgs img, sprite_cols, sprite_rows
|
42
|
+
Res.imgs img, sprite_cols, sprite_rows, false, '.png', retro
|
42
43
|
end
|
43
44
|
@anim_counter = 0
|
44
45
|
@img_index = 0
|
@@ -208,8 +209,8 @@ module MiniGL
|
|
208
209
|
# image is not a spritesheet.
|
209
210
|
# [mass] The mass of the object. Details on how it is used can be found
|
210
211
|
# in the Movement module.
|
211
|
-
def initialize(x, y, w, h, img, img_gap = nil, sprite_cols = nil, sprite_rows = nil, mass = 1.0)
|
212
|
-
super x, y, img, sprite_cols, sprite_rows
|
212
|
+
def initialize(x, y, w, h, img, img_gap = nil, sprite_cols = nil, sprite_rows = nil, mass = 1.0, retro = nil)
|
213
|
+
super x, y, img, sprite_cols, sprite_rows, retro
|
213
214
|
@w = w; @h = h
|
214
215
|
@img_gap =
|
215
216
|
if img_gap.nil?
|
data/lib/minigl/global.rb
CHANGED
@@ -500,6 +500,11 @@ module MiniGL
|
|
500
500
|
# that won't appear in any file name.
|
501
501
|
attr_accessor :separator
|
502
502
|
|
503
|
+
# Gets or sets a flag that indicates whether images will be loaded with
|
504
|
+
# the 'retro' option set (see +Gosu::Image+ for details), when this
|
505
|
+
# option is not specified in a 'Res.img' or 'Res.imgs' call.
|
506
|
+
attr_accessor :retro_images
|
507
|
+
|
503
508
|
# This is called by <code>GameWindow.initialize</code>. Don't call it
|
504
509
|
# explicitly.
|
505
510
|
def initialize
|
@@ -521,6 +526,7 @@ module MiniGL
|
|
521
526
|
@song_dir = 'song/'
|
522
527
|
@font_dir = 'font/'
|
523
528
|
@separator = '_'
|
529
|
+
@retro_images = false
|
524
530
|
end
|
525
531
|
|
526
532
|
# Set a custom prefix for loading resources. By default, the prefix is the
|
@@ -579,11 +585,12 @@ module MiniGL
|
|
579
585
|
# continuous composition.
|
580
586
|
# [ext] The extension of the file being loaded. Specify only if it is
|
581
587
|
# other than '.png'.
|
582
|
-
def img(id, global = false, tileable = false, ext = '.png')
|
588
|
+
def img(id, global = false, tileable = false, ext = '.png', retro = nil)
|
583
589
|
a = global ? @global_imgs : @imgs
|
584
590
|
return a[id] if a[id]
|
585
591
|
s = @prefix + @img_dir + id.to_s.split(@separator).join('/') + ext
|
586
|
-
|
592
|
+
retro = Res.retro_images if retro.nil?
|
593
|
+
img = Gosu::Image.new s, tileable: tileable, retro: retro
|
587
594
|
a[id] = img
|
588
595
|
end
|
589
596
|
|
@@ -602,11 +609,12 @@ module MiniGL
|
|
602
609
|
# released when you call +clear+.
|
603
610
|
# [ext] The extension of the file being loaded. Specify only if it is
|
604
611
|
# other than ".png".
|
605
|
-
def imgs(id, sprite_cols, sprite_rows, global = false, ext = '.png')
|
612
|
+
def imgs(id, sprite_cols, sprite_rows, global = false, ext = '.png', retro = nil)
|
606
613
|
a = global ? @global_imgs : @imgs
|
607
614
|
return a[id] if a[id]
|
608
615
|
s = @prefix + @img_dir + id.to_s.split(@separator).join('/') + ext
|
609
|
-
|
616
|
+
retro = Res.retro_images if retro.nil?
|
617
|
+
imgs = Gosu::Image.load_tiles s, -sprite_cols, -sprite_rows, tileable: false, retro: retro
|
610
618
|
a[id] = imgs
|
611
619
|
end
|
612
620
|
|
@@ -626,11 +634,12 @@ module MiniGL
|
|
626
634
|
# released when you call +clear+.
|
627
635
|
# [ext] The extension of the file being loaded. Specify only if it is
|
628
636
|
# other than ".png".
|
629
|
-
def tileset(id, tile_width = 32, tile_height = 32, global = false, ext = '.png')
|
637
|
+
def tileset(id, tile_width = 32, tile_height = 32, global = false, ext = '.png', retro = nil)
|
630
638
|
a = global ? @global_tilesets : @tilesets
|
631
639
|
return a[id] if a[id]
|
632
640
|
s = @prefix + @tileset_dir + id.to_s.split(@separator).join('/') + ext
|
633
|
-
|
641
|
+
retro = Res.retro_images if retro.nil?
|
642
|
+
tileset = Gosu::Image.load_tiles s, tile_width, tile_height, tileable: true, retro: retro
|
634
643
|
a[id] = tileset
|
635
644
|
end
|
636
645
|
|
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: 2.0.
|
4
|
+
version: 2.0.15
|
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: 2018-07-
|
11
|
+
date: 2018-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|