Skip to content
This repository has been archived by the owner on Nov 17, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://carl.local/brains
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislloyd committed Nov 22, 2009
2 parents b6f8d2f + 4f55eb4 commit 6d82254
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ui/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ def font
end

def name
@name ||= data['name'].sub(/\.local$/,'')
@name ||= data['name'].sub(/\.local\.$/,'')
end

def title
"#{name.gsub('.local.', '')}: #{data['health']} - #{data['score']}"
end

def draw_health
label = "#{name} (#{data['health']})"
label = title

label_width = font.text_width(label)
overlay_x = x - label_width / 2
Expand Down Expand Up @@ -317,12 +321,6 @@ def humans
actors.select {|a| a.robot? }
end

def draw_scores
humans.select { |h| !h.dead? }.sort_by {|h| h.score}.reverse.each_with_index do |human, i|
font.draw("#{human.name}: #{human.score}", 0, i*20, ZIndex.for(:overlay), 1.0, 1.0, 0xFF000000)
end
end

end

window = Window.new
Expand Down

0 comments on commit 6d82254

Please sign in to comment.