Sha256: 426fbdf4cc13c14066cc6ba05c48047dfe26c8b0885edf9a449ff06a49683d32

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 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, "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.2 lib/straightedge/director.rb