minigl 2.2.4 → 2.2.5
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 -3
- data/lib/minigl/game_object.rb +9 -8
- data/test/game.rb +5 -0
- 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: 17cfec4fd44f2a4796d2be16f7de9d19ab5be6d9d3dce59fb5e0154c9fb153ae
         | 
| 4 | 
            +
              data.tar.gz: 542db7203b4c9cec72be26037058ab9fec3487078da77c4099056ea0a96dace2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 87bd0c8b076fa41be74210c657dd7eeaf90ce1d7768a211018de80d7c807b6b5a776b76c317998e660d60c09550b772f2dd6783f53556fd50c746c3c27f67fcf
         | 
| 7 | 
            +
              data.tar.gz: e47d4b80ec4979ca6e8b63c6b818d247a3ff9af939447d4b4bf68d2d01c0fb934211311ee2c1abb41014981703ef0d8cf72fc7bcaa313cadc9432b81fbd6fe93
         | 
    
        data/README.md
    CHANGED
    
    | @@ -29,7 +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.2. | 
| 32 | 
            +
            ## Version 2.2.5
         | 
| 33 33 |  | 
| 34 | 
            -
              * Fixed  | 
| 35 | 
            -
              * Clarified the documentation of the `Map` class.
         | 
| 34 | 
            +
              * Fixed `Sprite#animate_once` and added the possibility of passing a callback.
         | 
    
        data/lib/minigl/game_object.rb
    CHANGED
    
    | @@ -82,10 +82,7 @@ module MiniGL | |
| 82 82 | 
             
                # [interval] The amount of frames between each change in the image index.
         | 
| 83 83 | 
             
                #            See +animate+ for details.
         | 
| 84 84 | 
             
                def animate_once(indices, interval)
         | 
| 85 | 
            -
                  if @animate_once_control == 2
         | 
| 86 | 
            -
                    return if indices == @animate_once_indices && interval == @animate_once_interval
         | 
| 87 | 
            -
                    @animate_once_control = 0
         | 
| 88 | 
            -
                  end
         | 
| 85 | 
            +
                  return if @animate_once_control == 2
         | 
| 89 86 |  | 
| 90 87 | 
             
                  unless @animate_once_control == 1
         | 
| 91 88 | 
             
                    @anim_counter = 0
         | 
| @@ -100,10 +97,14 @@ module MiniGL | |
| 100 97 | 
             
                  @anim_counter += 1
         | 
| 101 98 | 
             
                  return unless @anim_counter >= interval
         | 
| 102 99 |  | 
| 103 | 
            -
                  @index_index  | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
                   | 
| 100 | 
            +
                  if @index_index == indices.length - 1
         | 
| 101 | 
            +
                    @animate_once_control = 2
         | 
| 102 | 
            +
                    yield if block_given?
         | 
| 103 | 
            +
                  else
         | 
| 104 | 
            +
                    @index_index += 1
         | 
| 105 | 
            +
                    @img_index = indices[@index_index]
         | 
| 106 | 
            +
                    @anim_counter = 0
         | 
| 107 | 
            +
                  end
         | 
| 107 108 | 
             
                end
         | 
| 108 109 |  | 
| 109 110 | 
             
                # Resets the animation timer and immediately changes the image index to
         | 
    
        data/test/game.rb
    CHANGED
    
    | @@ -116,6 +116,11 @@ class MyGame < GameWindow | |
| 116 116 | 
             
                @objs.each_with_index do |o, i|
         | 
| 117 117 | 
             
                  o.move_free(i * 45, 3)
         | 
| 118 118 | 
             
                end
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                @obj3.animate_once([1, 2, 3, 4], 15) do
         | 
| 121 | 
            +
                  puts 'acabou'
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
                @obj3.set_animation 0 if KB.key_pressed? Gosu::KB_0
         | 
| 119 124 | 
             
              end
         | 
| 120 125 |  | 
| 121 126 | 
             
              def draw
         | 
    
        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.2. | 
| 4 | 
            +
              version: 2.2.5
         | 
| 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: 2019- | 
| 11 | 
            +
            date: 2019-06-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: gosu
         |