Class: Infopane

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

Overview

Score, turn and event texts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInfopane

Returns a new instance of Infopane.



5
6
7
8
9
10
# File 'lib/infopane.rb', line 5

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

Parameters:

  • value

    the value to set the attribute act_fact to.



3
4
5
# File 'lib/infopane.rb', line 3

def act_fact=(value)
  @act_fact = value
end

#text=(value) ⇒ Object (writeonly)

Sets the attribute text

Parameters:

  • value

    the value to set the attribute text to.



3
4
5
# File 'lib/infopane.rb', line 3

def text=(value)
  @text = value
end

Instance Method Details

#add_score(to_whom, how_much) ⇒ Object



33
34
35
# File 'lib/infopane.rb', line 33

def add_score(to_whom, how_much)
  @score[to_whom] += how_much
end

#drawObject



15
16
17
18
19
20
21
22
# File 'lib/infopane.rb', line 15

def draw
  turnscore = Gosu::Image.from_text(
    self, "Turn: #{@turn}, Score: #{@score[0]} -  #{@score[1]}", Gosu.default_font_name, 20)
  turnscore.draw(XTEXT, YTEXT, ZTEXT)

  text = Gosu::Image.from_text(self, "#{@text}", Gosu.default_font_name, 20)
  text.draw(XTEXT, (TILESIZE / 2) + YTEXT, ZTEXT)
end

#next_factionObject



24
25
26
# File 'lib/infopane.rb', line 24

def next_faction
  
end

#next_turnObject



28
29
30
31
# File 'lib/infopane.rb', line 28

def next_turn
  @turn += 1
  puts "Turn: #{@turn}, Score: #{@score[0]} -  #{@score[1]}"
end

#updateObject



12
13
# File 'lib/infopane.rb', line 12

def update
end