gamebox 0.0.6 → 0.0.7
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/History.txt +14 -0
- data/Manifest.txt +40 -37
- data/README.txt +2 -2
- data/Rakefile +27 -20
- data/TODO.txt +8 -8
- data/bin/gamebox +7 -1
- data/docs/getting_started.rdoc +2 -5
- data/docs/logo.png +0 -0
- data/lib/gamebox.rb +12 -1
- data/lib/gamebox/actor.rb +34 -9
- data/lib/gamebox/actor_factory.rb +25 -14
- data/lib/gamebox/actor_view.rb +6 -6
- data/lib/gamebox/{logo.rb → actors/logo.rb} +0 -0
- data/lib/gamebox/{score.rb → actors/score.rb} +2 -1
- data/lib/gamebox/{svg_actor.rb → actors/svg_actor.rb} +3 -4
- data/lib/gamebox/ai/polaris.rb +2 -0
- data/lib/gamebox/behavior.rb +3 -0
- data/lib/gamebox/{animated.rb → behaviors/animated.rb} +13 -5
- data/lib/gamebox/{graphical.rb → behaviors/graphical.rb} +11 -1
- data/lib/gamebox/{layered.rb → behaviors/layered.rb} +14 -0
- data/lib/gamebox/{physical.rb → behaviors/physical.rb} +41 -14
- data/lib/gamebox/{updatable.rb → behaviors/updatable.rb} +1 -1
- data/lib/gamebox/{templates/template_app → data}/config/objects.yml +4 -2
- data/lib/gamebox/data/graphics/logo.png +0 -0
- data/lib/gamebox/event_compat.rb +285 -0
- data/lib/gamebox/ftor.rb +2 -0
- data/lib/gamebox/gamebox_application.rb +12 -1
- data/lib/gamebox/generators/actor_generator.rb +2 -2
- data/lib/gamebox/generators/view_generator.rb +42 -0
- data/lib/gamebox/input_manager.rb +88 -21
- data/lib/gamebox/{aliasing.rb → lib/aliasing.rb} +0 -0
- data/lib/gamebox/{templates/template_app/lib → lib}/diy.rb +0 -0
- data/lib/gamebox/{inflections.rb → lib/inflections.rb} +0 -0
- data/lib/gamebox/{inflector.rb → lib/inflector.rb} +2 -2
- data/lib/gamebox/{linked_list.rb → lib/linked_list.rb} +0 -0
- data/lib/gamebox/{metaclass.rb → lib/metaclass.rb} +0 -0
- data/lib/gamebox/lib/numbers_ext.rb +3 -0
- data/lib/gamebox/{platform.rb → lib/platform.rb} +0 -0
- data/lib/gamebox/{publisher_ext.rb → lib/publisher_ext.rb} +0 -0
- data/lib/gamebox/{sorted_list.rb → lib/sorted_list.rb} +0 -0
- data/lib/gamebox/lib/surface_ext.rb +76 -0
- data/lib/gamebox/physical_director.rb +1 -1
- data/lib/gamebox/{physical_level.rb → physical_stage.rb} +28 -18
- data/lib/gamebox/physics.rb +2 -2
- data/lib/gamebox/resource_manager.rb +77 -8
- data/lib/gamebox/sound_manager.rb +15 -17
- data/lib/gamebox/stage.rb +143 -0
- data/lib/gamebox/stage_manager.rb +110 -0
- data/lib/gamebox/svg_document.rb +1 -1
- data/lib/gamebox/tasks/gamebox_tasks.rb +1 -1
- data/lib/gamebox/templates/{test_actor.erb → actor_spec.erb} +2 -2
- data/lib/gamebox/templates/actor_view.erb +8 -0
- data/lib/gamebox/templates/actor_view_spec.erb +10 -0
- data/lib/gamebox/templates/template_app/Rakefile +4 -4
- data/lib/gamebox/templates/template_app/config/game.yml +1 -0
- data/lib/gamebox/templates/template_app/config/stage_config.yml +2 -0
- data/lib/gamebox/templates/template_app/script/generate +2 -1
- data/lib/gamebox/templates/template_app/{test → spec}/helper.rb +0 -0
- data/lib/gamebox/templates/template_app/src/{demo_level.rb → demo_stage.rb} +5 -3
- data/lib/gamebox/templates/template_app/src/game.rb +4 -6
- data/lib/gamebox/version.rb +3 -2
- data/lib/gamebox/viewport.rb +18 -9
- data/lib/gamebox/{graphical_actor_view.rb → views/graphical_actor_view.rb} +13 -1
- data/lib/gamebox/wrapped_screen.rb +2 -1
- data/spec/actor_spec.rb +57 -0
- data/{test/test_animated.rb → spec/animated_spec.rb} +5 -6
- data/spec/helper.rb +24 -0
- data/{test/test_line_of_site.rb → spec/line_of_site_spec.rb} +1 -1
- data/{test/test_physical.rb → spec/physical_spec.rb} +3 -4
- data/{test/test_polaris.rb → spec/polaris_spec.rb} +1 -1
- data/{test/test_viewport.rb → spec/viewport_spec.rb} +11 -8
- metadata +53 -50
- data/docs/gamebox04_big.png +0 -0
- data/lib/gamebox/level.rb +0 -65
- data/lib/gamebox/mode.rb +0 -123
- data/lib/gamebox/mode_manager.rb +0 -80
- data/lib/gamebox/numbers_ext.rb +0 -3
- data/lib/gamebox/surface_ext.rb +0 -37
- data/lib/gamebox/templates/template_app/config/mode_level_config.yml +0 -3
- data/test/helper.rb +0 -26
- data/test/test_actor.rb +0 -36
data/lib/gamebox/numbers_ext.rb
DELETED
data/lib/gamebox/surface_ext.rb
DELETED
@@ -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
|
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
|