Class: Zgomot::UI::TitleWindow

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/zgomot/ui/windows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#set_color, #write

Constructor Details

#initialize(text, color, top, text_color = nil) ⇒ TitleWindow

Returns a new instance of TitleWindow.



340
341
342
343
344
# File 'lib/zgomot/ui/windows.rb', line 340

def initialize(text, color, top, text_color = nil)
  @text_color = text_color || color
  @text, @color, @top = text, color, top
  display
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



339
340
341
# File 'lib/zgomot/ui/windows.rb', line 339

def color
  @color
end

#textObject (readonly)

Returns the value of attribute text.



339
340
341
# File 'lib/zgomot/ui/windows.rb', line 339

def text
  @text
end

#text_colorObject (readonly)

Returns the value of attribute text_color.



339
340
341
# File 'lib/zgomot/ui/windows.rb', line 339

def text_color
  @text_color
end

#topObject (readonly)

Returns the value of attribute top.



339
340
341
# File 'lib/zgomot/ui/windows.rb', line 339

def top
  @top
end

#windowsObject (readonly)

Returns the value of attribute windows.



339
340
341
# File 'lib/zgomot/ui/windows.rb', line 339

def windows
  @windows
end

Instance Method Details

#displayObject



345
346
347
348
349
350
351
352
353
354
355
# File 'lib/zgomot/ui/windows.rb', line 345

def display
  set_color(color) {
    write(top, 0, '-' * WIDTH)
    write(top + 1, 0, '|')
    write(top + 1, WIDTH-1, '|')
    write(top + 2, 0, '-' * WIDTH)
  }
  set_color(text_color) {
    write(top + 1, 1, text.center(WIDTH-2))
  }
end