Sha256: 15651ccd0f09a649e35bbe3bf587ac748b39db8de16c1207eb742230e8f960ab

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

module Straightedge
  class Director
    extend Forwardable
    include Straightedge::Figures

    def prepare_stage(geometry)
      @width, @height = *geometry
      @space = Grid.new([30,30], scale: 20.0)
      @space.paint!
    end

    def orchestrate
      @space.paint!
    end

    def current_scene
      Scene.new({
	ORIGIN    => @space,
	[10,10]   => "grid",

	[200,300] => Quadrilateral.new(dimensions: [200,100], color: :green),
	[200,305] => "rectangle",

	[400,300] => Hexagon.new(scale: 40.0, color: :blue),
	[400,305] => "hexagon"
      })
    end

    ## handle custom events from the surface (clicks)...
    #  how should we handle socket/player connects?
    #
    def handle(evt_name, *args)
      #puts "--- got event #{evt_name} with args #{args}"
      send(evt_name.to_sym, *args)
    end
  end

  config.agent_class = Director
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
straightedge-0.1.1 lib/straightedge/director.rb