Sha256: 9a0b974b2bd5eb28371afe59166e6881be609beb2279a3af6106ef7912afece4

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

require 'rubygems'
require 'commander'

module AMazeIng

  # For now there are three game mode
  # 1 is classic
  # 2 is multiplayer
  # 3 is anoying friend
  class CLI
    include Commander::Methods    
    
    def run
      @full_screen = false

      program :name, AMazeIng::Configuration::PROGRAM_NAME 
      program :version, AMazeIng::VERSION
      program :description, AMazeIng::Configuration::DESCRIPTION 

      default_command :classic

      global_option('-f', '--fullscreen', 'Render window at full screen') {
        @full_screen = true
      }


      command :classic do |c|
        c.syntax = 'a_maze_ing classic [options]'
        c.description = 'Classic mode, difficulty increase with level'
        c.action do 

            # the second parameter is game mode 
            AMazeIng::GameWindow.new(@full_screen,1).show
        end
      end

      command :multiplayer do |c|
        c.syntax = 'a_maze_ing multiplayer [options]'
        c.description = 'Multiplayer mode, two player race to the gate, player 2 use W/S/A/D key to move up/down/left/right'
        c.action do 
            AMazeIng::GameWindow.new(@full_screen,2).show
        end
      end
      alias_command :'m', :multiplayer


      command :annoying_friend do |c|
        c.syntax = 'a_maze_ing anfri [options]'
        c.description = 'Annoying friend mode, player 1 try to get to the gate while the player 2(annoying friend) try to catch him'
        c.action do 
            AMazeIng::GameWindow.new(@full_screen,3).show
        end
      end
      alias_command :'af', :annoying_friend, :'anfri', :'multiplayer2', :'multiplayer_2'

      run!
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
a_maze_ing-0.5.5 lib/a_maze_ing/cli.rb