Class: Basher::UI::DebugView

Inherits:
BaseView
  • Object
show all
Defined in:
lib/basher/ui/debug_view.rb

Instance Attribute Summary collapse

Attributes inherited from BaseView

#should_redraw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseView

#clear, #initialize, #resize_and_reposition, #will_resize!

Constructor Details

This class inherits a constructor from Basher::UI::BaseView

Instance Attribute Details

#gameObject

Returns the value of attribute game.



4
5
6
# File 'lib/basher/ui/debug_view.rb', line 4

def game
  @game
end

#last_inputObject

Returns the value of attribute last_input.



5
6
7
# File 'lib/basher/ui/debug_view.rb', line 5

def last_input
  @last_input
end

Class Method Details

.linesObject



7
8
9
# File 'lib/basher/ui/debug_view.rb', line 7

def self.lines
  1
end

Instance Method Details

#setupObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/basher/ui/debug_view.rb', line 11

def setup
  draw_text = -> {
    setup_left_part
    setup_right_part
  }

  if game.state.in_game?
    clear
    render every: 0.04 do
      draw_text.call
    end
  else
    clear
    draw_text.call
  end
end