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
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamebox
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
8
+ - 2
7
9
  - 1
8
- - 1
9
- version: 0.1.1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Shawn Anderson
@@ -16,16 +17,18 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-04-26 00:00:00 -04:00
20
+ date: 2010-11-02 00:00:00 -04:00
20
21
  default_executable: gamebox
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
24
  name: rspec
24
25
  prerelease: false
25
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
26
28
  requirements:
27
29
  - - ">="
28
30
  - !ruby/object:Gem::Version
31
+ hash: 3
29
32
  segments:
30
33
  - 0
31
34
  version: "0"
@@ -35,51 +38,73 @@ dependencies:
35
38
  name: jeweler
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 3
41
46
  segments:
42
47
  - 0
43
48
  version: "0"
44
49
  type: :development
45
50
  version_requirements: *id002
46
51
  - !ruby/object:Gem::Dependency
47
- name: rubygame
52
+ name: gosu
48
53
  prerelease: false
49
54
  requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
50
56
  requirements:
51
57
  - - ">="
52
58
  - !ruby/object:Gem::Version
59
+ hash: 3
53
60
  segments:
54
61
  - 0
55
62
  version: "0"
56
63
  type: :runtime
57
64
  version_requirements: *id003
58
65
  - !ruby/object:Gem::Dependency
59
- name: constructor
66
+ name: bundler
60
67
  prerelease: false
61
68
  requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
62
70
  requirements:
63
71
  - - ">="
64
72
  - !ruby/object:Gem::Version
73
+ hash: 3
65
74
  segments:
66
75
  - 0
67
76
  version: "0"
68
77
  type: :runtime
69
78
  version_requirements: *id004
70
79
  - !ruby/object:Gem::Dependency
71
- name: publisher
80
+ name: constructor
72
81
  prerelease: false
73
82
  requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
74
84
  requirements:
75
85
  - - ">="
76
86
  - !ruby/object:Gem::Version
87
+ hash: 3
77
88
  segments:
78
89
  - 0
79
90
  version: "0"
80
91
  type: :runtime
81
92
  version_requirements: *id005
82
- description: Framework for building and distributing games using Rubygame
93
+ - !ruby/object:Gem::Dependency
94
+ name: publisher
95
+ prerelease: false
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :runtime
106
+ version_requirements: *id006
107
+ description: Framework for building and distributing games using Gosu
83
108
  email: shawn42@gmail.com
84
109
  executables:
85
110
  - gamebox
@@ -89,6 +114,7 @@ extra_rdoc_files:
89
114
  - README.txt
90
115
  files:
91
116
  - .gitignore
117
+ - Gemfile
92
118
  - History.txt
93
119
  - README.txt
94
120
  - Rakefile
@@ -105,11 +131,13 @@ files:
105
131
  - lib/gamebox/actor.rb
106
132
  - lib/gamebox/actor_factory.rb
107
133
  - lib/gamebox/actor_view.rb
134
+ - lib/gamebox/actors/collidable_debugger.rb
108
135
  - lib/gamebox/actors/curtain.rb
109
136
  - lib/gamebox/actors/fps.rb
110
137
  - lib/gamebox/actors/label.rb
111
138
  - lib/gamebox/actors/logo.rb
112
139
  - lib/gamebox/actors/score.rb
140
+ - lib/gamebox/actors/spatial_debugger.rb
113
141
  - lib/gamebox/actors/svg_actor.rb
114
142
  - lib/gamebox/arbiter.rb
115
143
  - lib/gamebox/backstage.rb
@@ -117,6 +145,10 @@ files:
117
145
  - lib/gamebox/behaviors/animated.rb
118
146
  - lib/gamebox/behaviors/audible.rb
119
147
  - lib/gamebox/behaviors/collidable.rb
148
+ - lib/gamebox/behaviors/collidable/aabb_collidable.rb
149
+ - lib/gamebox/behaviors/collidable/circle_collidable.rb
150
+ - lib/gamebox/behaviors/collidable/collidable_shape.rb
151
+ - lib/gamebox/behaviors/collidable/polygon_collidable.rb
120
152
  - lib/gamebox/behaviors/graphical.rb
121
153
  - lib/gamebox/behaviors/layered.rb
122
154
  - lib/gamebox/behaviors/physical.rb
@@ -133,10 +165,12 @@ files:
133
165
  - lib/gamebox/data/sounds/GAMEBOX_SOUND_FX_GO_HERE
134
166
  - lib/gamebox/director.rb
135
167
  - lib/gamebox/event_compat.rb
168
+ - lib/gamebox/ftor.rb
136
169
  - lib/gamebox/gamebox_application.rb
137
170
  - lib/gamebox/gamebox_generator.rb
138
171
  - lib/gamebox/generators/actor_generator.rb
139
172
  - lib/gamebox/generators/view_generator.rb
173
+ - lib/gamebox/hooked_gosu_window.rb
140
174
  - lib/gamebox/input_manager.rb
141
175
  - lib/gamebox/lib/aliasing.rb
142
176
  - lib/gamebox/lib/code_statistics.rb
@@ -148,8 +182,8 @@ files:
148
182
  - lib/gamebox/lib/numbers_ext.rb
149
183
  - lib/gamebox/lib/platform.rb
150
184
  - lib/gamebox/lib/publisher_ext.rb
185
+ - lib/gamebox/lib/rect.rb
151
186
  - lib/gamebox/lib/sorted_list.rb
152
- - lib/gamebox/lib/surface_ext.rb
153
187
  - lib/gamebox/physical_director.rb
154
188
  - lib/gamebox/physical_stage.rb
155
189
  - lib/gamebox/physics.rb
@@ -189,10 +223,13 @@ files:
189
223
  - lib/gamebox/viewport.rb
190
224
  - lib/gamebox/views/graphical_actor_view.rb
191
225
  - lib/gamebox/wrapped_screen.rb
226
+ - load_paths.rb
192
227
  - script/perf_polaris.rb
228
+ - script/perf_spatial_hash.rb
193
229
  - spec/actor_spec.rb
194
230
  - spec/actor_view_spec.rb
195
231
  - spec/animated_spec.rb
232
+ - spec/arbiter_spec.rb
196
233
  - spec/backstage_spec.rb
197
234
  - spec/behavior_spec.rb
198
235
  - spec/collidable_spec.rb
@@ -214,30 +251,35 @@ rdoc_options:
214
251
  require_paths:
215
252
  - lib
216
253
  required_ruby_version: !ruby/object:Gem::Requirement
254
+ none: false
217
255
  requirements:
218
256
  - - ">="
219
257
  - !ruby/object:Gem::Version
258
+ hash: 3
220
259
  segments:
221
260
  - 0
222
261
  version: "0"
223
262
  required_rubygems_version: !ruby/object:Gem::Requirement
263
+ none: false
224
264
  requirements:
225
265
  - - ">="
226
266
  - !ruby/object:Gem::Version
267
+ hash: 3
227
268
  segments:
228
269
  - 0
229
270
  version: "0"
230
271
  requirements: []
231
272
 
232
273
  rubyforge_project: gamebox
233
- rubygems_version: 1.3.6
274
+ rubygems_version: 1.3.7
234
275
  signing_key:
235
276
  specification_version: 3
236
- summary: Framework for building and distributing games using Rubygame
277
+ summary: Framework for building and distributing games using Gosu
237
278
  test_files:
238
279
  - spec/actor_spec.rb
239
280
  - spec/actor_view_spec.rb
240
281
  - spec/animated_spec.rb
282
+ - spec/arbiter_spec.rb
241
283
  - spec/backstage_spec.rb
242
284
  - spec/behavior_spec.rb
243
285
  - spec/collidable_spec.rb
@@ -1,76 +0,0 @@
1
- require 'rubygame/ftor'
2
- include Rubygame::Color
3
- module Rubygame
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
-
36
- # BY IPPA
37
- def fill_gradient(user_options = {})
38
- # merge arguments from methodcall Over default options
39
- default_options = {
40
- :from_color => :black,
41
- :to_color => :white,
42
- :thickness => 10,
43
- :orientation => :down,
44
- :rect => Rect.new([0, 0, self.width, self.height])
45
- }
46
- options = default_options.merge(user_options)
47
-
48
- # typecast color and rect arguments
49
- from_color = (options[:from_color].is_a? ColorRGB)? options[:from_color] : Color[options[:from_color]]
50
- to_color = (options[:to_color].is_a? ColorRGB)? options[:to_color] : Color[options[:to_color]]
51
- rect = (options[:rect].is_a? Rect)? options[:rect] : Rect.new(:rect)
52
-
53
- length = (options[:orientation] == :vertical) ? rect.height : rect.width
54
- weight_step = 1.0 / (length.to_f / options[:thickness].to_f)
55
- weight = 0.0
56
- x = rect.x
57
- y = rect.y
58
-
59
- while weight < 1.0
60
- color = to_color.average(from_color, weight)
61
-
62
- if options[:orientation] == :vertical
63
- self.draw_box_s([x, y], [rect.width, y + options[:thickness]], color)
64
- y += options[:thickness]
65
- else
66
- self.draw_box_s([x, y],[x + options[:thickness], rect.height], color)
67
- x += options[:thickness]
68
- end
69
-
70
- weight += weight_step
71
- end
72
- end
73
-
74
- end
75
-
76
- end # module Rubygame