Sha256: 7652a0280f70f1589ddeedd611b1ce146b6abbcc415addf5f425a6bf11a57b1f
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'singleton' include ShatteredController include ShatteredView include ShatteredModel module Shatter #:nodoc:all #This class is loads the view, controller, and model. It then loads #and starts the game based on these. class GameLoader include Singleton attr_writer :environment # This will recourse into the app/** directories and load all ruby files # inside those directories. def load_all_sources(shattered_root) File.find_by_extension(shattered_root+"/app", "rb").each do |file| require(file) end end def run view = ShatteredView::Runner.new @environment view.add_to_environment @environment control = ShatteredController::Runner.new(@environment) ShatteredPack::Configuration.environment=@environment load_all_sources(SHATTERED_ROOT) begin require "#{SHATTERED_ROOT}/app/states/#{@environment[:start_state].to_s}_state" rescue StandardError => output puts output.message end eval("#{@environment[:start_state].to_s.camelize}State").new control.start_game end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shattered-0.3.3 | lib/game_loader.rb |