class Infopane

Score, turn and event texts

Attributes

cursor[W]
faction[R]
score[R]
text[W]
turn[R]

Public Class Methods

new() click to toggle source
# File lib/lib/user_interface/infopane.rb, line 8
def initialize
  @turn = 0
  @faction = FACTIONS # so that FAC1 will be then the first active faction
  @score = [0, 0]
  @text = 'ready'
end

Public Instance Methods

add_score(to_whom, how_much) click to toggle source
# File lib/lib/user_interface/infopane.rb, line 46
def add_score(to_whom, how_much)
  @score[to_whom] += how_much
end
draw() click to toggle source
# File lib/lib/user_interface/infopane.rb, line 18
def draw
  freeroam_text = ""
  freeroam_text = " (freeroam)" if (@cursor and @cursor.freeroam)

  state = Gosu::Image.from_text(turnscore + freeroam_text, LINE_HEIGHT)
  state.draw(XTEXT, YTEXT, ZTEXT)

  text = Gosu::Image.from_text("#{@text}", LINE_HEIGHT)
  text.draw(XTEXT, (TILESIZE / 2) + YTEXT, ZTEXT)
end
next_faction!() click to toggle source

Increment faction counter (modulo count of factions)

# File lib/lib/user_interface/infopane.rb, line 36
def next_faction!
  @faction += 1
  @faction = 1 if @faction > FACTIONS # marks the end of turn
end
next_turn!() click to toggle source

Increment turn counter

# File lib/lib/user_interface/infopane.rb, line 42
def next_turn!
  @turn += 1
end
turnscore() click to toggle source
# File lib/lib/user_interface/infopane.rb, line 29
def turnscore
  "Turn: #{@turn}, " \
  "Faction: FAC#{@faction}, " \
  "Score: #{@score[0]} - #{@score[1]}"
end
update() click to toggle source
# File lib/lib/user_interface/infopane.rb, line 15
def update
end