gamebox 0.3.4 → 0.4.0.rc1

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.
Files changed (184) hide show
  1. data/README.rdoc +38 -0
  2. data/Rakefile +1 -10
  3. data/TODO.txt +6 -6
  4. data/app_generators/gamebox_generator.rb +95 -0
  5. data/{lib/gamebox/templates/template_app → app_generators/templates}/.gitignore +0 -0
  6. data/app_generators/templates/Gemfile +7 -0
  7. data/app_generators/templates/NEXT_STEPS.txt +1 -0
  8. data/{lib/gamebox/templates/template_app/README → app_generators/templates/README.rdoc} +0 -0
  9. data/{lib/gamebox/templates/template_app → app_generators/templates}/Rakefile +0 -0
  10. data/{lib/gamebox/templates/template_app → app_generators/templates}/config/boot.rb +0 -0
  11. data/app_generators/templates/config/environment.rb +30 -0
  12. data/{lib/gamebox/templates/template_app → app_generators/templates}/config/game.yml +0 -0
  13. data/{lib/gamebox/templates/template_app → app_generators/templates}/data/fonts/FONTS_GO_HERE +0 -0
  14. data/{lib/gamebox/templates/template_app → app_generators/templates}/data/graphics/GRAPHICS_GO_HERE +0 -0
  15. data/{lib/gamebox/templates/template_app → app_generators/templates}/data/music/MUSIC_GOES_HERE +0 -0
  16. data/{lib/gamebox/templates/template_app → app_generators/templates}/data/sounds/SOUND_FX_GO_HERE +0 -0
  17. data/{lib/gamebox/templates → app_generators/templates/script}/actor.erb +0 -0
  18. data/{lib/gamebox/templates → app_generators/templates/script}/actor_spec.erb +0 -0
  19. data/{lib/gamebox/templates → app_generators/templates/script}/actor_view.erb +0 -0
  20. data/{lib/gamebox/templates → app_generators/templates/script}/actor_view_spec.erb +0 -0
  21. data/app_generators/templates/script/generate +12 -0
  22. data/{lib/gamebox/templates/template_app → app_generators/templates}/spec/helper.rb +0 -0
  23. data/app_generators/templates/src/actors/player.rb +8 -0
  24. data/{lib/gamebox/templates/template_app → app_generators/templates}/src/app.rb +0 -0
  25. data/app_generators/templates/src/demo_stage.rb +7 -0
  26. data/bin/gamebox +8 -70
  27. data/component_generators/actor_generator.rb +17 -0
  28. data/docs/CODE_REVIEW +1 -1
  29. data/docs/REFACTOR_NOTES.txt +25 -0
  30. data/docs/getting_started.rdoc +1 -1
  31. data/gamebox.gemspec +7 -4
  32. data/lib/gamebox.rb +6 -3
  33. data/lib/gamebox/actors/collidable_debugger.rb +13 -15
  34. data/lib/gamebox/actors/curtain.rb +44 -43
  35. data/lib/gamebox/actors/emitter.rb +3 -42
  36. data/lib/gamebox/actors/fps.rb +13 -6
  37. data/lib/gamebox/actors/label.rb +42 -34
  38. data/lib/gamebox/actors/logo.rb +2 -4
  39. data/lib/gamebox/actors/score.rb +37 -27
  40. data/lib/gamebox/actors/svg_actor.rb +45 -32
  41. data/lib/gamebox/behaviors/animated.rb +39 -59
  42. data/lib/gamebox/behaviors/audible.rb +14 -14
  43. data/lib/gamebox/behaviors/collidable.rb +65 -36
  44. data/lib/gamebox/behaviors/collidable/aabb_collidable.rb +2 -3
  45. data/lib/gamebox/behaviors/collidable/collidable_shape.rb +6 -4
  46. data/lib/gamebox/behaviors/collidable/polygon_collidable.rb +1 -1
  47. data/lib/gamebox/behaviors/emitting.rb +48 -0
  48. data/lib/gamebox/behaviors/graphical.rb +22 -56
  49. data/lib/gamebox/behaviors/layered.rb +8 -21
  50. data/lib/gamebox/behaviors/physical.rb +202 -213
  51. data/lib/gamebox/behaviors/positioned.rb +16 -0
  52. data/lib/gamebox/behaviors/projectile.rb +15 -0
  53. data/lib/gamebox/behaviors/visible.rb +16 -0
  54. data/lib/gamebox/core/aabb_helpers.rb +61 -0
  55. data/lib/gamebox/core/aabb_node.rb +118 -0
  56. data/lib/gamebox/core/aabb_tree.rb +137 -0
  57. data/lib/gamebox/core/actor.rb +102 -0
  58. data/lib/gamebox/core/actor_factory.rb +56 -0
  59. data/lib/gamebox/core/actor_view.rb +63 -0
  60. data/lib/gamebox/core/actor_view_factory.rb +40 -0
  61. data/lib/gamebox/{arbiter.rb → core/arbiter.rb} +31 -34
  62. data/lib/gamebox/{backstage.rb → core/backstage.rb} +0 -0
  63. data/lib/gamebox/core/behavior.rb +64 -0
  64. data/lib/gamebox/core/behavior_factory.rb +56 -0
  65. data/lib/gamebox/{class_finder.rb → core/class_finder.rb} +0 -0
  66. data/lib/gamebox/{config_manager.rb → core/config_manager.rb} +1 -1
  67. data/lib/gamebox/core/configuration.rb +39 -0
  68. data/lib/gamebox/core/core.rb +30 -0
  69. data/lib/gamebox/core/deprecated.rb +15 -0
  70. data/lib/gamebox/{director.rb → core/director.rb} +6 -11
  71. data/lib/gamebox/core/font_style.rb +26 -0
  72. data/lib/gamebox/core/font_style_factory.rb +11 -0
  73. data/lib/gamebox/core/game.rb +19 -0
  74. data/lib/gamebox/{hooked_gosu_window.rb → core/hooked_gosu_window.rb} +12 -6
  75. data/lib/gamebox/{input_manager.rb → core/input_manager.rb} +106 -99
  76. data/lib/gamebox/core/physics.rb +22 -0
  77. data/lib/gamebox/{physical_stage.rb → core/physics_manager.rb} +36 -30
  78. data/lib/gamebox/{resource_manager.rb → core/resource_manager.rb} +19 -18
  79. data/lib/gamebox/{sound_manager.rb → core/sound_manager.rb} +9 -7
  80. data/lib/gamebox/{stage.rb → core/stage.rb} +42 -80
  81. data/lib/gamebox/{stage_manager.rb → core/stage_manager.rb} +46 -53
  82. data/lib/gamebox/{stagehand.rb → core/stagehand.rb} +0 -0
  83. data/lib/gamebox/{svg_document.rb → core/svg_document.rb} +0 -0
  84. data/lib/gamebox/core/timer_manager.rb +50 -0
  85. data/lib/gamebox/{viewport.rb → core/viewport.rb} +2 -3
  86. data/lib/gamebox/{wrapped_screen.rb → core/wrapped_screen.rb} +12 -19
  87. data/lib/gamebox/gamebox_application.rb +7 -15
  88. data/lib/gamebox/lib/evented_attributes.rb +51 -0
  89. data/lib/gamebox/{ftor.rb → lib/ftor.rb} +0 -0
  90. data/lib/gamebox/lib/min_max_helpers.rb +10 -0
  91. data/lib/gamebox/lib/rect.rb +112 -54
  92. data/lib/gamebox/lib/yoda.rb +46 -0
  93. data/lib/gamebox/spec/helper.rb +317 -12
  94. data/lib/gamebox/stagehands/spatial_tree_stagehand.rb +61 -0
  95. data/lib/gamebox/version.rb +8 -3
  96. data/lib/gamebox/views/graphical_actor_view.rb +22 -29
  97. data/script/perf_aabb.rb +56 -0
  98. data/script/perf_array_access.rb +16 -0
  99. data/script/perf_collisions.rb +37 -18
  100. data/script/perf_struct_vs_array.rb +7 -7
  101. data/spec/acceptance/animation_spec.rb +65 -0
  102. data/spec/acceptance/basic_actor_lifecycle_spec.rb +92 -0
  103. data/spec/acceptance/built_in_collision_handling_spec.rb +55 -0
  104. data/spec/acceptance/chipmunk_collision_handling_spec.rb +83 -0
  105. data/spec/acceptance/fps_actor_spec.rb +40 -0
  106. data/spec/acceptance/pausing_spec.rb +61 -0
  107. data/spec/acceptance/timer_usage_spec.rb +53 -0
  108. data/spec/actors/emitter_spec.rb +5 -0
  109. data/spec/{label_spec.rb → actors/label_spec.rb} +1 -1
  110. data/spec/behaviors/animated_spec.rb +85 -0
  111. data/spec/behaviors/collidable_spec.rb +134 -0
  112. data/spec/{physical_spec.rb → behaviors/physical_spec.rb} +2 -1
  113. data/spec/behaviors/positioned_spec.rb +6 -0
  114. data/spec/behaviors/projectile_spec.rb +6 -0
  115. data/spec/core/aabb_tree_spec.rb +109 -0
  116. data/spec/core/actor_factory_spec.rb +44 -0
  117. data/spec/core/actor_spec.rb +78 -0
  118. data/spec/core/actor_view_spec.rb +53 -0
  119. data/spec/{arbiter_spec.rb → core/arbiter_spec.rb} +29 -30
  120. data/spec/core/backstage_spec.rb +37 -0
  121. data/spec/core/behavior_factory_spec.rb +50 -0
  122. data/spec/core/behavior_spec.rb +8 -0
  123. data/spec/core/configuration_spec.rb +8 -0
  124. data/spec/core/core_spec.rb +13 -0
  125. data/spec/core/font_style_factory_spec.rb +17 -0
  126. data/spec/core/font_style_spec.rb +41 -0
  127. data/spec/core/hooked_gosu_window_spec.rb +75 -0
  128. data/spec/core/input_manager_spec.rb +285 -0
  129. data/spec/core/physics_manager_spec.rb +11 -0
  130. data/spec/core/resource_manager_spec.rb +12 -0
  131. data/spec/core/stage_manager_spec.rb +140 -0
  132. data/spec/core/stage_spec.rb +73 -0
  133. data/spec/core/timer_manager_spec.rb +89 -0
  134. data/spec/{viewport_spec.rb → core/viewport_spec.rb} +6 -3
  135. data/spec/core/wrapped_screen_spec.rb +26 -0
  136. data/spec/fixtures/game.yml +7 -0
  137. data/spec/fixtures/snelpling/idle/1.png +0 -0
  138. data/spec/fixtures/snelpling/jump/1.png +0 -0
  139. data/spec/fixtures/snelpling/jump/2.png +0 -0
  140. data/spec/fixtures/snelpling/jump/3.png +0 -0
  141. data/spec/helper.rb +8 -0
  142. data/spec/{class_finder_spec.rb → lib/class_finder_spec.rb} +2 -1
  143. data/spec/stagehands/spatial_tree_stagehand_spec.rb +19 -0
  144. data/spec/views/graphical_actor_view_spec.rb +116 -0
  145. metadata +343 -144
  146. data/README.txt +0 -34
  147. data/lib/gamebox/actor.rb +0 -179
  148. data/lib/gamebox/actor_factory.rb +0 -57
  149. data/lib/gamebox/actor_view.rb +0 -44
  150. data/lib/gamebox/actors/spatial_debugger.rb +0 -62
  151. data/lib/gamebox/behavior.rb +0 -70
  152. data/lib/gamebox/behaviors/timed.rb +0 -33
  153. data/lib/gamebox/behaviors/updatable.rb +0 -12
  154. data/lib/gamebox/console_app.rb +0 -41
  155. data/lib/gamebox/gamebox_generator.rb +0 -32
  156. data/lib/gamebox/generators/actor_generator.rb +0 -43
  157. data/lib/gamebox/generators/view_generator.rb +0 -42
  158. data/lib/gamebox/physical_director.rb +0 -17
  159. data/lib/gamebox/physics.rb +0 -32
  160. data/lib/gamebox/spatial_bucket.rb +0 -9
  161. data/lib/gamebox/spatial_hash.rb +0 -194
  162. data/lib/gamebox/spatial_stagehand.rb +0 -80
  163. data/lib/gamebox/templates/template_app/Gemfile +0 -6
  164. data/lib/gamebox/templates/template_app/config/environment.rb +0 -23
  165. data/lib/gamebox/templates/template_app/config/stage_config.yml +0 -2
  166. data/lib/gamebox/templates/template_app/script/generate +0 -7
  167. data/lib/gamebox/templates/template_app/src/demo_stage.rb +0 -11
  168. data/lib/gamebox/templates/template_app/src/game.rb +0 -19
  169. data/lib/gamebox/templates/template_app/src/my_actor.rb +0 -14
  170. data/script/perf_spatial_hash.rb +0 -64
  171. data/spec/actor_factory_spec.rb +0 -61
  172. data/spec/actor_spec.rb +0 -71
  173. data/spec/actor_view_spec.rb +0 -61
  174. data/spec/animated_spec.rb +0 -83
  175. data/spec/backstage_spec.rb +0 -45
  176. data/spec/behavior_spec.rb +0 -28
  177. data/spec/collidable_spec.rb +0 -135
  178. data/spec/emitter_spec.rb +0 -20
  179. data/spec/input_manager_spec.rb +0 -134
  180. data/spec/resource_manager_spec.rb +0 -13
  181. data/spec/spatial_hash_spec.rb +0 -119
  182. data/spec/spatial_stagehand_spec.rb +0 -93
  183. data/spec/stage_manager_spec.rb +0 -25
  184. data/spec/stage_spec.rb +0 -65
data/README.rdoc ADDED
@@ -0,0 +1,38 @@
1
+ = gamebox
2
+
3
+ * http://shawn42.github.com/gamebox/
4
+
5
+ == DESCRIPTION:
6
+
7
+ A game template for building and distributing Gosu games. See docs/getting_started.rdoc for help getting started.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Quickly generate a game and have it up and running.
12
+
13
+ == SYNOPSIS:
14
+
15
+ A game template for building and distributing Gosu games.
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * Gosu
20
+ * conject gem
21
+ * publisher gem
22
+ * bundler
23
+ * rspec (for gamebox tests)
24
+ * algorithms gem (optional for line of site and A*)
25
+
26
+ == INSTALL:
27
+
28
+ * gem install gamebox; gamebox my_cool_game
29
+
30
+ == Build Status {<img src="https://secure.travis-ci.org/shawn42/gamebox.png"/>}[http://travis-ci.org/shawn42/gamebox]
31
+
32
+ == Dependency Status {<img src="https://gemnasium.com/shawn42/gamebox.png?travis"/>}[https://gemnasium.com/shawn42/gamebox]
33
+
34
+ == LICENSE:
35
+
36
+ (MIT)
37
+
38
+ Copyright (c) 2009 Shawn Anderson
data/Rakefile CHANGED
@@ -1,10 +1,5 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
- begin
4
- require 'metric_fu'
5
- rescue LoadError
6
- puts "metric_fu (or a dependency) not available. Install it with: sudo gem install metric_fu"
7
- end
8
3
 
9
4
  STATS_DIRECTORIES = [
10
5
  %w(Source lib/),
@@ -22,11 +17,7 @@ begin
22
17
  desc "Run all rspecs"
23
18
  RSpec::Core::RakeTask.new(:spec) do |t|
24
19
  t.pattern = 'spec/**/*_spec.rb'
25
- end
26
-
27
- desc "Run all specs with rcov"
28
- RSpec::Core::RakeTask.new(:rcov) do |t|
29
- t.rcov = true
20
+ t.rspec_opts = '-c'
30
21
  end
31
22
 
32
23
  task :default => :spec
data/TODO.txt CHANGED
@@ -1,12 +1,14 @@
1
1
  TAKE YOUR PICK:
2
- - specs for stage manager
2
+ - move all classes into Gamebox module
3
3
  - collision detection performance for tiles?
4
4
  - collision detection honoring rotation?
5
5
  - highscore upload system (use from chingu) (takes json now)
6
- - rewrite update system to be all callback based
7
- * what does that do to PhysicalDirector when Director goes away?
8
6
  - solidify rdocs (including tutorial)
9
7
  - collidable "grouping"
8
+ - framerate setting should come from Gamebox.configuration.target_framerate?
9
+ - game.yml settings .. ^^^
10
+ - input_manager should accept symbols for look up.. :space => KbSpace
11
+ - ZERO PENDING SPECS
10
12
 
11
13
  EXAMPLES:
12
14
  - move to separate repo?
@@ -19,12 +21,10 @@ SOMEDAY:
19
21
 
20
22
  - make complex Phyiscal behaviors
21
23
  * made up by a group of bodies pinned together
22
- - physical objects should have bodies and shapes body/shape should be shorthand for bodies.first/shapes.first
23
-
24
24
  - create a DynamicPhysicalActor that can be built from external verts (SVG)
25
25
 
26
26
  - add nice actor debugging
27
- - add Extra; actor with a short time to live (TTL); useful for special effects (maybe as a behavior)
27
+ - add Extra; behavior with a short time to live (TTL); useful for special effects
28
28
 
29
29
  - optional GUI via Fidgit?
30
30
  - gamebox server (content server?)
@@ -0,0 +1,95 @@
1
+ require 'rbconfig'
2
+
3
+ class GameboxGenerator < RubiGen::Base
4
+ DEFAULT_SHEBANG = File.join(RbConfig::CONFIG['bindir'],
5
+ RbConfig::CONFIG['ruby_install_name'])
6
+
7
+ default_options :shebang => DEFAULT_SHEBANG
8
+
9
+ attr_reader :app_name, :module_name
10
+
11
+ def initialize(runtime_args, runtime_options = {})
12
+ super
13
+ usage if args.empty?
14
+ @destination_root = args.shift
15
+ @app_name = File.basename(File.expand_path(@destination_root))
16
+ @module_name = app_name.camelize
17
+ extract_options
18
+ end
19
+
20
+ def manifest
21
+ # Use /usr/bin/env if no special shebang was specified
22
+ script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
23
+ windows = (RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/)
24
+
25
+ record do |m|
26
+ # Root directory and all subdirectories.
27
+ m.directory ''
28
+ BASEDIRS.each { |path| m.directory path }
29
+
30
+ # Root
31
+ m.template_copy_each %w( Rakefile
32
+ README.rdoc
33
+ config/environment.rb
34
+ )
35
+
36
+ m.file_copy_each %w(
37
+ Gemfile
38
+ config/boot.rb
39
+ config/game.yml
40
+
41
+ data/fonts/FONTS_GO_HERE
42
+ data/graphics/GRAPHICS_GO_HERE
43
+ data/music/MUSIC_GOES_HERE
44
+ data/sounds/SOUND_FX_GO_HERE
45
+
46
+ spec/helper.rb
47
+
48
+ src/app.rb
49
+ src/demo_stage.rb
50
+ src/actors/player.rb
51
+ )
52
+
53
+ m.readme 'NEXT_STEPS.txt'
54
+
55
+ # Scripts
56
+ # %w( generate ).each do |file|
57
+ # m.template "script/#{file}", "script/#{file}", script_options
58
+ # # m.template "script/win_script.cmd", "script/#{file}.cmd",
59
+ # # :assigns => { :filename => file } if windows
60
+ # end
61
+
62
+ end
63
+ end
64
+
65
+ protected
66
+ def banner
67
+ <<-EOS
68
+ Create a stub for a gamebox game.
69
+
70
+ Usage: gamebox /path/to/your/app [options]"
71
+ EOS
72
+ end
73
+
74
+ def add_options!(opts)
75
+ opts.separator ''
76
+ opts.separator "Gamebox options:"
77
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number.")
78
+ end
79
+
80
+ def extract_options
81
+ end
82
+
83
+ # Installation skeleton. Intermediate directories are automatically
84
+ # created so don't sweat their absence here.
85
+ BASEDIRS = %w(
86
+ src/actors
87
+ spec
88
+ data/fonts
89
+ data/graphics
90
+ data/music
91
+ data/sounds
92
+ config
93
+ )
94
+ end
95
+
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+ # uncomment for chipmunk
3
+ # gem 'chipmunk'
4
+ gem 'require_all'
5
+ gem "gamebox", '>= 0.4.0'
6
+ gem "conject"
7
+ gem "rspec"
@@ -0,0 +1 @@
1
+ Now go write a game!!
@@ -0,0 +1,30 @@
1
+ APP_ROOT = "#{File.join(File.dirname(__FILE__),"..")}/"
2
+
3
+ require 'gamebox'
4
+
5
+ Gamebox.configure do |config|
6
+ config.config_path = APP_ROOT + "config/"
7
+ config.data_path = APP_ROOT + "data/"
8
+ config.music_path = APP_ROOT + "data/music/"
9
+ config.sound_path = APP_ROOT + "data/sounds/"
10
+ config.gfx_path = APP_ROOT + "data/graphics/"
11
+ config.fonts_path = APP_ROOT + "data/fonts"
12
+
13
+ config.gb_config_path = GAMEBOX_PATH + "config/"
14
+ config.gb_data_path = GAMEBOX_PATH + "data/"
15
+ config.gb_music_path = GAMEBOX_PATH + "data/music/"
16
+ config.gb_sound_path = GAMEBOX_PATH + "data/sounds/"
17
+ config.gb_gfx_path = GAMEBOX_PATH + "data/graphics/"
18
+ config.gb_fonts_path = GAMEBOX_PATH + "data/fonts"
19
+
20
+ # config.stages = [:demo]
21
+ # config.game_name = "Untitled Game"
22
+ end
23
+
24
+ [GAMEBOX_PATH, APP_ROOT, File.join(APP_ROOT,'src')].each{|path| $: << path }
25
+ require "gamebox_application"
26
+
27
+ require_all Dir.glob("**/*.rb").reject{ |f| f.match("spec") || f.match("src/app.rb")}
28
+
29
+
30
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
+
4
+ require 'active_support'
5
+ require 'rubigen'
6
+ require APP_ROOT + '/config/environment'
7
+
8
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
9
+
10
+ require 'rubigen/scripts/generate'
11
+ RubiGen::Base.use_component_sources!
12
+ RubiGen::Scripts::Generate.new.run(ARGV, source: GAMEBOX_PATH + '/component_generators/templates' )
@@ -0,0 +1,8 @@
1
+ define_actor :player do
2
+ has_behavior :positioned
3
+ view do
4
+ draw do |target, x_off, y_off, z|
5
+ target.draw_box actor.x,actor.y, 20, 20, Color::RED, 1
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class DemoStage < Stage
2
+ def setup
3
+ super
4
+ @player = spawn :player, x: 10, y:30
5
+ end
6
+ end
7
+
data/bin/gamebox CHANGED
@@ -1,80 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- Signal.trap("INT") { puts; exit }
4
-
5
- require 'yaml'
6
- require File.dirname(__FILE__) + '/../lib/gamebox/version'
3
+ require 'active_support'
4
+ require 'rubigen'
5
+ require 'gamebox'
7
6
 
8
7
  def print_version
9
8
  puts "Gamebox #{Gamebox::VERSION::STRING}"
10
9
  end
11
10
 
12
- def print_usage
13
- print_version
14
- puts "Usage:"
15
- puts "gamebox [opts] game_name"
16
- puts " -h, --help display this message"
17
- puts " -v, --version display gamebox version"
18
- end
19
-
20
- if %w(--version -v).include? ARGV.first
11
+ if ARGV.include?('-v') || ARGV.include?('--version')
21
12
  print_version
22
- exit(0)
23
- end
24
- if %w(--help -h).include? ARGV.first
25
- print_usage
26
- exit(0)
27
- end
28
- if ARGV.empty?
29
- print_usage
30
- exit(0)
31
- end
32
-
33
- begin
34
- # ruby 1.9
35
- require 'ftools'
36
- fklass = File
37
- rescue LoadError
38
- # ruby 1.8
39
- require 'fileutils'
40
- fklass = FileUtils
41
- end
42
-
43
- PROJECT_NAME = ARGV[0]
44
- TARGET_DIR = File.expand_path(Dir.pwd + "/" + PROJECT_NAME)
45
- SOURCE_DIR = File.expand_path(File.dirname(__FILE__) + "/../lib/gamebox/templates")
46
-
47
- Dir.mkdir(TARGET_DIR) unless File.exist?(TARGET_DIR) && File.directory?(TARGET_DIR)
48
-
49
- # Generate the directory structure for the new application
50
- # Gems does not pull in empty directories so template_app only
51
- # contains populated directories
52
- Dir.mkdir(TARGET_DIR + "/config")
53
- Dir.mkdir(TARGET_DIR + "/data")
54
- Dir.mkdir(TARGET_DIR + "/data/graphics")
55
- Dir.mkdir(TARGET_DIR + "/data/sounds")
56
- Dir.mkdir(TARGET_DIR + "/data/music")
57
- Dir.mkdir(TARGET_DIR + "/doc")
58
- Dir.mkdir(TARGET_DIR + "/lib")
59
- Dir.mkdir(TARGET_DIR + "/script")
60
- Dir.mkdir(TARGET_DIR + "/src")
61
- Dir.mkdir(TARGET_DIR + "/spec")
62
-
63
- Dir.chdir(SOURCE_DIR + "/template_app")
64
- Dir.glob("**/*").each do |file|
65
- puts "#{file} => #{TARGET_DIR + "/" + file}"
66
- if File.directory?(file)
67
- target_dir = TARGET_DIR + "/" + file
68
- Dir.mkdir(target_dir) unless File.exists? target_dir
69
- else
70
- new_file = TARGET_DIR + "/" + file
71
- fklass.install file, new_file
72
- fklass.chmod 0755, new_file if file =~ /script/
73
- end
74
- end
75
-
76
- new_file = TARGET_DIR + "/config/gamebox_generator_version.yml"
77
- File.open(new_file,"w+") do |f|
78
- f.write Gamebox::VERSION::ARRAY.to_yaml
13
+ exit 0
79
14
  end
80
15
 
16
+ require 'rubigen/scripts/generate'
17
+ RubiGen::Base.use_application_sources!
18
+ RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'gamebox')
@@ -0,0 +1,17 @@
1
+ # class GameboxGenerator < RubiGen::Base
2
+ # def manifest
3
+ # record do |m|
4
+ # # Root directory and all subdirectories.
5
+ # m.directory ''
6
+ # BASEDIRS.each { |path| m.directory path }
7
+ # binding.pry
8
+ # m.template 'actor.erb', "src/actors/#{name}.rb",
9
+ # m.template 'actor_spec.erb', "spec/actors/#{name}_spec.rb",
10
+ # end
11
+ # end
12
+ # BASEDIRS = %w(
13
+ # src/actors
14
+ # spec/actors
15
+ # )
16
+ # end
17
+ #
data/docs/CODE_REVIEW CHANGED
@@ -41,7 +41,7 @@ notes:
41
41
  * Can set later
42
42
  has_behaviors :graphical => {:tiled => true}
43
43
 
44
- def setup
44
+ def initialize
45
45
  self.graphical.num_x_tiles = ...
46
46
  ...
47
47
  end
@@ -0,0 +1,25 @@
1
+ TODO:
2
+ - double check actor view mechanism
3
+ - pull drawing code out of stage?
4
+ - update all gamebox actors
5
+ - update all behaviors
6
+ - solidify configuration and config_manager
7
+
8
+ - ALL specs passing (grep for __END__)
9
+ - fill in pending specs
10
+
11
+ examples
12
+ - roids
13
+ - princess
14
+ - omg aliens
15
+
16
+ missing acceptance specs
17
+ - pausing / unpausing
18
+ - showing / drawing actors (can test Z and order)
19
+ - physical collisions (non-chipmunk)
20
+ - chipmunk space
21
+
22
+
23
+ QUESTIONS:
24
+ - adding / removing behaviors? (only from other behaviors?)
25
+ - behavior inheritence? difficult for now; not recommended