Class: Infopane
- Inherits:
-
Object
- Object
- Infopane
- Defined in:
- lib/lib/user_interface/infopane.rb
Overview
Score, turn and event texts
Instance Attribute Summary collapse
-
#act_fact ⇒ Object
writeonly
Sets the attribute act_fact.
-
#text ⇒ Object
writeonly
Sets the attribute text.
Instance Method Summary collapse
- #add_score(to_whom, how_much) ⇒ Object
- #draw ⇒ Object
-
#initialize ⇒ Infopane
constructor
A new instance of Infopane.
- #next_faction ⇒ Object
- #next_turn ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ Infopane
Returns a new instance of Infopane.
7 8 9 10 11 12 |
# File 'lib/lib/user_interface/infopane.rb', line 7 def initialize @score = [0, 0] @turn = 0 @act_fact = 0 # active faction @text = 'ready' end |
Instance Attribute Details
#act_fact=(value) ⇒ Object (writeonly)
Sets the attribute act_fact
5 6 7 |
# File 'lib/lib/user_interface/infopane.rb', line 5 def act_fact=(value) @act_fact = value end |
#text=(value) ⇒ Object (writeonly)
Sets the attribute text
5 6 7 |
# File 'lib/lib/user_interface/infopane.rb', line 5 def text=(value) @text = value end |
Instance Method Details
#add_score(to_whom, how_much) ⇒ Object
35 36 37 |
# File 'lib/lib/user_interface/infopane.rb', line 35 def add_score(to_whom, how_much) @score[to_whom] += how_much end |
#draw ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/lib/user_interface/infopane.rb', line 17 def draw turnscore = Gosu::Image.from_text( "Turn: #{@turn}, Score: #{@score[0]} - #{@score[1]}", LINE_HEIGHT) turnscore.draw(XTEXT, YTEXT, ZTEXT) text = Gosu::Image.from_text("#{@text}", LINE_HEIGHT) text.draw(XTEXT, (TILESIZE / 2) + YTEXT, ZTEXT) end |
#next_faction ⇒ Object
26 27 28 |
# File 'lib/lib/user_interface/infopane.rb', line 26 def next_faction # TODO active faction switching end |
#next_turn ⇒ Object
30 31 32 33 |
# File 'lib/lib/user_interface/infopane.rb', line 30 def next_turn @turn += 1 puts "Turn: #{@turn}, Score: #{@score[0]} - #{@score[1]}" end |
#update ⇒ Object
14 15 |
# File 'lib/lib/user_interface/infopane.rb', line 14 def update end |