ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.207 by root, Thu Aug 9 11:02:08 2007 UTC vs.
Revision 1.208 by root, Fri Aug 10 04:02:14 2007 UTC

113our $CONN; 113our $CONN;
114our $PROFILE; # current profile 114our $PROFILE; # current profile
115our $FAST; # fast, low-quality mode, possibly useful for software-rendering 115our $FAST; # fast, low-quality mode, possibly useful for software-rendering
116 116
117our $WANT_REFRESH; 117our $WANT_REFRESH;
118our $CAN_REFRESH;
119 118
120our @SDL_MODES; 119our @SDL_MODES;
121our $WIDTH; 120our $WIDTH;
122our $HEIGHT; 121our $HEIGHT;
123our $FULLSCREEN; 122our $FULLSCREEN;
2092my $animate_timer; 2091my $animate_timer;
2093 2092
2094my $fps = 9; 2093my $fps = 9;
2095 2094
2096sub force_refresh { 2095sub force_refresh {
2096 if ($ENV{CFPLUS_DEBUG} & 4) {
2097 $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; 2097 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02;
2098 debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; 2098 debug sprintf "%3.2f", $fps;
2099 }
2099 2100
2100 $CFPlus::UI::ROOT->draw; 2101 $CFPlus::UI::ROOT->draw;
2101 2102 CFPlus::SDL_GL_SwapBuffers;
2102 $WANT_REFRESH = 0;
2103 $CAN_REFRESH = 0;
2104 $LAST_REFRESH = $NOW; 2103 $LAST_REFRESH = $NOW;
2105 2104 $WANT_REFRESH->stop;
2106 CFPlus::SDL_GL_SwapBuffers;
2107} 2105}
2108 2106
2107$WANT_REFRESH = Event->idle (min => 0.001, max => 0.06, parked => 1, cb => \&force_refresh);
2108
2109my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub { 2109my $input = Event->timer (after => 0, hard => 0, interval => 1 / 50, cb => sub {
2110 $NOW = time; 2110 $NOW = time;
2111 2111
2112 ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) 2112 ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_)
2113 for CFPlus::poll_events; 2113 for CFPlus::poll_events;
2114 2114
2115 if (%animate_object) { 2115 if (%animate_object) {
2116 $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; 2116 $_->animate ($LAST_REFRESH - $NOW) for values %animate_object;
2117 ++$WANT_REFRESH; 2117 $WANT_REFRESH->start;
2118 }
2119
2120 if ($WANT_REFRESH) {
2121 force_refresh;
2122 } else {
2123 $CAN_REFRESH = 1;
2124 } 2118 }
2125}); 2119});
2126 2120
2127sub animation_start { 2121sub animation_start {
2128 my ($widget) = @_; 2122 my ($widget) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines