7 use Glib qw(TRUE FALSE);
13 my $gui = SCX::GUI->new({ img_height => 80 });
14 my $track = SCX::Track->new({ gui => $gui });
18 $reader = SCX::Reader->new({
19 portname => '/dev/ttyUSB0',
25 $track->car(0)->set_model('F1 Ferrari');
26 $track->car(1)->set_model('F1 McLaren');
27 $track->car(2)->set_model('F1 Williams');
28 $track->car(3)->set_model('Citroen Xsara');
29 $track->car(4)->set_model('Citroen C4');
30 $track->car(5)->set_model('Ford Focus');
32 $track->car(0)->set_driver('Ivi');
33 $track->car(1)->set_driver('Filípek');
34 $track->car(2)->set_driver('Táta');
37 Glib::IO->add_watch(fileno($reader->fh), 'in', \&scx_read, $reader);
39 # Just display some random values
43 $gui->best_lap('12.3');
46 $track->{race_running_since} = $now;
47 $track->{race_running} = 1;
49 $track->car(0)->finish_line($now + 2.5, 1);
50 # $track->car(0)->set_lap(13);
51 # $track->car(1)->set_lap(11);
52 # $track->car(2)->set_lap(10);
53 # $track->car(3)->set_lap(undef);
54 # $track->car(4)->set_lap(undef);
55 # $track->car(5)->set_lap(undef);
57 # $track->car(0)->set_laptime(9.12322);
58 # $track->car(1)->set_laptime(15.313);
59 # $track->car(2)->set_laptime(5.989);
61 $track->car(0)->set_fuel(6);
62 $track->car(1)->set_fuel(2);
63 $track->car(2)->set_fuel(8);
65 $track->car(0)->set_throttle(0);
66 $track->car(1)->set_throttle(8);
67 $track->car(2)->set_throttle(12);
82 my ($event, $fh, $reader) = @_;