minigl 2.0.9 → 2.0.10

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/lib/minigl/global.rb +16 -15
  4. data/test/game.rb +2 -0
  5. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 545d2e46bcc97bb95ef2ef8a9b150cf5492a4ca6
4
- data.tar.gz: f35a2fc0ad36a5b640d11b5001521db050b04c50
3
+ metadata.gz: 14e4b39f111695d719bd2bc862539aab53c8db50
4
+ data.tar.gz: 4cdc0e5cc7ae05ce569a628c974c5d0c8ec0fc5a
5
5
  SHA512:
6
- metadata.gz: 0c7cf269750dd3dea9f6bd4f09b17216974dc3cfa4a28cd212d72f6e9210dfecd3a02256a8d0e2b3bf5b21d94011eeb4f703821f694d44d9c0e700ea593f16d4
7
- data.tar.gz: 3a786d3aa449653647f112ca35e839817f8a74ba5d9712121d78c4d2673bfd9735678be24943a00d481244670cdd64fc7f539b3adb0e1ed8fa16827bfefebf85
6
+ metadata.gz: 60704db65e358985290d73500b8fda128d0b55fd32e129f89ed3fe183ad0f8011706efb5e646fcb9a40c779d082062aa9e4c47fe43e7b19b2b1a4b627ead304a
7
+ data.tar.gz: 8156407024e27dd482a7a61774afd2d36431464489ca6b685068882b2e66ec47cbc9c9ddc645a21e630ebab4bb924b08e27e4c0b2f596efb488fa04b6e05bd24
data/README.md CHANGED
@@ -29,7 +29,8 @@ 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.9
32
+ ## Version 2.0.10
33
33
 
34
- * Added the `round` option to `Sprite#draw` and `GameObject#draw`.
35
- * Fixed `GameObject#draw` when drawing rotated with non-null `img_gap`.
34
+ * **Updated Gosu version to ~> 0.11 in dependencies.**
35
+ * Eliminated references to `Window` instance when loading resources with `Res`.
36
+ * Added `GameWindow#toggle_fullscreen` method.
@@ -241,9 +241,10 @@ module MiniGL
241
241
  0, height, color, 0
242
242
  end
243
243
 
244
- # def toggle_fullscreen
245
- # # TODO
246
- # end
244
+ # Toggles the window between windowed and full screen mode.
245
+ def toggle_fullscreen
246
+ self.fullscreen = !fullscreen?
247
+ end
247
248
  end
248
249
 
249
250
  #class JSHelper
@@ -587,10 +588,10 @@ module MiniGL
587
588
  # [ext] The extension of the file being loaded. Specify only if it is
588
589
  # other than '.png'.
589
590
  def img(id, global = false, tileable = false, ext = '.png')
590
- if global; a = @global_imgs; else; a = @imgs; end
591
+ a = global ? @global_imgs : @imgs
591
592
  return a[id] if a[id]
592
593
  s = @prefix + @img_dir + id.to_s.split(@separator).join('/') + ext
593
- img = Gosu::Image.new G.window, s, tileable
594
+ img = Gosu::Image.new s, tileable: tileable
594
595
  a[id] = img
595
596
  end
596
597
 
@@ -610,10 +611,10 @@ module MiniGL
610
611
  # [ext] The extension of the file being loaded. Specify only if it is
611
612
  # other than ".png".
612
613
  def imgs(id, sprite_cols, sprite_rows, global = false, ext = '.png')
613
- if global; a = @global_imgs; else; a = @imgs; end
614
+ a = global ? @global_imgs : @imgs
614
615
  return a[id] if a[id]
615
616
  s = @prefix + @img_dir + id.to_s.split(@separator).join('/') + ext
616
- imgs = Gosu::Image.load_tiles G.window, s, -sprite_cols, -sprite_rows, false
617
+ imgs = Gosu::Image.load_tiles s, -sprite_cols, -sprite_rows, tileable: false
617
618
  a[id] = imgs
618
619
  end
619
620
 
@@ -634,10 +635,10 @@ module MiniGL
634
635
  # [ext] The extension of the file being loaded. Specify only if it is
635
636
  # other than ".png".
636
637
  def tileset(id, tile_width = 32, tile_height = 32, global = false, ext = '.png')
637
- if global; a = @global_tilesets; else; a = @tilesets; end
638
+ a = global ? @global_tilesets : @tilesets
638
639
  return a[id] if a[id]
639
640
  s = @prefix + @tileset_dir + id.to_s.split(@separator).join('/') + ext
640
- tileset = Gosu::Image.load_tiles G.window, s, tile_width, tile_height, true
641
+ tileset = Gosu::Image.load_tiles s, tile_width, tile_height, tileable: true
641
642
  a[id] = tileset
642
643
  end
643
644
 
@@ -654,10 +655,10 @@ module MiniGL
654
655
  # [ext] The extension of the file being loaded. Specify only if it is
655
656
  # other than ".wav".
656
657
  def sound(id, global = false, ext = '.wav')
657
- if global; a = @global_sounds; else; a = @sounds; end
658
+ a = global ? @global_sounds : @sounds
658
659
  return a[id] if a[id]
659
660
  s = @prefix + @sound_dir + id.to_s.split(@separator).join('/') + ext
660
- sound = Gosu::Sample.new G.window, s
661
+ sound = Gosu::Sample.new s
661
662
  a[id] = sound
662
663
  end
663
664
 
@@ -674,10 +675,10 @@ module MiniGL
674
675
  # [ext] The extension of the file being loaded. Specify only if it is
675
676
  # other than ".ogg".
676
677
  def song(id, global = false, ext = '.ogg')
677
- if global; a = @global_songs; else; a = @songs; end
678
+ a = global ? @global_songs : @songs
678
679
  return a[id] if a[id]
679
680
  s = @prefix + @song_dir + id.to_s.split(@separator).join('/') + ext
680
- song = Gosu::Song.new G.window, s
681
+ song = Gosu::Song.new s
681
682
  a[id] = song
682
683
  end
683
684
 
@@ -697,11 +698,11 @@ module MiniGL
697
698
  # [ext] The extension of the file being loaded. Specify only if it is
698
699
  # other than ".ttf".
699
700
  def font(id, size, global = true, ext = '.ttf')
700
- if global; a = @global_fonts; else; a = @fonts; end
701
+ a = global ? @global_fonts : @fonts
701
702
  id_size = "#{id}_#{size}"
702
703
  return a[id_size] if a[id_size]
703
704
  s = @prefix + @font_dir + id.to_s.split(@separator).join('/') + ext
704
- font = Gosu::Font.new G.window, s, size
705
+ font = Gosu::Font.new size, name: s
705
706
  a[id_size] = font
706
707
  end
707
708
 
@@ -69,6 +69,8 @@ class MyGame < GameWindow
69
69
  @ddl.value = 'segunda' if KB.key_pressed? Gosu::Kb2
70
70
  @ddl.value = 'terceira' if KB.key_pressed? Gosu::Kb3
71
71
 
72
+ G.window.toggle_fullscreen if KB.key_pressed?(Gosu::KB_RIGHT_ALT)
73
+
72
74
  Mouse.update
73
75
  if Mouse.double_click? :left
74
76
  @obj1.x = Mouse.x
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.9
4
+ version: 2.0.10
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-03-10 00:00:00.000000000 Z
11
+ date: 2018-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '0.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
26
+ version: '0.11'
27
27
  description: A minimal 2D Game Library built on top of the Gosu gem.
28
28
  email: victordavidsantos@gmail.com
29
29
  executables: []