gamebox 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/History.txt +14 -0
  2. data/Manifest.txt +40 -37
  3. data/README.txt +2 -2
  4. data/Rakefile +27 -20
  5. data/TODO.txt +8 -8
  6. data/bin/gamebox +7 -1
  7. data/docs/getting_started.rdoc +2 -5
  8. data/docs/logo.png +0 -0
  9. data/lib/gamebox.rb +12 -1
  10. data/lib/gamebox/actor.rb +34 -9
  11. data/lib/gamebox/actor_factory.rb +25 -14
  12. data/lib/gamebox/actor_view.rb +6 -6
  13. data/lib/gamebox/{logo.rb → actors/logo.rb} +0 -0
  14. data/lib/gamebox/{score.rb → actors/score.rb} +2 -1
  15. data/lib/gamebox/{svg_actor.rb → actors/svg_actor.rb} +3 -4
  16. data/lib/gamebox/ai/polaris.rb +2 -0
  17. data/lib/gamebox/behavior.rb +3 -0
  18. data/lib/gamebox/{animated.rb → behaviors/animated.rb} +13 -5
  19. data/lib/gamebox/{graphical.rb → behaviors/graphical.rb} +11 -1
  20. data/lib/gamebox/{layered.rb → behaviors/layered.rb} +14 -0
  21. data/lib/gamebox/{physical.rb → behaviors/physical.rb} +41 -14
  22. data/lib/gamebox/{updatable.rb → behaviors/updatable.rb} +1 -1
  23. data/lib/gamebox/{templates/template_app → data}/config/objects.yml +4 -2
  24. data/lib/gamebox/data/graphics/logo.png +0 -0
  25. data/lib/gamebox/event_compat.rb +285 -0
  26. data/lib/gamebox/ftor.rb +2 -0
  27. data/lib/gamebox/gamebox_application.rb +12 -1
  28. data/lib/gamebox/generators/actor_generator.rb +2 -2
  29. data/lib/gamebox/generators/view_generator.rb +42 -0
  30. data/lib/gamebox/input_manager.rb +88 -21
  31. data/lib/gamebox/{aliasing.rb → lib/aliasing.rb} +0 -0
  32. data/lib/gamebox/{templates/template_app/lib → lib}/diy.rb +0 -0
  33. data/lib/gamebox/{inflections.rb → lib/inflections.rb} +0 -0
  34. data/lib/gamebox/{inflector.rb → lib/inflector.rb} +2 -2
  35. data/lib/gamebox/{linked_list.rb → lib/linked_list.rb} +0 -0
  36. data/lib/gamebox/{metaclass.rb → lib/metaclass.rb} +0 -0
  37. data/lib/gamebox/lib/numbers_ext.rb +3 -0
  38. data/lib/gamebox/{platform.rb → lib/platform.rb} +0 -0
  39. data/lib/gamebox/{publisher_ext.rb → lib/publisher_ext.rb} +0 -0
  40. data/lib/gamebox/{sorted_list.rb → lib/sorted_list.rb} +0 -0
  41. data/lib/gamebox/lib/surface_ext.rb +76 -0
  42. data/lib/gamebox/physical_director.rb +1 -1
  43. data/lib/gamebox/{physical_level.rb → physical_stage.rb} +28 -18
  44. data/lib/gamebox/physics.rb +2 -2
  45. data/lib/gamebox/resource_manager.rb +77 -8
  46. data/lib/gamebox/sound_manager.rb +15 -17
  47. data/lib/gamebox/stage.rb +143 -0
  48. data/lib/gamebox/stage_manager.rb +110 -0
  49. data/lib/gamebox/svg_document.rb +1 -1
  50. data/lib/gamebox/tasks/gamebox_tasks.rb +1 -1
  51. data/lib/gamebox/templates/{test_actor.erb → actor_spec.erb} +2 -2
  52. data/lib/gamebox/templates/actor_view.erb +8 -0
  53. data/lib/gamebox/templates/actor_view_spec.erb +10 -0
  54. data/lib/gamebox/templates/template_app/Rakefile +4 -4
  55. data/lib/gamebox/templates/template_app/config/game.yml +1 -0
  56. data/lib/gamebox/templates/template_app/config/stage_config.yml +2 -0
  57. data/lib/gamebox/templates/template_app/script/generate +2 -1
  58. data/lib/gamebox/templates/template_app/{test → spec}/helper.rb +0 -0
  59. data/lib/gamebox/templates/template_app/src/{demo_level.rb → demo_stage.rb} +5 -3
  60. data/lib/gamebox/templates/template_app/src/game.rb +4 -6
  61. data/lib/gamebox/version.rb +3 -2
  62. data/lib/gamebox/viewport.rb +18 -9
  63. data/lib/gamebox/{graphical_actor_view.rb → views/graphical_actor_view.rb} +13 -1
  64. data/lib/gamebox/wrapped_screen.rb +2 -1
  65. data/spec/actor_spec.rb +57 -0
  66. data/{test/test_animated.rb → spec/animated_spec.rb} +5 -6
  67. data/spec/helper.rb +24 -0
  68. data/{test/test_line_of_site.rb → spec/line_of_site_spec.rb} +1 -1
  69. data/{test/test_physical.rb → spec/physical_spec.rb} +3 -4
  70. data/{test/test_polaris.rb → spec/polaris_spec.rb} +1 -1
  71. data/{test/test_viewport.rb → spec/viewport_spec.rb} +11 -8
  72. metadata +53 -50
  73. data/docs/gamebox04_big.png +0 -0
  74. data/lib/gamebox/level.rb +0 -65
  75. data/lib/gamebox/mode.rb +0 -123
  76. data/lib/gamebox/mode_manager.rb +0 -80
  77. data/lib/gamebox/numbers_ext.rb +0 -3
  78. data/lib/gamebox/surface_ext.rb +0 -37
  79. data/lib/gamebox/templates/template_app/config/mode_level_config.yml +0 -3
  80. data/test/helper.rb +0 -26
  81. data/test/test_actor.rb +0 -36
@@ -1,3 +0,0 @@
1
- class Float
2
- Infinity = 1.0/0.0
3
- end
@@ -1,37 +0,0 @@
1
- require 'ftor'
2
- module Rubygame
3
-
4
- class Surface
5
- def draw_line_s(point1, point2, color, thickness)
6
- half_thickness = thickness/2.0
7
- x1 = point1[0]
8
- y1 = point1[1]
9
- x2 = point2[0]
10
- y2 = point2[1]
11
-
12
- point1_vector = Ftor.new x1, y1
13
- point2_vector = Ftor.new x2, y2
14
-
15
- line_vector = point2_vector-point1_vector
16
- perp_vector = line_vector.normal.unit
17
-
18
- points = []
19
- pvt = perp_vector*half_thickness
20
- poly_point1 = Ftor.new(x1,y1)+pvt
21
- poly_point2 = Ftor.new(x2,y2)+pvt
22
- poly_point3 = Ftor.new(x2,y2)-pvt
23
- poly_point4 = Ftor.new(x1,y1)-pvt
24
-
25
- points << [poly_point1.x,poly_point1.y]
26
- points << [poly_point2.x,poly_point2.y]
27
- points << [poly_point3.x,poly_point3.y]
28
- points << [poly_point4.x,poly_point4.y]
29
- points << [poly_point1.x,poly_point1.y]
30
-
31
- draw_polygon_s points, color
32
- draw_circle_s [x1,y1], half_thickness, color
33
- draw_circle_s [x2,y2], half_thickness, color
34
- end
35
- end
36
-
37
- end # module Rubygame
@@ -1,3 +0,0 @@
1
- :modes:
2
- - :default:
3
- - :demo:
data/test/helper.rb DELETED
@@ -1,26 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'gamebox'))
2
-
3
- require 'rubygems'
4
- require 'spec'
5
-
6
- #require 'bacon'
7
- #require 'mocha'
8
- #require 'aliasing'
9
-
10
- #class Bacon::Context
11
- # include Mocha::Standalone
12
- # def it_with_mocha description
13
- # it_without_mocha description do
14
- # mocha_setup
15
- # yield
16
- # mocha_verify
17
- # mocha_teardown
18
- # end
19
- # end
20
- # alias_method_chain :it, :mocha
21
- #end
22
-
23
-
24
- require 'metaclass'
25
- require 'actor'
26
-
data/test/test_actor.rb DELETED
@@ -1,36 +0,0 @@
1
- require 'helper'
2
- require 'actor'
3
-
4
- describe 'A new actor' do
5
- before do
6
- opts = {:level=>"level", :input=>"input", :resources=>"resource"}
7
- @actor = Actor.new opts
8
- end
9
-
10
- it 'should be alive' do
11
- @actor.alive?.should be_true
12
- end
13
-
14
- it 'should be at (0,0)' do
15
- @actor.x.should equal(0)
16
- @actor.y.should equal(0)
17
- end
18
-
19
- it 'should have atts set' do
20
- @actor.level.should == "level"
21
- @actor.input_manager.should == "input"
22
- @actor.resource_manager.should == "resource"
23
- @actor.behaviors.size.should equal(0)
24
- end
25
-
26
- it 'should fire anything' do
27
- Proc.new {
28
- @actor.when :foofoo_bar do
29
- "blah"
30
- end
31
- }.should_not raise_error
32
- end
33
-
34
- it 'should setup behaviors; hard to test'
35
-
36
- end