Class: Falling::MapView

Inherits:
View
  • Object
show all
Defined in:
lib/falling/map_view.rb

Instance Method Summary collapse

Constructor Details

#initialize(universe:) ⇒ MapView

Returns a new instance of MapView.



7
8
9
10
11
# File 'lib/falling/map_view.rb', line 7

def initialize(universe:)
  Falling.logger.info "Initializing MapView."
  @universe = universe
  super()
end

Instance Method Details

#refreshObject

FIXME: Add smart camera centering.



14
15
16
17
18
19
20
21
22
23
# File 'lib/falling/map_view.rb', line 14

def refresh
  active_area.
    to_a[0, height].
    each_with_index do |row_string, row_index|
      window.setpos row_offset + row_index, column_offset
      window.addstr row_string[0, width]
    end

  super
end