7 use Glib qw(TRUE FALSE);
14 my $gui = SCX::GUI->new({ img_height => 100 });
15 my $track = SCX::Track->new({ gui => $gui });
18 my $tty = '/dev/ttyUSB0';
20 if (defined $ARGV[0] && $ARGV[0] eq '-') {
25 my $parser = SCX::RaceParser->new({
38 print STDERR "Demo mode only: $@";
41 $track->car(0)->set_model('F1 Ferrari');
42 $track->car(1)->set_model('F1 McLaren');
43 #$track->car(2)->set_model('F1 Williams');
44 $track->car(2)->set_model('Citroen Xsara');
45 $track->car(3)->set_model('Chevrolet Corvette gelb');
46 $track->car(4)->set_model('Ferrari 360 Red Bull');
47 $track->car(5)->set_model('Ferrari 360 Cric Crac');
49 $track->car(0)->set_driver('Ferrari');
50 $track->car(1)->set_driver('McLaren');
51 $track->car(2)->set_driver('Xsara');
54 Glib::IO->add_watch(fileno($reader->fh), 'in', \&scx_read, $reader);
56 # Just display some random values
60 $gui->best_lap('12.3');
63 $track->{race_running_since} = $now;
64 $track->{race_running} = 1;
66 $track->finish_line($now + 0.5, 1, 2);
67 $track->finish_line($now + 0.7, 1, 1);
68 $track->finish_line($now + 4.9, 1, 1);
69 $track->finish_line($now + 5.3, 1, 2);
70 $track->finish_line($now + 7.2, 1, 1);
71 $track->finish_line($now + 8.1, 0, 2);
72 # $track->car(0)->set_lap(13);
73 # $track->car(1)->set_lap(11);
74 # $track->car(2)->set_lap(10);
75 # $track->car(3)->set_lap(undef);
76 # $track->car(4)->set_lap(undef);
77 # $track->car(5)->set_lap(undef);
79 $track->car(0)->set_laptime(9.12322);
80 $track->car(1)->set_laptime(15.313);
81 $track->car(2)->set_laptime(5.989);
83 $track->car(0)->set_fuel(6);
84 $track->car(1)->set_fuel(2);
85 $track->car(2)->set_fuel(8);
87 $track->car(0)->set_throttle(0);
88 $track->car(1)->set_throttle(8, 1);
89 $track->car(2)->set_throttle(12);
104 my ($event, $fh, $reader) = @_;