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

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.63 by root, Mon Apr 10 22:53:50 2006 UTC vs.
Revision 1.64 by root, Tue Apr 11 12:21:30 2006 UTC

40our $SDL_EV; 40our $SDL_EV;
41our %SDL_CB; 41our %SDL_CB;
42 42
43our $ALT_ENTER_MESSAGE; 43our $ALT_ENTER_MESSAGE;
44our $STATUS_LINE; 44our $STATUS_LINE;
45our $DEBUG_STATUS;
45 46
46my $last_refresh; 47my $last_refresh;
47my %ANIMATE; 48my %ANIMATE;
48my $refresh_handler; 49my $refresh_handler;
49 50
89 glShadeModel GL_FLAT; 90 glShadeModel GL_FLAT;
90 glDisable GL_DEPTH_TEST; 91 glDisable GL_DEPTH_TEST;
91 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 92 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
92 93
93 ############################################################################# 94 #############################################################################
95
96 $DEBUG_STATUS = new Crossfire::Client::Widget::Label 0, 0, 1, $FONTSIZE, "";
97 $Crossfire::Client::Widget::TOPLEVEL->add ($DEBUG_STATUS);
94 98
95 $STATUS_LINE = new Crossfire::Client::Widget::Label 99 $STATUS_LINE = new Crossfire::Client::Widget::Label
96 0, $HEIGHT * 59 / 60 - $FONTSIZE, 1, $FONTSIZE, 100 0, $HEIGHT * 59 / 60 - $FONTSIZE, 1, $FONTSIZE,
97 ""; 101 "";
98 $Crossfire::Client::Widget::TOPLEVEL->add ($STATUS_LINE); 102 $Crossfire::Client::Widget::TOPLEVEL->add ($STATUS_LINE);
184 $Crossfire::Client::Widget::TOPLEVEL->draw; 188 $Crossfire::Client::Widget::TOPLEVEL->draw;
185 189
186 SDL::GLSwapBuffers; 190 SDL::GLSwapBuffers;
187} 191}
188 192
193sub debug {
194 $DEBUG_STATUS->set_text ($_[0]);
195 $DEBUG_STATUS->size_allocate ($DEBUG_STATUS->size_request);
196 $DEBUG_STATUS->move ($WIDTH - $DEBUG_STATUS->{w}, 0);
197}
198
199my $FPS;
200
189sub refresh { 201sub refresh {
190 $refresh_handler ||= add Glib::Idle sub { 202 $refresh_handler ||= add Glib::Idle sub {
191 if ($SDL_APP) { 203 if ($SDL_APP) {
192 my $next_refresh = SDL::GetTicks; 204 my $next_refresh = SDL::GetTicks;
193 205
196 $next_refresh = SDL::GetTicks; 208 $next_refresh = SDL::GetTicks;
197 } 209 }
198 210
199 my $interval = ($next_refresh - $last_refresh) * 0.001; 211 my $interval = ($next_refresh - $last_refresh) * 0.001;
200 $last_refresh = $next_refresh; 212 $last_refresh = $next_refresh;
213
214 if ($interval) {
215 $FPS ||= 1 / $interval;
216 $FPS = $FPS * 0.96 + (1 / $interval) * 0.04;
217 debug sprintf "%5.02f\n", $FPS;
218 }
201 219
202 force_refresh; 220 force_refresh;
203 $_->animate ($interval) for grep $_, values %ANIMATE; 221 $_->animate ($interval) for grep $_, values %ANIMATE;
204 222
205 if (%ANIMATE) { 223 if (%ANIMATE) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines