[opendemo-cvs] CVS: opendemo/tools/odcut odcutgui.pm,1.40,1.41
Status: Beta
Brought to you by:
girlich
From: Uwe G. <gi...@us...> - 2004-10-24 18:49:08
|
Update of /cvsroot/opendemo/opendemo/tools/odcut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17323 Modified Files: odcutgui.pm Log Message: Beautify the timer behaviour. It is still totally wrong: with a game running (sub process started), no timer event will be generated any more. Index: odcutgui.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odcutgui.pm,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** odcutgui.pm 22 Oct 2004 21:26:53 -0000 1.40 --- odcutgui.pm 24 Oct 2004 18:49:00 -0000 1.41 *************** *** 561,574 **** if (defined $self->{"odgame"}) { my $odgame = $self->{"odgame"}; my $stream = $odgame->GetInputStream(); # TODO ! # We must read as long as there are data available and not ! # only a single line. my $value = <$stream>; ! print "STDOUT>>>$value<<<STDOUT" if defined $value; $stream = $odgame->GetErrorStream(); $value = <$stream>; ! print "STDERR>>>$value<<<STDERR" if defined $value; } } --- 561,596 ---- if (defined $self->{"odgame"}) { my $odgame = $self->{"odgame"}; + # A single line is not enough. + my $oldsep = $/; + $/ = ""; my $stream = $odgame->GetInputStream(); # TODO ! # We have to check, if there is data to read at all. my $value = <$stream>; ! if (defined $value && length($value)>0) { ! print "STDOUT>>>$value<<<STDOUT"; ! } $stream = $odgame->GetErrorStream(); $value = <$stream>; ! if (defined $value && length($value)>0) { ! print "STDERR>>>$value<<<STDERR"; ! } ! $/ = $oldsep; ! } ! ! # Make sure the timer is running in interactive mode. ! if ($self->{"output"}->interactive()==1) { ! if ($self->{TIMER}->IsRunning==0) { ! print STDERR "Timer is not running. Start it.\n"; ! $self->StartTimer(); ! } ! } ! else { ! # Make sure the timer is not running in non-interactive mode. ! if ($self->{TIMER}->IsRunning==1) { ! print STDERR "Timer is running in non-interactive mode. Stop it.\n"; ! $self->{TIMER}->Stop(); ! } } } *************** *** 623,626 **** --- 645,657 ---- # Timer + $self->StartGameTimer(); + } + + + sub StartGameTimer($) + { + my ($self) = @_; + + # Make sure the timer exists. if (!exists $self->{"gametimer"}) { $self->{"gametimer"} = Wx::Timer->new($self, 1); *************** *** 638,643 **** $self->OnIdle(); ! # restart timer ! $self->{"gametimer"}->Start(1000, 1); } --- 669,674 ---- $self->OnIdle(); ! # Restart game timerr. ! $self->StartGameTimer(); } *************** *** 653,657 **** my $stream = $self->{"odgame"}->GetOutputStream(); ! # this requires, that the directory is in od. my $demofile = basename($output->get_outputfile()); my $map = $output->get_currentfile()->mapname(); --- 684,688 ---- my $stream = $self->{"odgame"}->GetOutputStream(); ! # this requires, that the demo file pipe is in od. my $demofile = basename($output->get_outputfile()); my $map = $output->get_currentfile()->mapname(); *************** *** 882,886 **** $waitsec = 0.01; } ! $self->{TIMER}->Start($output->frame_interactive_timeout() * 1000, 1); } --- 913,924 ---- $waitsec = 0.01; } ! printf STDERR "Start timer in %fsec ... ", $waitsec; ! $self->{TIMER}->Start($waitsec * 1000.0, 1); ! if ($self->{TIMER}->IsRunning == 0) { ! printf STDERR "but not running any more.\n"; ! } ! else { ! printf STDERR "OK.\n"; ! } } *************** *** 889,897 **** { my ($self, $event) = @_; my $output = $self->{"output"}; $self->UpdateMoving(); $output->frame_interactive_write(); $self->StartTimer(); - print "timer\n"; } --- 927,935 ---- { my ($self, $event) = @_; + print STDERR "Handling a timer event.\n"; my $output = $self->{"output"}; $self->UpdateMoving(); $output->frame_interactive_write(); $self->StartTimer(); } |