gamebox 0.4.0.rc5 → 0.4.0.rc11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/README.md +205 -127
  2. data/bin/gamebox +49 -3
  3. data/bin/gb +87 -0
  4. data/gamebox.gemspec +4 -3
  5. data/lib/gamebox.rb +1 -1
  6. data/lib/gamebox/actors/collidable_debugger.rb +4 -4
  7. data/lib/gamebox/actors/icon.rb +7 -0
  8. data/lib/gamebox/actors/label.rb +41 -42
  9. data/lib/gamebox/behaviors/animated.rb +6 -0
  10. data/lib/gamebox/behaviors/audible.rb +1 -2
  11. data/lib/gamebox/behaviors/collidable.rb +1 -1
  12. data/lib/gamebox/behaviors/graphical.rb +8 -4
  13. data/lib/gamebox/behaviors/physical.rb +6 -1
  14. data/lib/gamebox/behaviors/positioned.rb +4 -11
  15. data/lib/gamebox/behaviors/projectile.rb +8 -0
  16. data/lib/gamebox/behaviors/visible.rb +3 -3
  17. data/lib/gamebox/core/aabb_tree.rb +1 -1
  18. data/lib/gamebox/core/actor.rb +37 -50
  19. data/lib/gamebox/core/actor_definition.rb +41 -0
  20. data/lib/gamebox/core/actor_view.rb +6 -21
  21. data/lib/gamebox/core/actor_view_definition.rb +19 -0
  22. data/lib/gamebox/core/actor_view_factory.rb +9 -3
  23. data/lib/gamebox/core/behavior.rb +8 -27
  24. data/lib/gamebox/core/behavior_definition.rb +24 -0
  25. data/lib/gamebox/core/config_manager.rb +45 -30
  26. data/lib/gamebox/core/configuration.rb +5 -0
  27. data/lib/gamebox/core/core.rb +4 -0
  28. data/lib/gamebox/core/debug_helpers.rb +46 -0
  29. data/lib/gamebox/core/director.rb +32 -5
  30. data/lib/gamebox/core/event_symbols.rb +214 -0
  31. data/lib/gamebox/core/game.rb +1 -1
  32. data/lib/gamebox/core/input_manager.rb +1 -4
  33. data/lib/gamebox/core/input_mapper.rb +85 -0
  34. data/lib/gamebox/core/physics.rb +7 -3
  35. data/lib/gamebox/core/physics_manager.rb +5 -1
  36. data/lib/gamebox/core/renderer.rb +72 -0
  37. data/lib/gamebox/core/stage.rb +25 -81
  38. data/lib/gamebox/core/stage_definition.rb +60 -0
  39. data/lib/gamebox/core/stage_factory.rb +56 -0
  40. data/lib/gamebox/core/stage_manager.rb +5 -11
  41. data/lib/gamebox/core/timer_manager.rb +6 -2
  42. data/lib/gamebox/core/viewport.rb +12 -5
  43. data/lib/gamebox/core/wrapped_screen.rb +8 -5
  44. data/lib/gamebox/gamebox_application.rb +21 -19
  45. data/lib/gamebox/lib/array_ext.rb +9 -0
  46. data/lib/gamebox/lib/observable_attributes.rb +24 -0
  47. data/lib/gamebox/lib/vector2.rb +432 -0
  48. data/lib/gamebox/post_setup_handlers/file_watcher.rb +37 -0
  49. data/lib/gamebox/post_setup_handlers/gamebox_debug_helpers.rb +13 -0
  50. data/lib/gamebox/post_setup_handlers/pry_remote_server.rb +29 -0
  51. data/lib/gamebox/spec/helper.rb +165 -17
  52. data/lib/gamebox/tasks/gamebox_tasks.rake +27 -12
  53. data/lib/gamebox/version.rb +1 -1
  54. data/lib/gamebox/views/graphical_actor_view.rb +4 -5
  55. data/script/perf_aabb.rb +13 -8
  56. data/spec/acceptance/animation_spec.rb +1 -3
  57. data/spec/acceptance/basic_actor_lifecycle_spec.rb +1 -1
  58. data/spec/acceptance/fps_actor_spec.rb +8 -12
  59. data/spec/acceptance/input_mapper_spec.rb +17 -24
  60. data/spec/acceptance/update_ordering_spec.rb +64 -0
  61. data/spec/actors/label_spec.rb +90 -5
  62. data/spec/behaviors/animated_spec.rb +1 -1
  63. data/spec/behaviors/collidable_spec.rb +7 -15
  64. data/spec/behaviors/positioned_spec.rb +12 -5
  65. data/spec/core/actor_spec.rb +31 -3
  66. data/spec/core/actor_view_spec.rb +1 -1
  67. data/spec/core/behavior_spec.rb +3 -0
  68. data/spec/core/configuration_spec.rb +49 -2
  69. data/spec/core/input_mapper_spec.rb +7 -0
  70. data/spec/core/renderer_spec.rb +89 -0
  71. data/spec/core/stage_definition_spec.rb +41 -0
  72. data/spec/core/stage_manager_spec.rb +11 -11
  73. data/spec/core/stage_spec.rb +38 -78
  74. data/spec/core/viewport_spec.rb +5 -2
  75. data/spec/core/wrapped_screen_spec.rb +18 -12
  76. data/spec/views/graphical_actor_view_spec.rb +33 -62
  77. data/templates/actor_template.erb +11 -0
  78. data/templates/app/README.md +1 -0
  79. data/templates/app/src/actors/{player.rb → player_actor.rb} +3 -1
  80. data/templates/app/src/behaviors/.gitkeep +0 -0
  81. data/templates/app/src/stages/demo_stage.rb +14 -0
  82. data/templates/behavior_template.erb +13 -0
  83. data/templates/stage_template.erb +13 -0
  84. metadata +60 -21
  85. data/component_generators/actor_generator.rb +0 -17
  86. data/lib/gamebox/actors/emitter.rb +0 -12
  87. data/lib/gamebox/behaviors/emitting.rb +0 -48
  88. data/lib/gamebox/behaviors/input_mapper.rb +0 -11
  89. data/lib/gamebox/lib/ftor.rb +0 -372
  90. data/spec/actors/emitter_spec.rb +0 -5
  91. data/templates/app/NEXT_STEPS.txt +0 -1
  92. data/templates/app/README.rdoc +0 -24
  93. data/templates/app/src/demo_stage.rb +0 -7
@@ -7,10 +7,10 @@ describe :positioned do
7
7
  let(:subcontext) do
8
8
  it = nil
9
9
  Conject.default_object_context.in_subcontext{|ctx|it = ctx};
10
+ it[:director] = director
10
11
  _mocks = create_mocks *(Actor.object_definition.component_names + ActorView.object_definition.component_names - [:actor, :behavior, :this_object_context])
11
12
  _mocks.each do |k,v|
12
13
  it[k] = v
13
- it[:director] = director
14
14
  end
15
15
  it
16
16
  end
@@ -25,13 +25,20 @@ describe :positioned do
25
25
  end
26
26
  end
27
27
 
28
- it 'rolls up x and y changes to position_changed on update' do
28
+ it 'keeps position up to date w/ x and y' do
29
29
  subject
30
+ called = 0
31
+ actor.when(:position_changed) do
32
+ called += 1
33
+ end
30
34
  actor.x = 99
35
+ called.should == 1
31
36
 
32
- expects_event(actor, :position_changed) do
33
- director.fire :update, 50
34
- end
37
+ actor.y = 8
38
+
39
+ called.should == 2
40
+ actor.position.x.should == 99
41
+ actor.position.y.should == 8
35
42
  end
36
43
 
37
44
  context "options passed in" do
@@ -1,15 +1,36 @@
1
1
  require 'helper'
2
2
  describe Actor do
3
3
 
4
- subject { create_actor :actor }
4
+ inject_mocks :this_object_context
5
+
5
6
  let(:behavior) { stub(react_to: nil) }
6
7
 
7
8
  it 'is alive' do
8
9
  subject.should be_alive
9
10
  end
10
11
 
11
- it 'has the correct type' do
12
- subject.actor_type.should == :actor
12
+ describe "#configure" do
13
+ it 'sets up observable attributes' do
14
+ subject.configure(x: 12)
15
+ subject.x.should == 12
16
+ previous_x = nil
17
+ next_x = nil
18
+
19
+ subject.when :x_changed do |old_x, new_x|
20
+ previous_x = old_x
21
+ next_x = new_x
22
+ end
23
+
24
+ subject.x = 22
25
+ subject.x.should == 22
26
+ previous_x.should == 12
27
+ next_x.should == 22
28
+ end
29
+
30
+ it 'sets actor type' do
31
+ subject.configure(actor_type: :monkey)
32
+ subject.actor_type.should == :monkey
33
+ end
13
34
  end
14
35
 
15
36
  it 'fires anything' do
@@ -27,6 +48,13 @@ describe Actor do
27
48
  end
28
49
  end
29
50
 
51
+ describe "#input" do
52
+ it 'pulls an input mapper from the context' do
53
+ @this_object_context.stubs(:[]).with(:input_mapper).returns(:mapz)
54
+ subject.input.should == :mapz
55
+ end
56
+ end
57
+
30
58
  describe "#remove_behavior" do
31
59
  it 'removes a behavior to the actors list of behaviors' do
32
60
  subject.add_behavior :foo, behavior
@@ -5,7 +5,7 @@ describe ActorView do
5
5
  let!(:subcontext) do
6
6
  it = nil
7
7
  Conject.default_object_context.in_subcontext{|ctx|it = ctx};
8
- _mocks = create_mocks *(Actor.object_definition.component_names + ActorView.object_definition.component_names - [:actor])
8
+ _mocks = create_mocks *(Actor.object_definition.component_names + ActorView.object_definition.component_names - [:actor, :this_object_context])
9
9
  _mocks.each do |k,v|
10
10
  it[k] = v
11
11
  end
@@ -8,5 +8,8 @@ describe Behavior do
8
8
  describe "#add_behavior" do
9
9
  it 'uses the behavior factory to add the behavior to the actor'
10
10
  end
11
+ describe "#remove_behavior" do
12
+ it 'tells the actor to drop a behavior by name'
13
+ end
11
14
 
12
15
  end
@@ -2,7 +2,54 @@ require 'helper'
2
2
 
3
3
  describe Gamebox::Configuration do
4
4
  describe ".add_setting" do
5
- it 'works with all the gamebox settings'
6
- it 'can add custom settings'
5
+ it 'can add custom settings' do
6
+ described_class.add_setting :foopy
7
+
8
+ subject.foopy.should_not be
9
+ subject.foopy?.should_not be
10
+ subject.foopy = :yep
11
+ subject.foopy.should == :yep
12
+ end
7
13
  end
14
+
15
+ describe "gamebox settings" do
16
+ it 'has all the settings' do
17
+ [ :config_path,
18
+ :data_path,
19
+ :music_path,
20
+ :sound_path,
21
+ :gfx_path,
22
+ :fonts_path,
23
+ :gb_config_path,
24
+ :gb_data_path,
25
+ :gb_music_path,
26
+ :gb_sound_path,
27
+ :gb_gfx_path,
28
+ :gb_fonts_path,
29
+ :game_name,
30
+ :needs_cursor,
31
+ :stages ].each do |setting|
32
+ subject.should respond_to(setting)
33
+ end
34
+ end
35
+
36
+ describe "game_name" do
37
+ it 'has default value' do
38
+ subject.game_name.should == "Untitled Game"
39
+ end
40
+ end
41
+
42
+ describe "needs_cursor" do
43
+ it 'has default value' do
44
+ subject.needs_cursor.should be_false
45
+ end
46
+ end
47
+
48
+ describe "stages" do
49
+ it 'has default value' do
50
+ subject.stages.should == [:demo]
51
+ end
52
+ end
53
+ end
54
+
8
55
  end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+ describe InputMapper do
3
+ describe '#map_input' do
4
+ it 'registers single up / down keys'
5
+ it 'registers the same key to many actions'
6
+ end
7
+ end
@@ -0,0 +1,89 @@
1
+ require 'helper'
2
+
3
+ describe Renderer do
4
+ inject_mocks :viewport
5
+
6
+ let(:a) { stub('a', layer: 0, parallax: 0) }
7
+ let(:b) { stub('b', layer: 0, parallax: 0) }
8
+
9
+ let(:c) { stub('c', layer: 1, parallax: 0) }
10
+ let(:d) { stub('d', layer: 2, parallax: 0) }
11
+ let(:e) { stub('e', layer: 3, parallax: 0) }
12
+ let(:f) { stub('f', layer: 4, parallax: 0) }
13
+
14
+ let(:x) { stub('x', layer: 0, parallax: 1) }
15
+ let(:y) { stub('y', layer: 2, parallax: 1) }
16
+
17
+ let(:z) { stub('z', layer: 0, parallax: 3) }
18
+ let(:target) { stub }
19
+ let(:viewport) { @viewport }
20
+
21
+ before do
22
+ viewport.stubs width: 400, height: 300, rotation: Math::PI
23
+ target.stubs(:rotate).yields
24
+ viewport.stubs(:x_offset).with(0).returns(:trans_x_zero)
25
+ viewport.stubs(:y_offset).with(0).returns(:trans_y_zero)
26
+ viewport.stubs(:x_offset).with(1).returns(:trans_x_one)
27
+ viewport.stubs(:y_offset).with(1).returns(:trans_y_one)
28
+ viewport.stubs(:x_offset).with(3).returns(:trans_x_three)
29
+ viewport.stubs(:y_offset).with(3).returns(:trans_y_three)
30
+ end
31
+
32
+ it 'registers and draws drawables by parallax and layers' do
33
+ target.expects(:rotate).with(-Math::PI, 200, 150).yields
34
+ subject.register_drawable a
35
+ subject.register_drawable b
36
+ subject.register_drawable c
37
+ subject.register_drawable d
38
+ subject.register_drawable e
39
+ subject.register_drawable f
40
+ subject.register_drawable x
41
+ subject.register_drawable y
42
+ subject.register_drawable z
43
+
44
+ a.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 4)
45
+ b.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 4)
46
+ c.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 5)
47
+ d.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 6)
48
+ e.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 7)
49
+ f.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 8)
50
+ x.expects(:draw).with(target, :trans_x_one, :trans_y_one, 2)
51
+ y.expects(:draw).with(target, :trans_x_one, :trans_y_one, 3)
52
+ z.expects(:draw).with(target, :trans_x_three, :trans_y_three, 1)
53
+
54
+ subject.draw(target)
55
+ end
56
+
57
+ it 'should unregister drawables by parallax and layer' do
58
+ subject.register_drawable a
59
+ subject.register_drawable b
60
+
61
+ subject.unregister_drawable a
62
+ b.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 1)
63
+
64
+ subject.draw(target)
65
+ end
66
+
67
+ it 'should move drawables layers' do
68
+ subject.register_drawable a
69
+ subject.register_drawable b
70
+ subject.register_drawable x
71
+ subject.register_drawable y
72
+
73
+ a.expects(:parallax=).with(1)
74
+ b.expects(:parallax=).with(1)
75
+ a.expects(:layer=).with(4)
76
+ b.expects(:layer=).with(4)
77
+
78
+ subject.move_layer 0, 0, 1, 4
79
+
80
+ a.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 3)
81
+ b.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 3)
82
+ x.expects(:draw).with(target, :trans_x_one, :trans_y_one, 1)
83
+ y.expects(:draw).with(target, :trans_x_one, :trans_y_one, 2)
84
+
85
+ subject.draw(target)
86
+ end
87
+
88
+
89
+ end
@@ -0,0 +1,41 @@
1
+ require 'helper'
2
+
3
+ describe StageDefinition do
4
+ let(:some_block) { Proc.new {} }
5
+
6
+ describe "#requires" do
7
+ it 'assigns the required injections' do
8
+ subject.requires(:a, :b)
9
+ subject.required_injections.should == [:a, :b]
10
+ end
11
+ end
12
+
13
+ describe "#curtain_up" do
14
+ it 'stores the block' do
15
+ subject.curtain_up &some_block
16
+ subject.curtain_up_block.should == some_block
17
+ end
18
+ end
19
+
20
+ describe "#curtain_down" do
21
+ it 'stores the block' do
22
+ subject.curtain_down &some_block
23
+ subject.curtain_down_block.should == some_block
24
+ end
25
+ end
26
+
27
+ describe "#render_with" do
28
+ it 'stores the renderer name' do
29
+ subject.render_with :foopy
30
+ subject.renderer.should == :foopy
31
+ end
32
+ end
33
+
34
+ describe "#helpers" do
35
+ it 'stores the block' do
36
+ subject.helpers &some_block
37
+ subject.helpers_block.should == some_block
38
+ end
39
+ end
40
+
41
+ end
@@ -1,14 +1,14 @@
1
1
  require 'helper'
2
2
 
3
3
  describe StageManager do
4
- inject_mocks :input_manager, :config_manager, :backstage,
4
+ inject_mocks :input_manager, :config_manager, :stage_factory,
5
5
  :this_object_context
6
6
 
7
7
  class FooStage; end
8
8
  class BarStage; end
9
9
 
10
- let(:foo_stage) { stub('foo stage', when: nil, curtain_raising: nil, curtain_dropping: nil) }
11
- let(:bar_stage) { stub('bar stage', when: nil, curtain_raising: nil, curtain_dropping: nil) }
10
+ let(:foo_stage) { stub('foo stage', when: nil, curtain_up: nil, curtain_down: nil) }
11
+ let(:bar_stage) { stub('bar stage', when: nil, curtain_up: nil, curtain_down: nil) }
12
12
  let(:foo_stage_config) { {foo: {thing:1} } }
13
13
  let(:bar_stage_config) { {bar: {thing:2} } }
14
14
  let(:stages) { [foo_stage_config, bar_stage_config] }
@@ -21,9 +21,9 @@ describe StageManager do
21
21
  subcontext.stubs(:[]).with('foo_stage').returns(foo_stage)
22
22
  subcontext.stubs(:[]).with('bar_stage').returns(bar_stage)
23
23
  subcontext.stubs(:[]=)
24
- foo_stage.stubs(:configure).with(@backstage, {thing:1})
25
- bar_stage.stubs(:configure).with(@backstage, {thing:2})
26
24
  @this_object_context.stubs(:in_subcontext).yields(subcontext)
25
+ @stage_factory.stubs(:build).with(:foo, anything).returns(foo_stage)
26
+ @stage_factory.stubs(:build).with(:bar, anything).returns(bar_stage)
27
27
  end
28
28
 
29
29
  describe '#setup' do
@@ -52,12 +52,12 @@ describe StageManager do
52
52
  end
53
53
 
54
54
  it 'raises the curtain on the new stage' do
55
- foo_stage.expects(:curtain_raising).with(:args)
55
+ foo_stage.expects(:curtain_up).with(:args)
56
56
  subject.switch_to_stage :foo, :args
57
57
  end
58
58
 
59
59
  it 'shuts down the current stage' do
60
- foo_stage.expects(:curtain_dropping).with(:other_args)
60
+ foo_stage.expects(:curtain_down).with(:other_args)
61
61
  @input_manager.expects(:clear_hooks).with(foo_stage)
62
62
  subject.switch_to_stage :foo, :args
63
63
  subject.switch_to_stage :bar, :other_args
@@ -67,7 +67,7 @@ describe StageManager do
67
67
  describe '#prev_stage' do
68
68
  it 'goes to prev stage' do
69
69
  subject.switch_to_stage :bar
70
- foo_stage.expects(:curtain_raising).with(:args)
70
+ foo_stage.expects(:curtain_up).with(:args)
71
71
 
72
72
  subject.prev_stage :args
73
73
  subject.current_stage.should == foo_stage
@@ -82,7 +82,7 @@ describe StageManager do
82
82
  describe '#next_stage' do
83
83
  it 'goes to next stage' do
84
84
  subject.switch_to_stage :foo
85
- bar_stage.expects(:curtain_raising).with(:args)
85
+ bar_stage.expects(:curtain_up).with(:args)
86
86
 
87
87
  subject.next_stage :args
88
88
  subject.current_stage.should == bar_stage
@@ -98,7 +98,7 @@ describe StageManager do
98
98
  it 'restarts the current stage' do
99
99
  subject.switch_to_stage :foo, :args
100
100
 
101
- foo_stage.expects(:curtain_raising).with(:other_args)
101
+ foo_stage.expects(:curtain_up).with(:other_args)
102
102
  subject.restart_stage :other_args
103
103
  end
104
104
  end
@@ -123,7 +123,7 @@ describe StageManager do
123
123
 
124
124
  it 'draws the current stage' do
125
125
 
126
- subcontext.expects(:[]=).with(:stage, foo_stage)
126
+ @stage_factory.stubs(:build).with(:foo, :args).returns(foo_stage)
127
127
  subject.switch_to_stage :foo, :args
128
128
  foo_stage.expects(:draw).with(:target)
129
129
 
@@ -3,99 +3,59 @@ require 'helper'
3
3
  describe Stage do
4
4
  inject_mocks :input_manager, :actor_factory, :resource_manager,
5
5
  :sound_manager, :config_manager, :director, :this_object_context,
6
- :timer_manager
7
-
8
- let(:a) { stub('a', layer: 0, parallax: 0) }
9
- let(:b) { stub('b', layer: 0, parallax: 0) }
10
-
11
- let(:c) { stub('c', layer: 1, parallax: 0) }
12
- let(:d) { stub('d', layer: 2, parallax: 0) }
13
- let(:e) { stub('e', layer: 3, parallax: 0) }
14
- let(:f) { stub('f', layer: 4, parallax: 0) }
15
-
16
- let(:x) { stub('x', layer: 0, parallax: 1) }
17
- let(:y) { stub('y', layer: 2, parallax: 1) }
18
-
19
- let(:z) { stub('z', layer: 0, parallax: 3) }
20
- let(:target) { stub }
21
- let(:viewport) { stub }
6
+ :timer_manager, :viewport
22
7
 
23
8
  before do
24
- @config_manager.stubs(:[]).with(:screen_resolution).returns([800,600])
25
- @actor_factory.stubs(:director=)
26
- Viewport.stubs(:new).with(800, 600).returns(viewport)
27
- @this_object_context.expects(:[]=).with(:viewport, viewport)
28
- subject.configure(:backstage, {})
9
+ @renderer = stub('renderer', :clear_drawables)
10
+ subject.stubs(:renderer).returns @renderer
29
11
 
30
- viewport.stubs(:x_offset).with(0).returns(:trans_x_zero)
31
- viewport.stubs(:y_offset).with(0).returns(:trans_y_zero)
32
- viewport.stubs(:x_offset).with(1).returns(:trans_x_one)
33
- viewport.stubs(:y_offset).with(1).returns(:trans_y_one)
34
- viewport.stubs(:x_offset).with(3).returns(:trans_x_three)
35
- viewport.stubs(:y_offset).with(3).returns(:trans_y_three)
12
+ @viewport.stubs(:reset)
13
+ subject.configure(:backstage, {})
36
14
  end
37
15
 
38
- it 'should construct' do
39
- subject.should_not be_nil
40
- end
16
+ describe "#configure" do
41
17
 
42
- it 'should have access to backstage' do
43
- subject.backstage.should == :backstage
18
+ it 'assigns backstage' do
19
+ subject.backstage.should == :backstage
20
+ end
44
21
  end
45
22
 
46
- it 'registers and draws drawables by parallax and layers' do
47
- subject.register_drawable a
48
- subject.register_drawable b
49
- subject.register_drawable c
50
- subject.register_drawable d
51
- subject.register_drawable e
52
- subject.register_drawable f
53
- subject.register_drawable x
54
- subject.register_drawable y
55
- subject.register_drawable z
56
-
57
- a.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 4)
58
- b.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 4)
59
- c.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 5)
60
- d.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 6)
61
- e.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 7)
62
- f.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 8)
63
- x.expects(:draw).with(target, :trans_x_one, :trans_y_one, 2)
64
- y.expects(:draw).with(target, :trans_x_one, :trans_y_one, 3)
65
- z.expects(:draw).with(target, :trans_x_three, :trans_y_three, 1)
66
-
67
- subject.draw(target)
23
+ describe "#create_actor" do
24
+ it 'uses the actor factory to create an actor' do
25
+ @actor_factory.stubs(:build).with(:foo, :bar).returns(:my_new_actor)
26
+ subject.create_actor(:foo, :bar).should == :my_new_actor
27
+ end
68
28
  end
69
29
 
70
- it 'should unregister drawables by parallax and layer' do
71
- subject.register_drawable a
72
- subject.register_drawable b
73
-
74
- subject.unregister_drawable a
75
- b.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 1)
76
-
77
- subject.draw(target)
30
+ describe "#spawn" do
31
+ it 'uses the actor factory to create an actor' do
32
+ @actor_factory.stubs(:build).with(:foo, :bar).returns(:my_new_actor)
33
+ subject.spawn(:foo, :bar).should == :my_new_actor
34
+ end
78
35
  end
79
36
 
80
- it 'should move drawables layers' do
81
- subject.register_drawable a
82
- subject.register_drawable b
83
- subject.register_drawable x
84
- subject.register_drawable y
85
-
86
- a.expects(:parallax=).with(1)
87
- b.expects(:parallax=).with(1)
88
- a.expects(:layer=).with(4)
89
- b.expects(:layer=).with(4)
37
+ describe "#create_actors_from_svg" do
38
+ it 'maybe sticks around?'
39
+ end
90
40
 
91
- subject.move_layer 0, 0, 1, 4
41
+ describe "#draw" do
42
+ it 'passes through to the renderer' do
43
+ @renderer.expects(:draw).with(:target)
44
+ subject.draw(:target)
45
+ end
46
+ end
92
47
 
93
- a.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 3)
94
- b.expects(:draw).with(target, :trans_x_zero, :trans_y_zero, 3)
95
- x.expects(:draw).with(target, :trans_x_one, :trans_y_one, 1)
96
- y.expects(:draw).with(target, :trans_x_one, :trans_y_one, 2)
48
+ describe "#update" do
49
+ it 'distributes the update' do
50
+ @director.expects(:update).with(:time)
51
+ @viewport.expects(:update).with(:time)
52
+ @timer_manager.expects(:update).with(:time)
53
+ subject.update(:time)
54
+ end
97
55
 
98
- subject.draw(target)
56
+ it 'updates stagehands'
57
+ it 'checks for collisions'
99
58
  end
100
59
 
60
+
101
61
  end