7 use Glib qw(TRUE FALSE);
13 my $gui = SCX::GUI->new({ img_height => 120 });
14 my $track = SCX::Track->new({ gui => $gui });
18 $reader = SCX::Reader->new({
19 portname => '/dev/ttyUSB0',
26 print STDERR "Demo mode only: $@";
29 $track->car(0)->set_model('F1 Ferrari');
30 $track->car(1)->set_model('F1 McLaren');
31 $track->car(2)->set_model('F1 Williams');
32 $track->car(3)->set_model('Citroen Xsara');
33 $track->car(4)->set_model('Citroen C4');
34 $track->car(5)->set_model('Ford Focus');
36 $track->car(0)->set_driver('Ivi');
37 $track->car(1)->set_driver('Filípek');
38 $track->car(2)->set_driver('Táta');
41 Glib::IO->add_watch(fileno($reader->fh), 'in', \&scx_read, $reader);
43 # Just display some random values
47 $gui->best_lap('12.3');
50 $track->{race_running_since} = $now;
51 $track->{race_running} = 1;
53 $track->finish_line($now + 0.5, 1, 2);
54 $track->finish_line($now + 0.7, 1, 1);
55 $track->finish_line($now + 4.9, 1, 1);
56 $track->finish_line($now + 5.3, 1, 2);
57 $track->finish_line($now + 7.2, 1, 1);
58 $track->finish_line($now + 8.1, 0, 2);
59 # $track->car(0)->set_lap(13);
60 # $track->car(1)->set_lap(11);
61 # $track->car(2)->set_lap(10);
62 # $track->car(3)->set_lap(undef);
63 # $track->car(4)->set_lap(undef);
64 # $track->car(5)->set_lap(undef);
66 $track->car(0)->set_laptime(9.12322);
67 $track->car(1)->set_laptime(15.313);
68 $track->car(2)->set_laptime(5.989);
70 $track->car(0)->set_fuel(6);
71 $track->car(1)->set_fuel(2);
72 $track->car(2)->set_fuel(8);
74 $track->car(0)->set_throttle(0);
75 $track->car(1)->set_throttle(8, 1);
76 $track->car(2)->set_throttle(12);
91 my ($event, $fh, $reader) = @_;