Class: RubyJard::ScreenDrawer
- Inherits:
-
Object
- Object
- RubyJard::ScreenDrawer
- Defined in:
- lib/ruby_jard/screen_drawer.rb
Overview
Draw rendered screen bitmap in current screen window onto the screen. Fulfill missing window if needed
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(output:, screen:, color_scheme:) ⇒ ScreenDrawer
constructor
A new instance of ScreenDrawer.
Constructor Details
#initialize(output:, screen:, color_scheme:) ⇒ ScreenDrawer
Returns a new instance of ScreenDrawer.
8 9 10 11 12 |
# File 'lib/ruby_jard/screen_drawer.rb', line 8 def initialize(output:, screen:, color_scheme:) @output = output @screen = screen @color_decorator = RubyJard::Decorators::ColorDecorator.new(color_scheme) end |
Instance Method Details
#draw ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_jard/screen_drawer.rb', line 14 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 |