shattered 0.3 → 0.3.1

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/lib/game_loader.rb CHANGED
@@ -19,30 +19,27 @@ module Shatter
19
19
  class GameLoader
20
20
  include Singleton
21
21
  attr_writer :environment
22
- def require_all_files
23
- Dir.foreach("#{SHATTERED_ROOT}/app/") do |type|
24
- next if File.file?("#{SHATTERED_ROOT}/app/#{type}")
25
- next if type =~ /view/ or type =~ /state/
26
- Dir.foreach("#{SHATTERED_ROOT}/app/#{type}") do |file|
27
- require "#{SHATTERED_ROOT}/app/#{type}/#{file}" if file =~ /\.rb$/
28
- end
22
+
23
+ # This will recourse into the app/** directories and load all ruby files inside those directories.
24
+ def load_all_sources(shattered_root)
25
+ File.find_by_extension(shattered_root+"/app", "rb").each do |file|
26
+ require(file)
29
27
  end
30
28
  end
31
29
  def run
32
30
  view = ShatteredView::Runner.new @environment
33
31
  view.add_to_environment @environment
34
- control = ShatteredController::Runner.new @environment
32
+ control = ShatteredController::Runner.new(@environment)
35
33
  ShatteredSupport::Configuration.environment=@environment
34
+ load_all_sources(SHATTERED_ROOT)
36
35
 
37
- puts "require '#{SHATTERED_ROOT}/app/states/#{@environment[:start_state].to_s}_state'"
38
36
  begin
39
- eval "require '#{SHATTERED_ROOT}/app/states/#{@environment[:start_state].to_s}_state'"
37
+ require "#{SHATTERED_ROOT}/app/states/#{@environment[:start_state].to_s}_state"
40
38
  rescue StandardError => output
41
39
  puts output.message
42
40
  end
43
- puts "creating #{@environment[:start_state].to_s.camelize}State.new"
44
-
45
- eval "#{@environment[:start_state].to_s.camelize}State.new"
41
+
42
+ eval("#{@environment[:start_state].to_s.camelize}State").new
46
43
  control.start_game
47
44
  end
48
45
  end
@@ -25,11 +25,8 @@ class ShatteredAppGenerator < Rails::Generator::Base
25
25
  m.file "templates/Rakefile", "Rakefile"
26
26
  m.file "templates/README", "README"
27
27
 
28
- # ogre plugins and configuration
29
- m.template "templates/configs/plugins.cfg", "config/plugins.cfg"
30
- m.template "templates/configs/plugins.linux.cfg", "config/plugins.linux.cfg"
31
- m.template "templates/configs/plugins.darwin.cfg", "config/plugins.darwin.cfg"
32
- m.template "templates/configs/plugins.win32.cfg", "config/plugins.win32.cfg"
28
+ # ogre plugins and configuration
29
+ m.file "templates/configs/ogre_plugins.rcfg", "config/ogre_plugins.rcfg"
33
30
  m.template "templates/configs/ogre.cfg", "config/ogre.cfg"
34
31
  m.template "templates/configs/boot.rb", "config/boot.rb"
35
32
 
@@ -1,4 +1,3 @@
1
1
  class <%= class_name %>State < ShatteredController::State
2
- def update(time_elapsed)
3
- end
2
+ key :pressed => :escape, :action => :crash
4
3
  end
data/lib/shatter.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  ["shattered_model", "shattered_view","shattered_controller"].each do |component|
2
2
  begin
3
- # require File.dirname(__FILE__) + "/../../#{component}/lib/#{component}"
4
3
  require component
5
4
  rescue MissingSourceFile
6
5
  require 'rubygems'
@@ -0,0 +1,18 @@
1
+ // The PluginFolder tells Ogre where OgreMain.dll can be found.
2
+ <% if PLATFORM =~ /mswin/ %>
3
+ PluginFolder=<%= SHATTERED_OGRE_DLLS %>
4
+ <% elsif PLATFORM =~ /darwin/ %>
5
+ <% else %>
6
+ PluginFolder=/usr/local/lib/OGRE
7
+ <% end %>
8
+
9
+ // Each of these plugins loads a seperate subsystem of Ogre.
10
+ <%
11
+ plugins = %w( RenderSystem_GL RenderSystem_Direct3D9
12
+ Plugin_ParticleFX Plugin_BSPSceneManager
13
+ Plugin_OctreeSceneManager Plugin_CgProgramManager )
14
+ plugins -= ["RenderSystem_Direct3D9"] unless PLATFORM =~ /mswin32/
15
+ %>
16
+ <% plugins.each do |plugin| %>
17
+ Plugin=<%= plugin %>
18
+ <% end %>
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: shattered
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.3"
7
- date: 2006-04-23
6
+ version: 0.3.1
7
+ date: 2006-05-16
8
8
  summary: "Shattered: The main package tieing together controller, view, and model"
9
9
  require_paths:
10
10
  - lib
@@ -94,10 +94,7 @@ files:
94
94
  - lib/templates/configs/empty.log
95
95
  - lib/templates/configs/Mac
96
96
  - lib/templates/configs/ogre.cfg
97
- - lib/templates/configs/plugins.cfg
98
- - lib/templates/configs/plugins.darwin.cfg
99
- - lib/templates/configs/plugins.linux.cfg
100
- - lib/templates/configs/plugins.win32.cfg
97
+ - lib/templates/configs/ogre_plugins.rcfg
101
98
  - lib/templates/configs/runner.rb
102
99
  - lib/templates/configs/Mac/shattered.app
103
100
  - lib/templates/configs/Mac/shattered.app/config
@@ -1 +0,0 @@
1
- link ../../
@@ -1,16 +0,0 @@
1
- # Defines plugins to load
2
-
3
- # Define plugin folder
4
- # TODO: Define cross platform way of doing this
5
- PluginFolder=/usr/local/lib/OGRE
6
- #PluginFolder=view
7
-
8
- # Define D3D rendering implementation plugin
9
- Plugin=RenderSystem_GL
10
- #Plugin=RenderSystem_Direct3D7
11
- #Plugin=RenderSystem_Direct3D9
12
- Plugin=Plugin_ParticleFX
13
- Plugin=Plugin_BSPSceneManager
14
- Plugin=Plugin_OctreeSceneManager
15
- #Plugin=Plugin_CgProgramManager
16
-
@@ -1,13 +0,0 @@
1
- # Defines plugins to load
2
-
3
- # Define plugin folder -- Plugin folder is ignored
4
- # in Project Builder build -- plugins are found in Resources/
5
- # in the Main (Application) bundle, then in the Framework bundle
6
- # PluginFolder=/usr/local/lib/OGRE
7
-
8
- # Define D3D rendering implementation plugin
9
- Plugin=RenderSystem_GL
10
- Plugin=Plugin_ParticleFX
11
- Plugin=Plugin_BSPSceneManager
12
- Plugin=Plugin_OctreeSceneManager
13
- Plugin=Plugin_CgProgramManager
@@ -1,16 +0,0 @@
1
- # Defines plugins to load
2
-
3
- # Define plugin folder
4
- # TODO: Define cross platform way of doing this
5
- PluginFolder=/usr/local/lib/OGRE
6
- #PluginFolder=view
7
-
8
- # Define D3D rendering implementation plugin
9
- Plugin=RenderSystem_GL
10
- #Plugin=RenderSystem_Direct3D7
11
- #Plugin=RenderSystem_Direct3D9
12
- Plugin=Plugin_ParticleFX
13
- Plugin=Plugin_BSPSceneManager
14
- Plugin=Plugin_OctreeSceneManager
15
- #Plugin=Plugin_CgProgramManager
16
-
@@ -1,9 +0,0 @@
1
-
2
- PluginFolder=C:\ruby\lib\ruby\gems\1.8\gems\shattered_ogre-0.3-i386-mswin32\lib\i386-mswin32
3
-
4
- Plugin=RenderSystem_GL
5
- Plugin=RenderSystem_Direct3D9
6
- Plugin=Plugin_ParticleFX
7
- Plugin=Plugin_BSPSceneManager
8
- Plugin=Plugin_OctreeSceneManager
9
- Plugin=Plugin_CgProgramManager