require 'rubygems' require 'sane' for file in ['overlayer', 'keyboard_input', 'screen_tracker', 'mouse', 'file_chooser'] require_relative '../lib/' + file end $VERBOSE = 1 if ARGV.delete('-v') $TEST = 1 if ARGV.delete('-t') $stderr.puts 'warning: currently windows only for certain parts currently' unless ENV['OS'] == 'Windows_NT' if ARGV.detect{|arg| arg == '-h' || arg == '--help'} puts <<-END syntax: mute_lists.yml [player_description.yml] (or enter nothing to be prompted for files) END for file in Dir[__dir__ + '../zamples/mute*/*'] puts "\n", "Example file:", file + "\n\n", File.read(file) end puts '', 'Available files:' for file in Dir[__dir__ + '../zamples/*/*'] puts File.expand_path(file) unless File.directory?(file) end exit 1 else # allow for command line filenames scene_list = ARGV.shift if scene_list == 'test' puts 'warning--only doing screen dump in 4s...' overlay = nil $VERBOSE = 1 # that's what they wanted... sleep 4 else if !File.exist? scene_list.to_s scene_list = FileChooser.choose_file("Please select your scene list", __dir__ + "/../zamples/scene_lists") end unless scene_list puts 'error: have to specify scene list, or specify "test" on the command line if you just want to snapshot your player' exit 1 end overlay = OverLayer.new(scene_list) overlay.start_thread true end player_description = ARGV.shift if !File.exist?(player_description.to_s) player_description = FileChooser.choose_file("Please select your Player description (optional)", __dir__ + "/../zamples/players") end if File.exist? player_description.to_s # this one doesn't use file updates, so pass it the string Mouse.jitter_forever_in_own_thread puts 'Selected player ' + player_description, '' screen_tracker = ScreenTracker.new_from_yaml File.binread(player_description), overlay screen_tracker.dump_bmp if $VERBOSE # exit early if we just wanted a screen dump...a little kludgey... exit 1 unless overlay screen_tracker.process_forever_in_thread else puts 'warning--not using any screen tracking...' end key_input = KeyboardInput.new overlay key_input.start_thread # status thread key_input.handle_keystrokes_forever # when this method exits, we want to exit fully... end