Sha256: 2677718d5bd0aee3224d0509dee61f67e866b4f5a30c136cff1b07afafe3bd3c

Contents?: true

Size: 977 Bytes

Versions: 2

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

module RubyJard
  ##
  # A screen is a unit of information drawing on the terminal. Each screen is
  # generated based on input layout specifiation, screen data, and top-left
  # corner cordination.
  class Screen
    attr_accessor :layout, :rows, :color_scheme, :window, :cursor, :selected

    def initialize(session: nil, layout:, color_scheme:)
      @session = session || RubyJard.current_session
      @layout = layout
      @color_scheme = color_scheme
      @window = []
      @cursor = nil
      @selected = 0
      @rows = []
      @need_to_render = true
    end

    def move_down; end

    def move_up; end

    def page_up; end

    def page_down; end

    def click(relative_x, relative_y); end

    def build
      raise NotImplementedError, "#{self.class} should implement this method."
    end

    def need_to_render?
      @need_to_render == true
    end

    def mark_rendered!
      @need_to_render = false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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