Permalink
Browse files

Awesome amount of progress on clock interface.

  • Loading branch information...
1 parent 4c2a454 commit c7c0db179c25c565369c8cf20a1872c059528d81 @toothrot toothrot committed Sep 13, 2010
Showing with 26 additions and 2 deletions.
  1. +1 −1 conf-sample.yml
  2. +25 −1 lib/helpers/race_helper.rb
View
@@ -14,7 +14,7 @@ sensor:
# == Choose a Track
# What display would you like?
# progress_bars - the classic race window
-# circle_track - the *actual* classic race window (experimental)
+# clock - A stopwatch style race track
track: progress_bars
# how long the race should be, in meters
View
@@ -28,10 +28,34 @@ def right_bars(race)
}
end
- def race_track(race,speed=false)
+ def race_track(race, speed=false)
self.send(RACE_TRACK, race, speed)
end
+ def clock(race, speed)
+ stack do
+ nofill
+ stroke black
+ strokewidth 5
+
+ left = @center.width/2
+ top = @center.height/2
+ oval :left => left, :top => top, :width => top * 2, :center => true
+
+ race.race_participations.each do |racer|
+ strokewidth 8
+ fill eval(racer.color)
+ stroke eval(racer.color)
+ progress_angle = ((racer.percent_complete * 2 * Shoes::PI) - 0.5 * Shoes::PI)
+ end_angle = (progress_angle - (2*Shoes::PI)/360)
+ shape do
+ move_to(left, top)
+ arc_to(left,top,top*2,top*2,progress_angle,progress_angle)
+ end
+ end
+ end
+ end
+
def progress_bars(race,speed=false)
stack do # start progress_bars
flow do

0 comments on commit c7c0db1

Please sign in to comment.