Class: Launch::View
Constant Summary
Constants included
from CursesLib
CursesLib::BLUE_COLOR, CursesLib::CYAN_COLOR, CursesLib::GREEN_COLOR, CursesLib::MAGENTA_COLOR, CursesLib::ORANGE, CursesLib::ORANGE_COLOR, CursesLib::RED_COLOR, CursesLib::WHITE_COLOR, CursesLib::YELLOW_COLOR
Instance Method Summary
collapse
Methods included from CursesLib
#attrib
Constructor Details
#initialize ⇒ View
Returns a new instance of View.
16
17
18
|
# File 'lib/launch_view.rb', line 16
def initialize
@last_frame = Launch::InitialFrame.new
end
|
Instance Method Details
#burnt ⇒ Object
44
45
46
|
# File 'lib/launch_view.rb', line 44
def burnt
attrib(Curses::color_pair(ORANGE_COLOR)) { yield }
end
|
#render ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/launch_view.rb', line 20
def render
burnt do
Curses::setpos *translate_frame
Curses::addstr "."
end
@last_frame = Launch::Frame.new(@last_frame)
white do
Curses::setpos *translate_frame
Curses::addstr "."
end
return @last_frame.alive?
end
|
#translate_frame ⇒ Object
34
35
36
37
38
|
# File 'lib/launch_view.rb', line 34
def translate_frame
x = @last_frame.position[:x]
y = YMAX - @last_frame.position[:y]
[y, x]
end
|
#white ⇒ Object
40
41
42
|
# File 'lib/launch_view.rb', line 40
def white
attrib(Curses::A_BOLD) { yield }
end
|