gamebox 0.3.4 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +38 -0
- data/Rakefile +1 -10
- data/TODO.txt +6 -6
- data/app_generators/gamebox_generator.rb +95 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/.gitignore +0 -0
- data/app_generators/templates/Gemfile +7 -0
- data/app_generators/templates/NEXT_STEPS.txt +1 -0
- data/{lib/gamebox/templates/template_app/README → app_generators/templates/README.rdoc} +0 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/Rakefile +0 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/config/boot.rb +0 -0
- data/app_generators/templates/config/environment.rb +30 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/config/game.yml +0 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/data/fonts/FONTS_GO_HERE +0 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/data/graphics/GRAPHICS_GO_HERE +0 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/data/music/MUSIC_GOES_HERE +0 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/data/sounds/SOUND_FX_GO_HERE +0 -0
- data/{lib/gamebox/templates → app_generators/templates/script}/actor.erb +0 -0
- data/{lib/gamebox/templates → app_generators/templates/script}/actor_spec.erb +0 -0
- data/{lib/gamebox/templates → app_generators/templates/script}/actor_view.erb +0 -0
- data/{lib/gamebox/templates → app_generators/templates/script}/actor_view_spec.erb +0 -0
- data/app_generators/templates/script/generate +12 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/spec/helper.rb +0 -0
- data/app_generators/templates/src/actors/player.rb +8 -0
- data/{lib/gamebox/templates/template_app → app_generators/templates}/src/app.rb +0 -0
- data/app_generators/templates/src/demo_stage.rb +7 -0
- data/bin/gamebox +8 -70
- data/component_generators/actor_generator.rb +17 -0
- data/docs/CODE_REVIEW +1 -1
- data/docs/REFACTOR_NOTES.txt +25 -0
- data/docs/getting_started.rdoc +1 -1
- data/gamebox.gemspec +7 -4
- data/lib/gamebox.rb +6 -3
- data/lib/gamebox/actors/collidable_debugger.rb +13 -15
- data/lib/gamebox/actors/curtain.rb +44 -43
- data/lib/gamebox/actors/emitter.rb +3 -42
- data/lib/gamebox/actors/fps.rb +13 -6
- data/lib/gamebox/actors/label.rb +42 -34
- data/lib/gamebox/actors/logo.rb +2 -4
- data/lib/gamebox/actors/score.rb +37 -27
- data/lib/gamebox/actors/svg_actor.rb +45 -32
- data/lib/gamebox/behaviors/animated.rb +39 -59
- data/lib/gamebox/behaviors/audible.rb +14 -14
- data/lib/gamebox/behaviors/collidable.rb +65 -36
- data/lib/gamebox/behaviors/collidable/aabb_collidable.rb +2 -3
- data/lib/gamebox/behaviors/collidable/collidable_shape.rb +6 -4
- data/lib/gamebox/behaviors/collidable/polygon_collidable.rb +1 -1
- data/lib/gamebox/behaviors/emitting.rb +48 -0
- data/lib/gamebox/behaviors/graphical.rb +22 -56
- data/lib/gamebox/behaviors/layered.rb +8 -21
- data/lib/gamebox/behaviors/physical.rb +202 -213
- data/lib/gamebox/behaviors/positioned.rb +16 -0
- data/lib/gamebox/behaviors/projectile.rb +15 -0
- data/lib/gamebox/behaviors/visible.rb +16 -0
- data/lib/gamebox/core/aabb_helpers.rb +61 -0
- data/lib/gamebox/core/aabb_node.rb +118 -0
- data/lib/gamebox/core/aabb_tree.rb +137 -0
- data/lib/gamebox/core/actor.rb +102 -0
- data/lib/gamebox/core/actor_factory.rb +56 -0
- data/lib/gamebox/core/actor_view.rb +63 -0
- data/lib/gamebox/core/actor_view_factory.rb +40 -0
- data/lib/gamebox/{arbiter.rb → core/arbiter.rb} +31 -34
- data/lib/gamebox/{backstage.rb → core/backstage.rb} +0 -0
- data/lib/gamebox/core/behavior.rb +64 -0
- data/lib/gamebox/core/behavior_factory.rb +56 -0
- data/lib/gamebox/{class_finder.rb → core/class_finder.rb} +0 -0
- data/lib/gamebox/{config_manager.rb → core/config_manager.rb} +1 -1
- data/lib/gamebox/core/configuration.rb +39 -0
- data/lib/gamebox/core/core.rb +30 -0
- data/lib/gamebox/core/deprecated.rb +15 -0
- data/lib/gamebox/{director.rb → core/director.rb} +6 -11
- data/lib/gamebox/core/font_style.rb +26 -0
- data/lib/gamebox/core/font_style_factory.rb +11 -0
- data/lib/gamebox/core/game.rb +19 -0
- data/lib/gamebox/{hooked_gosu_window.rb → core/hooked_gosu_window.rb} +12 -6
- data/lib/gamebox/{input_manager.rb → core/input_manager.rb} +106 -99
- data/lib/gamebox/core/physics.rb +22 -0
- data/lib/gamebox/{physical_stage.rb → core/physics_manager.rb} +36 -30
- data/lib/gamebox/{resource_manager.rb → core/resource_manager.rb} +19 -18
- data/lib/gamebox/{sound_manager.rb → core/sound_manager.rb} +9 -7
- data/lib/gamebox/{stage.rb → core/stage.rb} +42 -80
- data/lib/gamebox/{stage_manager.rb → core/stage_manager.rb} +46 -53
- data/lib/gamebox/{stagehand.rb → core/stagehand.rb} +0 -0
- data/lib/gamebox/{svg_document.rb → core/svg_document.rb} +0 -0
- data/lib/gamebox/core/timer_manager.rb +50 -0
- data/lib/gamebox/{viewport.rb → core/viewport.rb} +2 -3
- data/lib/gamebox/{wrapped_screen.rb → core/wrapped_screen.rb} +12 -19
- data/lib/gamebox/gamebox_application.rb +7 -15
- data/lib/gamebox/lib/evented_attributes.rb +51 -0
- data/lib/gamebox/{ftor.rb → lib/ftor.rb} +0 -0
- data/lib/gamebox/lib/min_max_helpers.rb +10 -0
- data/lib/gamebox/lib/rect.rb +112 -54
- data/lib/gamebox/lib/yoda.rb +46 -0
- data/lib/gamebox/spec/helper.rb +317 -12
- data/lib/gamebox/stagehands/spatial_tree_stagehand.rb +61 -0
- data/lib/gamebox/version.rb +8 -3
- data/lib/gamebox/views/graphical_actor_view.rb +22 -29
- data/script/perf_aabb.rb +56 -0
- data/script/perf_array_access.rb +16 -0
- data/script/perf_collisions.rb +37 -18
- data/script/perf_struct_vs_array.rb +7 -7
- data/spec/acceptance/animation_spec.rb +65 -0
- data/spec/acceptance/basic_actor_lifecycle_spec.rb +92 -0
- data/spec/acceptance/built_in_collision_handling_spec.rb +55 -0
- data/spec/acceptance/chipmunk_collision_handling_spec.rb +83 -0
- data/spec/acceptance/fps_actor_spec.rb +40 -0
- data/spec/acceptance/pausing_spec.rb +61 -0
- data/spec/acceptance/timer_usage_spec.rb +53 -0
- data/spec/actors/emitter_spec.rb +5 -0
- data/spec/{label_spec.rb → actors/label_spec.rb} +1 -1
- data/spec/behaviors/animated_spec.rb +85 -0
- data/spec/behaviors/collidable_spec.rb +134 -0
- data/spec/{physical_spec.rb → behaviors/physical_spec.rb} +2 -1
- data/spec/behaviors/positioned_spec.rb +6 -0
- data/spec/behaviors/projectile_spec.rb +6 -0
- data/spec/core/aabb_tree_spec.rb +109 -0
- data/spec/core/actor_factory_spec.rb +44 -0
- data/spec/core/actor_spec.rb +78 -0
- data/spec/core/actor_view_spec.rb +53 -0
- data/spec/{arbiter_spec.rb → core/arbiter_spec.rb} +29 -30
- data/spec/core/backstage_spec.rb +37 -0
- data/spec/core/behavior_factory_spec.rb +50 -0
- data/spec/core/behavior_spec.rb +8 -0
- data/spec/core/configuration_spec.rb +8 -0
- data/spec/core/core_spec.rb +13 -0
- data/spec/core/font_style_factory_spec.rb +17 -0
- data/spec/core/font_style_spec.rb +41 -0
- data/spec/core/hooked_gosu_window_spec.rb +75 -0
- data/spec/core/input_manager_spec.rb +285 -0
- data/spec/core/physics_manager_spec.rb +11 -0
- data/spec/core/resource_manager_spec.rb +12 -0
- data/spec/core/stage_manager_spec.rb +140 -0
- data/spec/core/stage_spec.rb +73 -0
- data/spec/core/timer_manager_spec.rb +89 -0
- data/spec/{viewport_spec.rb → core/viewport_spec.rb} +6 -3
- data/spec/core/wrapped_screen_spec.rb +26 -0
- data/spec/fixtures/game.yml +7 -0
- data/spec/fixtures/snelpling/idle/1.png +0 -0
- data/spec/fixtures/snelpling/jump/1.png +0 -0
- data/spec/fixtures/snelpling/jump/2.png +0 -0
- data/spec/fixtures/snelpling/jump/3.png +0 -0
- data/spec/helper.rb +8 -0
- data/spec/{class_finder_spec.rb → lib/class_finder_spec.rb} +2 -1
- data/spec/stagehands/spatial_tree_stagehand_spec.rb +19 -0
- data/spec/views/graphical_actor_view_spec.rb +116 -0
- metadata +343 -144
- data/README.txt +0 -34
- data/lib/gamebox/actor.rb +0 -179
- data/lib/gamebox/actor_factory.rb +0 -57
- data/lib/gamebox/actor_view.rb +0 -44
- data/lib/gamebox/actors/spatial_debugger.rb +0 -62
- data/lib/gamebox/behavior.rb +0 -70
- data/lib/gamebox/behaviors/timed.rb +0 -33
- data/lib/gamebox/behaviors/updatable.rb +0 -12
- data/lib/gamebox/console_app.rb +0 -41
- data/lib/gamebox/gamebox_generator.rb +0 -32
- data/lib/gamebox/generators/actor_generator.rb +0 -43
- data/lib/gamebox/generators/view_generator.rb +0 -42
- data/lib/gamebox/physical_director.rb +0 -17
- data/lib/gamebox/physics.rb +0 -32
- data/lib/gamebox/spatial_bucket.rb +0 -9
- data/lib/gamebox/spatial_hash.rb +0 -194
- data/lib/gamebox/spatial_stagehand.rb +0 -80
- data/lib/gamebox/templates/template_app/Gemfile +0 -6
- data/lib/gamebox/templates/template_app/config/environment.rb +0 -23
- data/lib/gamebox/templates/template_app/config/stage_config.yml +0 -2
- data/lib/gamebox/templates/template_app/script/generate +0 -7
- data/lib/gamebox/templates/template_app/src/demo_stage.rb +0 -11
- data/lib/gamebox/templates/template_app/src/game.rb +0 -19
- data/lib/gamebox/templates/template_app/src/my_actor.rb +0 -14
- data/script/perf_spatial_hash.rb +0 -64
- data/spec/actor_factory_spec.rb +0 -61
- data/spec/actor_spec.rb +0 -71
- data/spec/actor_view_spec.rb +0 -61
- data/spec/animated_spec.rb +0 -83
- data/spec/backstage_spec.rb +0 -45
- data/spec/behavior_spec.rb +0 -28
- data/spec/collidable_spec.rb +0 -135
- data/spec/emitter_spec.rb +0 -20
- data/spec/input_manager_spec.rb +0 -134
- data/spec/resource_manager_spec.rb +0 -13
- data/spec/spatial_hash_spec.rb +0 -119
- data/spec/spatial_stagehand_spec.rb +0 -93
- data/spec/stage_manager_spec.rb +0 -25
- data/spec/stage_spec.rb +0 -65
@@ -1,93 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),'helper')
|
2
|
-
|
3
|
-
describe 'a new SpacialStagehand' do
|
4
|
-
before do
|
5
|
-
@target = SpatialStagehand.new :stage, {}
|
6
|
-
@hash = @target.instance_variable_get("@spatial_actors")
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "it constructs" do
|
10
|
-
it 'should be constructable with default params' do
|
11
|
-
@target.cell_size.should == 50
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'passes on cell_size' do
|
15
|
-
@target = SpatialStagehand.new :stage, {:cell_size => 99}
|
16
|
-
@target.cell_size.should == 99
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#cell_size" do
|
21
|
-
it "returns the cell size" do
|
22
|
-
@hash.cell_size = 42
|
23
|
-
@target.cell_size.should == 42
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#auto_resize" do
|
28
|
-
it "returns the resize setting" do
|
29
|
-
@hash.auto_resize = :resize
|
30
|
-
@target.auto_resize.should == :resize
|
31
|
-
end
|
32
|
-
|
33
|
-
it "sets the resize setting" do
|
34
|
-
@target.auto_resize = :resize
|
35
|
-
@hash.auto_resize.should == :resize
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#moved_items" do
|
40
|
-
it "returns all the moved items" do
|
41
|
-
@hash.instance_variable_set("@moved_items", :moved_items => :moved_items)
|
42
|
-
@target.moved_items.should == [:moved_items]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#items" do
|
47
|
-
it "returns all the items" do
|
48
|
-
@hash.instance_variable_set("@items", :items => :items)
|
49
|
-
@target.items.should == [:items]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "#buckets" do
|
54
|
-
it "returns all the buckets" do
|
55
|
-
@hash.instance_variable_set("@buckets", :buckets)
|
56
|
-
@target.buckets.should == :buckets
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "#add" do
|
61
|
-
it 'should add the actor to the hash' do
|
62
|
-
@actor = stub(:when)
|
63
|
-
@hash.expects(:add).with(@actor)
|
64
|
-
@target.add(@actor)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "#remove" do
|
69
|
-
it "removes the actor from the hash" do
|
70
|
-
@hash.expects(:remove).with(:actor)
|
71
|
-
@target.remove(:actor)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "#items_at" do
|
76
|
-
it "calls through to hash" do
|
77
|
-
@hash.expects(:items_at).with(:x, :y)
|
78
|
-
@target.items_at(:x,:y)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
describe "#items_in" do
|
82
|
-
it "calls through to hash" do
|
83
|
-
@hash.expects(:items_in).with(:x, :y, :w, :h)
|
84
|
-
@target.items_in(:x,:y, :w, :h)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
describe "#neighbors_of" do
|
88
|
-
it "calls through to hash" do
|
89
|
-
@hash.expects(:neighbors_of).with(:actor, 3)
|
90
|
-
@target.neighbors_of(:actor, 3)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
data/spec/stage_manager_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),'helper')
|
2
|
-
|
3
|
-
describe 'A new stage manager' do
|
4
|
-
before do
|
5
|
-
# opts = {:resource_manager => stub, :actor_factory => stub, :input_manager => stub,
|
6
|
-
# :sound_manager => stub, :config_manager => stub}
|
7
|
-
# @stage_manager = StageManager.new opts
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should construct' #do
|
11
|
-
# @stage_manager.should_not be_nil
|
12
|
-
# end
|
13
|
-
|
14
|
-
describe '#prev_stage' do
|
15
|
-
it 'should exit on prev_stage of first stage'
|
16
|
-
it 'should go to prev stage'
|
17
|
-
end
|
18
|
-
describe '#next_stage' do
|
19
|
-
it 'should exit on next_stage of last stage'
|
20
|
-
it 'should go to next stage'
|
21
|
-
end
|
22
|
-
describe '#restart_stage' do
|
23
|
-
it 'should restart the current stage'
|
24
|
-
end
|
25
|
-
end
|
data/spec/stage_spec.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),'helper')
|
2
|
-
|
3
|
-
|
4
|
-
describe 'A new stage' do
|
5
|
-
FakeDrawable = Struct.new :layer, :parallax
|
6
|
-
|
7
|
-
before do
|
8
|
-
@config = {:screen_resolution => [800,600] }
|
9
|
-
@actor_factory = stub(:director= => nil)
|
10
|
-
@stage = Stage.new :input_manager, @actor_factory,
|
11
|
-
:resource_manager, :sound_manager, @config, :backstage, {}
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should construct' do
|
15
|
-
@stage.should_not be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should have access to backstage' do
|
19
|
-
@stage.backstage.should == :backstage
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should register drawables by parallax and layer'
|
23
|
-
it 'should unregister drawables by parallax and layer'
|
24
|
-
it 'should draw drawables by parallax and layers' do
|
25
|
-
a = FakeDrawable.new
|
26
|
-
b = FakeDrawable.new
|
27
|
-
c = FakeDrawable.new
|
28
|
-
d = FakeDrawable.new
|
29
|
-
e = FakeDrawable.new
|
30
|
-
f = FakeDrawable.new
|
31
|
-
x = FakeDrawable.new
|
32
|
-
y = FakeDrawable.new
|
33
|
-
z = FakeDrawable.new
|
34
|
-
@stage.drawables = {
|
35
|
-
2 => {3=> [a,b,c]},
|
36
|
-
6 => {7=> [d,e,f]},
|
37
|
-
9 => {13=> [x,y,z]},
|
38
|
-
}
|
39
|
-
@stage.move_layer(2, 3, 6, 7).should == [d,e,f]
|
40
|
-
@stage.drawables[6][7].should_not be_nil
|
41
|
-
@stage.drawables[6][7].should == [a,b,c]
|
42
|
-
@stage.drawables[2][3].should be_nil
|
43
|
-
end
|
44
|
-
it 'should move drawables layers' do
|
45
|
-
|
46
|
-
a = FakeDrawable.new
|
47
|
-
b = FakeDrawable.new
|
48
|
-
c = FakeDrawable.new
|
49
|
-
d = FakeDrawable.new
|
50
|
-
e = FakeDrawable.new
|
51
|
-
f = FakeDrawable.new
|
52
|
-
x = FakeDrawable.new
|
53
|
-
y = FakeDrawable.new
|
54
|
-
z = FakeDrawable.new
|
55
|
-
@stage.drawables = {
|
56
|
-
2 => {3=> [a,b,c]},
|
57
|
-
6 => {7=> [d,e,f]},
|
58
|
-
9 => {13=> [x,y,z]},
|
59
|
-
}
|
60
|
-
@stage.move_layer(2, 3, 6, 7).should == [d,e,f]
|
61
|
-
@stage.drawables[6][7].should_not be_nil
|
62
|
-
@stage.drawables[6][7].should == [a,b,c]
|
63
|
-
@stage.drawables[2][3].should be_nil
|
64
|
-
end
|
65
|
-
end
|