7 use Glib qw(TRUE FALSE);
14 my $gui = SCX::GUI->new({ img_height => 120 });
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(3)->set_model('Citroen Xsara');
45 $track->car(4)->set_model('Citroen C4');
46 $track->car(5)->set_model('Ford Focus');
48 $track->car(0)->set_driver('Ivi');
49 $track->car(1)->set_driver('Filípek');
50 $track->car(2)->set_driver('Táta');
53 Glib::IO->add_watch(fileno($reader->fh), 'in', \&scx_read, $reader);
55 # Just display some random values
59 $gui->best_lap('12.3');
62 $track->{race_running_since} = $now;
63 $track->{race_running} = 1;
65 $track->finish_line($now + 0.5, 1, 2);
66 $track->finish_line($now + 0.7, 1, 1);
67 $track->finish_line($now + 4.9, 1, 1);
68 $track->finish_line($now + 5.3, 1, 2);
69 $track->finish_line($now + 7.2, 1, 1);
70 $track->finish_line($now + 8.1, 0, 2);
71 # $track->car(0)->set_lap(13);
72 # $track->car(1)->set_lap(11);
73 # $track->car(2)->set_lap(10);
74 # $track->car(3)->set_lap(undef);
75 # $track->car(4)->set_lap(undef);
76 # $track->car(5)->set_lap(undef);
78 $track->car(0)->set_laptime(9.12322);
79 $track->car(1)->set_laptime(15.313);
80 $track->car(2)->set_laptime(5.989);
82 $track->car(0)->set_fuel(6);
83 $track->car(1)->set_fuel(2);
84 $track->car(2)->set_fuel(8);
86 $track->car(0)->set_throttle(0);
87 $track->car(1)->set_throttle(8, 1);
88 $track->car(2)->set_throttle(12);
103 my ($event, $fh, $reader) = @_;