Class: Falling::Interface

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(universe:, player: true) ⇒ Interface

Returns a new instance of Interface.



9
10
11
12
13
# File 'lib/falling/interface.rb', line 9

def initialize(universe:,
               player: true)
  create_player! if player
  @universe = universe
end

Instance Attribute Details

#playerObject (readonly)

Returns the value of attribute player.



7
8
9
# File 'lib/falling/interface.rb', line 7

def player
  @player
end

Instance Method Details

#run!Object



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

def run!
  with_screen do
    loop do
      map_view.refresh
      messages_view.refresh
      Curses.doupdate
      break unless messages_view.step!
    end
  end
end