Class: Infopane

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/user_interface/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.



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

Parameters:

  • value

    the value to set the attribute act_fact to.



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

Parameters:

  • value

    the value to set the attribute text to.



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

#drawObject



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_factionObject



26
27
28
# File 'lib/lib/user_interface/infopane.rb', line 26

def next_faction
  # TODO active faction switching
end

#next_turnObject



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

#updateObject



14
15
# File 'lib/lib/user_interface/infopane.rb', line 14

def update
end