metro 0.3.3 → 0.3.4
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/changelog.md +8 -1
- data/lib/core_ext/class.rb +14 -0
- data/lib/metro.rb +1 -0
- data/lib/metro/events/event_data.rb +3 -4
- data/lib/metro/events/event_state_manager.rb +63 -0
- data/lib/metro/events/events.rb +3 -0
- data/lib/metro/events/hit_list.rb +4 -5
- data/lib/metro/events/unknown_sender.rb +1 -1
- data/lib/metro/models/model.rb +14 -25
- data/lib/metro/models/model_factory.rb +1 -1
- data/lib/metro/models/models.rb +62 -0
- data/lib/metro/models/properties/position_property.rb +1 -1
- data/lib/metro/models/ui/animated_sprite.rb +85 -0
- data/lib/metro/models/ui/border.rb +44 -18
- data/lib/metro/models/ui/fps.rb +1 -1
- data/lib/metro/models/ui/generic.rb +24 -3
- data/lib/metro/models/ui/model_label.rb +1 -1
- data/lib/metro/models/ui/model_labeler.rb +2 -2
- data/lib/metro/models/ui/rectangle.rb +1 -1
- data/lib/metro/models/ui/sprite.rb +79 -0
- data/lib/metro/models/ui/ui.rb +12 -0
- data/lib/metro/scene.rb +13 -61
- data/lib/metro/scenes.rb +11 -13
- data/lib/metro/transitions/edit_transition_scene.rb +2 -2
- data/lib/metro/units/calculation_validations.rb +74 -0
- data/lib/metro/units/dimensions.rb +11 -19
- data/lib/metro/units/point.rb +6 -22
- data/lib/metro/units/rectangle_bounds.rb +10 -6
- data/lib/metro/units/scale.rb +7 -0
- data/lib/metro/units/units.rb +1 -0
- data/lib/metro/version.rb +1 -1
- data/lib/metro/window.rb +7 -3
- data/lib/setup_handlers/reload_game_on_game_file_changes.rb +6 -6
- data/lib/templates/game/models/hero.rb +35 -6
- data/lib/templates/model.rb.tt +1 -1
- data/spec/core_ext/string_spec.rb +0 -20
- data/spec/metro/units/point_spec.rb +132 -0
- data/spec/setup_handlers/exit_if_dry_run_spec.rb +27 -0
- data/spec/setup_handlers/reload_game_on_game_file_changes_spec.rb +68 -0
- metadata +21 -9
| @@ -0,0 +1,68 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Metro::SetupHandlers::ReloadGameOnGameFileChanges do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              let(:expected_filepaths) do
         | 
| 6 | 
            +
                %w[ lib scenes models views assets ]
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              its(:watched_filepaths) { should eq expected_filepaths }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
             | 
| 12 | 
            +
              describe "#setup" do
         | 
| 13 | 
            +
                context "when the game is not in debug mode" do
         | 
| 14 | 
            +
                  before do
         | 
| 15 | 
            +
                    Game.stub(:debug?).and_return(false)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  let(:options) { mock('Options',packaged?: false) }
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  it "should not start the watcher" do
         | 
| 21 | 
            +
                    subject.should_not_receive(:start_watcher)
         | 
| 22 | 
            +
                    subject.setup(options)
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                context "when the options specify that it is being run in a package" do
         | 
| 27 | 
            +
                  before do
         | 
| 28 | 
            +
                    Game.stub(:debug?).and_return(true)
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  let(:options) { mock('Options',packaged?: true) }
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  it "should not start the watcher" do
         | 
| 34 | 
            +
                    subject.should_not_receive(:start_watcher)
         | 
| 35 | 
            +
                    subject.setup(options)
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                context "when the game is debug mode" do
         | 
| 40 | 
            +
                  before do
         | 
| 41 | 
            +
                    Game.stub(:debug?).and_return(true)
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  let(:options) { mock('Options',packaged?: false) }
         | 
| 45 | 
            +
             | 
| 46 | 
            +
             | 
| 47 | 
            +
                  it "should start the watcher" do
         | 
| 48 | 
            +
                    subject.should_receive(:start_watcher)
         | 
| 49 | 
            +
                    subject.setup(options)
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              describe "#reload_game_because_files_changed" do
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                before do
         | 
| 57 | 
            +
                  Metro.stub(:game_has_valid_code?).and_return(false)
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                let(:changed_files) { [ :new_file, :update_file, :deleted_file ] }
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                it "should not ask the current scene to reload if the code is invalid" do
         | 
| 63 | 
            +
                  Game.should_not_receive(:current_scene)
         | 
| 64 | 
            +
                  subject.reload_game_because_files_changed(changed_files)
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: metro
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.4
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012- | 
| 12 | 
            +
            date: 2012-12-15 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: gosu
         | 
| @@ -138,6 +138,7 @@ files: | |
| 138 138 | 
             
            - lib/commands/generate_scene.rb
         | 
| 139 139 | 
             
            - lib/commands/generate_view.rb
         | 
| 140 140 | 
             
            - lib/commands/thor.rb
         | 
| 141 | 
            +
            - lib/core_ext/class.rb
         | 
| 141 142 | 
             
            - lib/core_ext/numeric.rb
         | 
| 142 143 | 
             
            - lib/gosu_ext/color.rb
         | 
| 143 144 | 
             
            - lib/gosu_ext/gosu_constants.rb
         | 
| @@ -161,6 +162,8 @@ files: | |
| 161 162 | 
             
            - lib/metro/events/event_dictionary.rb
         | 
| 162 163 | 
             
            - lib/metro/events/event_factory.rb
         | 
| 163 164 | 
             
            - lib/metro/events/event_relay.rb
         | 
| 165 | 
            +
            - lib/metro/events/event_state_manager.rb
         | 
| 166 | 
            +
            - lib/metro/events/events.rb
         | 
| 164 167 | 
             
            - lib/metro/events/has_events.rb
         | 
| 165 168 | 
             
            - lib/metro/events/hit_list.rb
         | 
| 166 169 | 
             
            - lib/metro/events/unknown_sender.rb
         | 
| @@ -175,6 +178,7 @@ files: | |
| 175 178 | 
             
            - lib/metro/models/key_value_coding.rb
         | 
| 176 179 | 
             
            - lib/metro/models/model.rb
         | 
| 177 180 | 
             
            - lib/metro/models/model_factory.rb
         | 
| 181 | 
            +
            - lib/metro/models/models.rb
         | 
| 178 182 | 
             
            - lib/metro/models/properties/animation_property.rb
         | 
| 179 183 | 
             
            - lib/metro/models/properties/array_property.rb
         | 
| 180 184 | 
             
            - lib/metro/models/properties/boolean_property.rb
         | 
| @@ -194,6 +198,7 @@ files: | |
| 194 198 | 
             
            - lib/metro/models/properties/scale_property.rb
         | 
| 195 199 | 
             
            - lib/metro/models/properties/song_property.rb
         | 
| 196 200 | 
             
            - lib/metro/models/properties/text_property.rb
         | 
| 201 | 
            +
            - lib/metro/models/ui/animated_sprite.rb
         | 
| 197 202 | 
             
            - lib/metro/models/ui/border.rb
         | 
| 198 203 | 
             
            - lib/metro/models/ui/fps.rb
         | 
| 199 204 | 
             
            - lib/metro/models/ui/generic.rb
         | 
| @@ -204,6 +209,8 @@ files: | |
| 204 209 | 
             
            - lib/metro/models/ui/model_label.rb
         | 
| 205 210 | 
             
            - lib/metro/models/ui/model_labeler.rb
         | 
| 206 211 | 
             
            - lib/metro/models/ui/rectangle.rb
         | 
| 212 | 
            +
            - lib/metro/models/ui/sprite.rb
         | 
| 213 | 
            +
            - lib/metro/models/ui/ui.rb
         | 
| 207 214 | 
             
            - lib/metro/parameters/command_line_args_parser.rb
         | 
| 208 215 | 
             
            - lib/metro/parameters/options.rb
         | 
| 209 216 | 
             
            - lib/metro/parameters/parameters.rb
         | 
| @@ -217,6 +224,7 @@ files: | |
| 217 224 | 
             
            - lib/metro/transitions/scene_transitions.rb
         | 
| 218 225 | 
             
            - lib/metro/transitions/transition_scene.rb
         | 
| 219 226 | 
             
            - lib/metro/units/bounds.rb
         | 
| 227 | 
            +
            - lib/metro/units/calculation_validations.rb
         | 
| 220 228 | 
             
            - lib/metro/units/dimensions.rb
         | 
| 221 229 | 
             
            - lib/metro/units/point.rb
         | 
| 222 230 | 
             
            - lib/metro/units/rectangle_bounds.rb
         | 
| @@ -276,7 +284,10 @@ files: | |
| 276 284 | 
             
            - spec/metro/scene_views/json_view_spec.rb
         | 
| 277 285 | 
             
            - spec/metro/scene_views/yaml_view_spec.rb
         | 
| 278 286 | 
             
            - spec/metro/scenes_spec.rb
         | 
| 287 | 
            +
            - spec/metro/units/point_spec.rb
         | 
| 279 288 | 
             
            - spec/metro/views/view_spec.rb
         | 
| 289 | 
            +
            - spec/setup_handlers/exit_if_dry_run_spec.rb
         | 
| 290 | 
            +
            - spec/setup_handlers/reload_game_on_game_file_changes_spec.rb
         | 
| 280 291 | 
             
            - spec/spec_helper.rb
         | 
| 281 292 | 
             
            homepage: https://github.com/burtlo/metro
         | 
| 282 293 | 
             
            licenses:
         | 
| @@ -284,13 +295,11 @@ licenses: | |
| 284 295 | 
             
            post_install_message: ! "    ______  ___      _____\n    ___   |/  /_____ __  /_______________\n
         | 
| 285 296 | 
             
              \   __  /|_/ / _  _ \\_  __/__  ___/_  __ \\\n    _  /  / /  /  __// /_  _  /    /
         | 
| 286 297 | 
             
              /_/ /\n    /_/  /_/   \\___/  \\__/ /_/     \\____/\n\n  Thank you for installing
         | 
| 287 | 
            -
              metro 0.3. | 
| 288 | 
            -
              \ Changes:\n    \n  *  | 
| 289 | 
            -
               | 
| 290 | 
            -
               | 
| 291 | 
            -
               | 
| 292 | 
            -
              type\n  * `metr::ui::fps` added and has some shortcut placements settings\n  \n\n
         | 
| 293 | 
            -
              \ ---------------------------------------------------------------------\n"
         | 
| 298 | 
            +
              metro 0.3.4 / 2012-12-14.\n  ---------------------------------------------------------------------\n
         | 
| 299 | 
            +
              \ Changes:\n    \n  * `metro::ui::sprite` and `metro::ui::animated_sprite` model
         | 
| 300 | 
            +
              classes\n    to make it easier to take care of all the basic model attributes.\n
         | 
| 301 | 
            +
              \ * Event Management changed in the background. The API remains the\n    same.\n
         | 
| 302 | 
            +
              \   \n\n  ---------------------------------------------------------------------\n"
         | 
| 294 303 | 
             
            rdoc_options: []
         | 
| 295 304 | 
             
            require_paths:
         | 
| 296 305 | 
             
            - lib
         | 
| @@ -334,6 +343,9 @@ test_files: | |
| 334 343 | 
             
            - spec/metro/scene_views/json_view_spec.rb
         | 
| 335 344 | 
             
            - spec/metro/scene_views/yaml_view_spec.rb
         | 
| 336 345 | 
             
            - spec/metro/scenes_spec.rb
         | 
| 346 | 
            +
            - spec/metro/units/point_spec.rb
         | 
| 337 347 | 
             
            - spec/metro/views/view_spec.rb
         | 
| 348 | 
            +
            - spec/setup_handlers/exit_if_dry_run_spec.rb
         | 
| 349 | 
            +
            - spec/setup_handlers/reload_game_on_game_file_changes_spec.rb
         | 
| 338 350 | 
             
            - spec/spec_helper.rb
         | 
| 339 351 | 
             
            has_rdoc: 
         |