Changeset 20191 for lang/ruby

Show
Ignore:
Timestamp:
09/29/08 14:54:52 (2 months ago)
Author:
authorNari
Message:

use optparse in nario.rb

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/nario/nario.rb

    r17197 r20191  
    1414require 'nario/scene' 
    1515require 'nario/material' 
     16require 'optparse' 
    1617 
     18@gc_burden_mode = false 
     19@test_mode = false 
     20opt = OptionParser.new 
     21opt.version = "1.0.0" 
     22opt.on('-g', '--gc', "To stop the world. and gc stop grafical mode :)") {|v| @gc_burden_mode = true} 
     23opt.on('-t', '--test', "test mode") {|v| @test_mode = true} 
     24opt.parse!(ARGV) 
    1725 
    18  
    19 if ARGV[0] != "gc" 
    20   def gc_start(screen) 
    21   end 
    22 else 
    23  
     26# burden to nario and gc :) 
     27if @gc_burden_mode 
    2428  @@arry = [] 
    2529  3000000.times{@@arry << Array.new} 
     
    3741    @@skip += 1 
    3842  end 
     43else 
     44  def gc_start(screen) 
     45  end 
    3946end 
    4047 
    41 $test = false 
    42 require 'gamestart' unless $test 
    43 require 'test' if $test 
     48require 'gamestart' unless @test_mode 
     49require 'test' if @test_mode