gamebox 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +9 -0
  3. data/History.txt +5 -0
  4. data/README.txt +4 -3
  5. data/Rakefile +12 -4
  6. data/TODO.txt +1 -5
  7. data/VERSION +1 -1
  8. data/docs/getting_started.rdoc +2 -2
  9. data/gamebox.gemspec +26 -10
  10. data/lib/gamebox/actor.rb +10 -3
  11. data/lib/gamebox/actor_factory.rb +2 -2
  12. data/lib/gamebox/actor_view.rb +14 -11
  13. data/lib/gamebox/actors/collidable_debugger.rb +35 -0
  14. data/lib/gamebox/actors/curtain.rb +2 -2
  15. data/lib/gamebox/actors/logo.rb +0 -6
  16. data/lib/gamebox/actors/score.rb +2 -5
  17. data/lib/gamebox/actors/spatial_debugger.rb +47 -0
  18. data/lib/gamebox/actors/svg_actor.rb +4 -6
  19. data/lib/gamebox/arbiter.rb +108 -15
  20. data/lib/gamebox/behavior.rb +29 -1
  21. data/lib/gamebox/behaviors/animated.rb +14 -23
  22. data/lib/gamebox/behaviors/audible.rb +1 -12
  23. data/lib/gamebox/behaviors/collidable.rb +29 -22
  24. data/lib/gamebox/behaviors/collidable/aabb_collidable.rb +61 -0
  25. data/lib/gamebox/behaviors/collidable/circle_collidable.rb +17 -0
  26. data/lib/gamebox/behaviors/collidable/collidable_shape.rb +35 -0
  27. data/lib/gamebox/behaviors/collidable/polygon_collidable.rb +85 -0
  28. data/lib/gamebox/behaviors/graphical.rb +13 -10
  29. data/lib/gamebox/behaviors/layered.rb +6 -20
  30. data/lib/gamebox/behaviors/physical.rb +116 -93
  31. data/lib/gamebox/class_finder.rb +6 -2
  32. data/lib/gamebox/config_manager.rb +24 -4
  33. data/lib/gamebox/data/config/objects.yml +5 -3
  34. data/lib/gamebox/ftor.rb +372 -0
  35. data/lib/gamebox/gamebox_application.rb +2 -8
  36. data/lib/gamebox/hooked_gosu_window.rb +30 -0
  37. data/lib/gamebox/input_manager.rb +78 -79
  38. data/lib/gamebox/lib/code_statistics.rb +1 -1
  39. data/lib/gamebox/lib/numbers_ext.rb +1 -1
  40. data/lib/gamebox/lib/rect.rb +612 -0
  41. data/lib/gamebox/physical_stage.rb +12 -2
  42. data/lib/gamebox/physics.rb +14 -3
  43. data/lib/gamebox/resource_manager.rb +28 -65
  44. data/lib/gamebox/sound_manager.rb +7 -13
  45. data/lib/gamebox/spatial_hash.rb +60 -14
  46. data/lib/gamebox/spatial_stagehand.rb +19 -0
  47. data/lib/gamebox/stage.rb +16 -1
  48. data/lib/gamebox/stage_manager.rb +1 -1
  49. data/lib/gamebox/svg_document.rb +1 -0
  50. data/lib/gamebox/tasks/gamebox_tasks.rb +23 -11
  51. data/lib/gamebox/templates/template_app/.gitignore +1 -0
  52. data/lib/gamebox/templates/template_app/Gemfile +1 -1
  53. data/lib/gamebox/templates/template_app/Rakefile +6 -21
  54. data/lib/gamebox/templates/template_app/config/environment.rb +14 -0
  55. data/lib/gamebox/templates/template_app/config/game.yml +2 -1
  56. data/lib/gamebox/templates/template_app/script/generate +0 -3
  57. data/lib/gamebox/templates/template_app/src/demo_stage.rb +1 -11
  58. data/lib/gamebox/templates/template_app/src/game.rb +0 -1
  59. data/lib/gamebox/templates/template_app/src/my_actor.rb +2 -2
  60. data/lib/gamebox/version.rb +1 -1
  61. data/lib/gamebox/views/graphical_actor_view.rb +15 -9
  62. data/lib/gamebox/wrapped_screen.rb +114 -7
  63. data/load_paths.rb +20 -0
  64. data/script/perf_spatial_hash.rb +73 -0
  65. data/spec/actor_view_spec.rb +1 -1
  66. data/spec/arbiter_spec.rb +264 -0
  67. data/spec/behavior_spec.rb +19 -2
  68. data/spec/collidable_spec.rb +105 -5
  69. data/spec/helper.rb +1 -1
  70. data/spec/label_spec.rb +1 -1
  71. data/spec/resource_manager_spec.rb +1 -1
  72. data/spec/spatial_hash_spec.rb +1 -1
  73. metadata +52 -10
  74. data/lib/gamebox/lib/surface_ext.rb +0 -76
data/.gitignore CHANGED
@@ -5,3 +5,7 @@ doc
5
5
  coverage
6
6
  .DS_Store
7
7
  .yardoc
8
+ tmp
9
+ tags
10
+ .bundle
11
+ *.lock
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+ gem "rake"
3
+ gem "rspec"
4
+ gem "jeweler"
5
+ gem "constructor"
6
+ gem "publisher"
7
+ gem "gosu"
8
+ gem "chipmunk"
9
+ gem "polaris"
@@ -73,3 +73,8 @@
73
73
  * bug fixes for rspec requires
74
74
  * cleaning up docs
75
75
  * added support for stagehands
76
+
77
+ === 0.1.2 / 2010-04-28
78
+
79
+ * added dist tasks to package up windows executables
80
+ * added spatial hash and updated collision detection
data/README.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- A game template for building and distributing Rubygame games. See docs/getting_started.rdoc for help getting started.
7
+ A game template for building and distributing Gosu games. See docs/getting_started.rdoc for help getting started.
8
8
 
9
9
  == FEATURES/PROBLEMS:
10
10
 
@@ -12,13 +12,14 @@
12
12
 
13
13
  == SYNOPSIS:
14
14
 
15
- A game template for building and distributing Rubygame games.
15
+ A game template for building and distributing Gosu games.
16
16
 
17
17
  == REQUIREMENTS:
18
18
 
19
- * Rubygame (its dependancies, SDL)
19
+ * Gosu
20
20
  * constructor gem
21
21
  * publisher gem
22
+ * bundler
22
23
  * rspec (for gamebox tests)
23
24
  * algorithms gem (optional for line of site and A*)
24
25
 
data/Rakefile CHANGED
@@ -5,14 +5,15 @@ begin
5
5
  gem.name = "gamebox"
6
6
  gem.executables = "gamebox"
7
7
  gem.rubyforge_project = "gamebox"
8
- gem.summary = %Q{Framework for building and distributing games using Rubygame}
9
- gem.description = %Q{Framework for building and distributing games using Rubygame}
8
+ gem.summary = %Q{Framework for building and distributing games using Gosu}
9
+ gem.description = %Q{Framework for building and distributing games using Gosu}
10
10
  gem.email = "shawn42@gmail.com"
11
11
  gem.homepage = "http://shawn42.github.com/gamebox"
12
12
  gem.authors = ["Shawn Anderson","Jason Roelofs","Karlin Fox"]
13
13
  gem.add_development_dependency "rspec"
14
14
  gem.add_development_dependency "jeweler"
15
- gem.add_dependency 'rubygame'
15
+ gem.add_dependency 'gosu'
16
+ gem.add_dependency 'bundler'
16
17
  gem.add_dependency 'constructor'
17
18
  gem.add_dependency 'publisher'
18
19
  gem.files.exclude 'examples'
@@ -24,8 +25,15 @@ rescue LoadError
24
25
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
25
26
  end
26
27
 
28
+ begin
29
+ require 'metric_fu'
30
+ rescue LoadError
31
+ puts "metric_fu (or a dependency) not available. Install it with: sudo gem install metric_fu"
32
+ end
33
+
27
34
  STATS_DIRECTORIES = [
28
- %w(Source lib/)
35
+ %w(Source lib/),
36
+ %w(Unit\ tests spec/)
29
37
  ].collect { |name, dir| [ name, "#{dir}" ] }.select { |name, dir| File.directory?(dir) }
30
38
 
31
39
  desc "Report code statistics (KLOCs, etc) from the application"
data/TODO.txt CHANGED
@@ -7,9 +7,6 @@ on_update do |time|
7
7
  # do stuff?
8
8
  end
9
9
 
10
- allow easy pausing of game and physics
11
- - fire :pause event w/ a new Director of actors?
12
- change Polaris to return partial path when step max is reached
13
10
  update physical objects to use chipmunk_object.rb
14
11
 
15
12
  make complex Phyiscal behaviors
@@ -25,8 +22,7 @@ add Extra; actor with a short time to live (TTL); useful for special effects (ma
25
22
 
26
23
  static deployment bundles (crate, love-clone; custom C project)
27
24
  ruby
28
- SDL
29
- rubygame
25
+ gosu
30
26
  possible features:
31
27
  AI
32
28
  state machine
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.1
@@ -14,8 +14,8 @@ The reason I wrote Gamebox is twofold: first, to aid in 48 hour game writing com
14
14
  - or tar from http://shawn42.github.com/gamebox
15
15
  - or git pull from git://github.com/shawn42/gamebox.git
16
16
  - required gems
17
- - hoe
18
- - rubygame (all of its dependencies)
17
+ - bundler
18
+ - gosu
19
19
  - constructor
20
20
  - publisher
21
21
  - rspec for unit tests
@@ -5,13 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gamebox}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shawn Anderson", "Jason Roelofs", "Karlin Fox"]
12
- s.date = %q{2010-04-26}
12
+ s.date = %q{2010-11-02}
13
13
  s.default_executable = %q{gamebox}
14
- s.description = %q{Framework for building and distributing games using Rubygame}
14
+ s.description = %q{Framework for building and distributing games using Gosu}
15
15
  s.email = %q{shawn42@gmail.com}
16
16
  s.executables = ["gamebox"]
17
17
  s.extra_rdoc_files = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".gitignore",
22
+ "Gemfile",
22
23
  "History.txt",
23
24
  "README.txt",
24
25
  "Rakefile",
@@ -35,11 +36,13 @@ Gem::Specification.new do |s|
35
36
  "lib/gamebox/actor.rb",
36
37
  "lib/gamebox/actor_factory.rb",
37
38
  "lib/gamebox/actor_view.rb",
39
+ "lib/gamebox/actors/collidable_debugger.rb",
38
40
  "lib/gamebox/actors/curtain.rb",
39
41
  "lib/gamebox/actors/fps.rb",
40
42
  "lib/gamebox/actors/label.rb",
41
43
  "lib/gamebox/actors/logo.rb",
42
44
  "lib/gamebox/actors/score.rb",
45
+ "lib/gamebox/actors/spatial_debugger.rb",
43
46
  "lib/gamebox/actors/svg_actor.rb",
44
47
  "lib/gamebox/arbiter.rb",
45
48
  "lib/gamebox/backstage.rb",
@@ -47,6 +50,10 @@ Gem::Specification.new do |s|
47
50
  "lib/gamebox/behaviors/animated.rb",
48
51
  "lib/gamebox/behaviors/audible.rb",
49
52
  "lib/gamebox/behaviors/collidable.rb",
53
+ "lib/gamebox/behaviors/collidable/aabb_collidable.rb",
54
+ "lib/gamebox/behaviors/collidable/circle_collidable.rb",
55
+ "lib/gamebox/behaviors/collidable/collidable_shape.rb",
56
+ "lib/gamebox/behaviors/collidable/polygon_collidable.rb",
50
57
  "lib/gamebox/behaviors/graphical.rb",
51
58
  "lib/gamebox/behaviors/layered.rb",
52
59
  "lib/gamebox/behaviors/physical.rb",
@@ -63,10 +70,12 @@ Gem::Specification.new do |s|
63
70
  "lib/gamebox/data/sounds/GAMEBOX_SOUND_FX_GO_HERE",
64
71
  "lib/gamebox/director.rb",
65
72
  "lib/gamebox/event_compat.rb",
73
+ "lib/gamebox/ftor.rb",
66
74
  "lib/gamebox/gamebox_application.rb",
67
75
  "lib/gamebox/gamebox_generator.rb",
68
76
  "lib/gamebox/generators/actor_generator.rb",
69
77
  "lib/gamebox/generators/view_generator.rb",
78
+ "lib/gamebox/hooked_gosu_window.rb",
70
79
  "lib/gamebox/input_manager.rb",
71
80
  "lib/gamebox/lib/aliasing.rb",
72
81
  "lib/gamebox/lib/code_statistics.rb",
@@ -78,8 +87,8 @@ Gem::Specification.new do |s|
78
87
  "lib/gamebox/lib/numbers_ext.rb",
79
88
  "lib/gamebox/lib/platform.rb",
80
89
  "lib/gamebox/lib/publisher_ext.rb",
90
+ "lib/gamebox/lib/rect.rb",
81
91
  "lib/gamebox/lib/sorted_list.rb",
82
- "lib/gamebox/lib/surface_ext.rb",
83
92
  "lib/gamebox/physical_director.rb",
84
93
  "lib/gamebox/physical_stage.rb",
85
94
  "lib/gamebox/physics.rb",
@@ -119,10 +128,13 @@ Gem::Specification.new do |s|
119
128
  "lib/gamebox/viewport.rb",
120
129
  "lib/gamebox/views/graphical_actor_view.rb",
121
130
  "lib/gamebox/wrapped_screen.rb",
131
+ "load_paths.rb",
122
132
  "script/perf_polaris.rb",
133
+ "script/perf_spatial_hash.rb",
123
134
  "spec/actor_spec.rb",
124
135
  "spec/actor_view_spec.rb",
125
136
  "spec/animated_spec.rb",
137
+ "spec/arbiter_spec.rb",
126
138
  "spec/backstage_spec.rb",
127
139
  "spec/behavior_spec.rb",
128
140
  "spec/collidable_spec.rb",
@@ -139,12 +151,13 @@ Gem::Specification.new do |s|
139
151
  s.rdoc_options = ["--charset=UTF-8"]
140
152
  s.require_paths = ["lib"]
141
153
  s.rubyforge_project = %q{gamebox}
142
- s.rubygems_version = %q{1.3.6}
143
- s.summary = %q{Framework for building and distributing games using Rubygame}
154
+ s.rubygems_version = %q{1.3.7}
155
+ s.summary = %q{Framework for building and distributing games using Gosu}
144
156
  s.test_files = [
145
157
  "spec/actor_spec.rb",
146
158
  "spec/actor_view_spec.rb",
147
159
  "spec/animated_spec.rb",
160
+ "spec/arbiter_spec.rb",
148
161
  "spec/backstage_spec.rb",
149
162
  "spec/behavior_spec.rb",
150
163
  "spec/collidable_spec.rb",
@@ -162,23 +175,26 @@ Gem::Specification.new do |s|
162
175
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
163
176
  s.specification_version = 3
164
177
 
165
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
178
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
166
179
  s.add_development_dependency(%q<rspec>, [">= 0"])
167
180
  s.add_development_dependency(%q<jeweler>, [">= 0"])
168
- s.add_runtime_dependency(%q<rubygame>, [">= 0"])
181
+ s.add_runtime_dependency(%q<gosu>, [">= 0"])
182
+ s.add_runtime_dependency(%q<bundler>, [">= 0"])
169
183
  s.add_runtime_dependency(%q<constructor>, [">= 0"])
170
184
  s.add_runtime_dependency(%q<publisher>, [">= 0"])
171
185
  else
172
186
  s.add_dependency(%q<rspec>, [">= 0"])
173
187
  s.add_dependency(%q<jeweler>, [">= 0"])
174
- s.add_dependency(%q<rubygame>, [">= 0"])
188
+ s.add_dependency(%q<gosu>, [">= 0"])
189
+ s.add_dependency(%q<bundler>, [">= 0"])
175
190
  s.add_dependency(%q<constructor>, [">= 0"])
176
191
  s.add_dependency(%q<publisher>, [">= 0"])
177
192
  end
178
193
  else
179
194
  s.add_dependency(%q<rspec>, [">= 0"])
180
195
  s.add_dependency(%q<jeweler>, [">= 0"])
181
- s.add_dependency(%q<rubygame>, [">= 0"])
196
+ s.add_dependency(%q<gosu>, [">= 0"])
197
+ s.add_dependency(%q<bundler>, [">= 0"])
182
198
  s.add_dependency(%q<constructor>, [">= 0"])
183
199
  s.add_dependency(%q<publisher>, [">= 0"])
184
200
  end
@@ -1,4 +1,6 @@
1
1
  require 'publisher'
2
+ require 'inflector'
3
+
2
4
  # Actor represent a game object.
3
5
  # Actors can have behaviors added and removed from them. Such as :physical or :animated.
4
6
  # They are created and hooked up to their optional View class in Stage#create_actor.
@@ -48,7 +50,7 @@ class Actor
48
50
  end
49
51
 
50
52
  ordered_behaviors.each do |behavior|
51
- is behavior_defs[behavior]
53
+ is behavior_defs[behavior] unless is? behavior
52
54
  end
53
55
  setup
54
56
  end
@@ -82,8 +84,13 @@ class Actor
82
84
  # :range=>3 to it
83
85
  # Actor#is does try to require 'shootable' but will not throw an error if shootable cannot be required.
84
86
  def is(behavior_def)
85
- behavior_sym = behavior_def.is_a?(Hash) ? behavior_def.keys.first : behavior_def
86
- behavior_opts = behavior_def.is_a?(Hash) ? behavior_def.values.first : {}
87
+ if behavior_def.is_a?(Hash)
88
+ behavior_sym = behavior_def.keys.first
89
+ behavior_opts = behavior_def.values.first
90
+ else
91
+ behavior_sym = behavior_def
92
+ behavior_opts = {}
93
+ end
87
94
  begin
88
95
  require behavior_sym.to_s;
89
96
  rescue LoadError
@@ -5,7 +5,7 @@ require 'graphical_actor_view'
5
5
  # stage, input_manager, director, resource_manager. It also creates the ActorView
6
6
  # associated with the Actor and registers it to the Stage be drawn.
7
7
  class ActorFactory
8
- constructor :input_manager
8
+ constructor :input_manager, :wrapped_screen
9
9
 
10
10
  attr_accessor :stage_manager, :director
11
11
 
@@ -49,7 +49,7 @@ class ActorFactory
49
49
  view_klass ||= GraphicalActorView
50
50
  end
51
51
 
52
- view_klass.new stage, model if view_klass
52
+ view_klass.new stage, model, @wrapped_screen if view_klass
53
53
 
54
54
  model.show unless opts[:hide]
55
55
 
@@ -1,8 +1,9 @@
1
1
  class ActorView
2
- attr_accessor :actor, :stage, :layer, :parallax
3
- def initialize(stage, actor)
2
+ attr_accessor :actor, :stage, :layer, :parallax, :wrapped_screen
3
+ def initialize(stage, actor, wrapped_screen)
4
4
  @stage = stage
5
5
  @actor = actor
6
+ @wrapped_screen = wrapped_screen
6
7
 
7
8
  @layer = 0
8
9
  @parallax = 1
@@ -11,20 +12,22 @@ class ActorView
11
12
  @parallax = @actor.parallax
12
13
  end
13
14
 
14
- actor.when :remove_me do
15
- @stage.unregister_drawable self
16
- end
15
+ actor.when :remove_me do unregister end
17
16
 
18
- actor.when :hide_me do
19
- @stage.unregister_drawable self
20
- end
17
+ actor.when :hide_me do unregister end
21
18
 
22
- actor.when :show_me do
23
- @stage.register_drawable self
24
- end
19
+ actor.when :show_me do register end
25
20
 
26
21
  setup
27
22
  end
23
+
24
+ def register
25
+ @stage.register_drawable self
26
+ end
27
+
28
+ def unregister
29
+ @stage.unregister_drawable self
30
+ end
28
31
 
29
32
  def setup
30
33
  end
@@ -0,0 +1,35 @@
1
+ require 'actor'
2
+ require 'actor_view'
3
+
4
+ class CollidableDebugger < Actor
5
+
6
+ attr_reader :actor
7
+ def setup
8
+ @actor = opts[:collider]
9
+ @actor.when :remove_me do
10
+ remove_self
11
+ end
12
+
13
+ end
14
+ end
15
+
16
+ class CollidableDebuggerView < ActorView
17
+
18
+ def setup
19
+ @color = Color[:white]
20
+ end
21
+
22
+ def draw(target,x_off,y_off)
23
+ collider = @actor.actor
24
+ case collider.collidable_shape
25
+ when :circle
26
+ target.draw_circle [x_off+collider.center_x, y_off+collider.center_y], collider.radius, @color
27
+ else
28
+ collider.cw_world_lines.each do |line|
29
+ f = line.first
30
+ l = line.last
31
+ target.draw_line [x_off+f[0],y_off+f[1]],[x_off+l[0],y_off+l[1]], @color
32
+ end
33
+ end
34
+ end
35
+ end
@@ -3,8 +3,8 @@ require 'publisher'
3
3
  require 'actor_view'
4
4
 
5
5
  class CurtainView < ActorView
6
- def draw(target,x_off,y_off)
7
- target.draw_box_s [0,0],[1024,800], [0,0,0,@actor.height]
6
+ def draw(target,x_off,y_off,z)
7
+ target.fill 0,0,1024,800, [0,0,0,@actor.height]
8
8
  end
9
9
  end
10
10
 
@@ -1,10 +1,4 @@
1
1
  require 'actor'
2
- require 'graphical_actor_view'
3
- class LogoView < GraphicalActorView
4
- def draw(target,xoff,yoff)
5
- super target, 0, 0
6
- end
7
- end
8
2
  class Logo < Actor
9
3
  has_behaviors :graphical,
10
4
  :layered => {:layer => 999}
@@ -1,15 +1,12 @@
1
1
  class ScoreView < ActorView
2
- def draw(target,x_off,y_off)
2
+ def draw(target,x_off,y_off,z)
3
3
  text = @actor.score.to_s
4
4
  text = '0'*(6-text.size)+text
5
5
 
6
6
  font = @stage.resource_manager.load_font 'Asimov.ttf', 30
7
- text_image = font.render text, true, [250,250,250,255]
8
-
9
7
  x = @actor.x
10
8
  y = @actor.y
11
-
12
- text_image.blit target.screen, [x,y]
9
+ font.draw text, x,y,z#, 1,1,target.convert_color([250,250,250,255])
13
10
  end
14
11
  end
15
12
  class Score < Actor
@@ -0,0 +1,47 @@
1
+ require 'actor'
2
+ require 'actor_view'
3
+
4
+ class SpatialDebugger < Actor
5
+
6
+ has_behavior :updatable
7
+
8
+ attr_reader :spatial, :ratio
9
+ def setup
10
+ @spatial = stage.stagehand(:spatial)
11
+ end
12
+
13
+ def update(time)
14
+ super
15
+ if stage.checks && stage.checks > 0
16
+ @ratio = "size:#{@spatial.cell_size} #{stage.collisions} / #{stage.checks} ("
17
+ @ratio += "#{stage.collisions / stage.checks.to_f})"
18
+ else
19
+ @ratio = "N/A"
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+ class SpatialDebuggerView < ActorView
26
+ def setup
27
+ size = 30
28
+ font = "Asimov.ttf"
29
+ @font = @actor.resource_manager.load_font font, size
30
+ end
31
+
32
+ def draw(target,x_off,y_off)
33
+ cell_size = @actor.spatial.cell_size
34
+ max = 0
35
+ @actor.spatial.buckets.each do |x_bucket,stuff|
36
+ stuff.each do |y_bucket,items|
37
+ max = items.size if items.size > max
38
+ x = x_bucket * cell_size + x_off
39
+ y = y_bucket * cell_size + y_off
40
+ target.draw_box [x,y], [x+cell_size,y+cell_size], Color[:white]
41
+ end
42
+ end
43
+
44
+ @text_image = @font.render "#{@actor.ratio} [#{max}]", true, Color[:white]
45
+ @text_image.blit target.screen, [@actor.x, @actor.y]
46
+ end
47
+ end