Sha256: 3d070e105f3a9879b0fcd38b3f349ca0f0f2e4d0417366b927108898fec5856f

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

module RubyJard
  class ScreenDrawer
    def initialize(output:, screen:, color_scheme:)
      @output = output
      @screen = screen
      @color_decorator = RubyJard::Decorators::ColorDecorator.new(color_scheme)
    end

    def draw
      @screen.window.each_with_index do |line, index|
        RubyJard::Console.move_to(@output, @screen.layout.x, @screen.layout.y + index)
        @output.print line
      end
      (@screen.window.length..@screen.layout.height - 1).each do |index|
        RubyJard::Console.move_to(@output, @screen.layout.x, @screen.layout.y + index)
        @output.print @color_decorator.decorate(:background, ' ' * @screen.layout.width)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_jard-0.2.2 lib/ruby_jard/screen_drawer.rb
ruby_jard-0.2.1 lib/ruby_jard/screen_drawer.rb