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.69 by root, Tue Apr 11 14:04:27 2006 UTC vs.
Revision 1.71 by root, Tue Apr 11 17:02:36 2006 UTC

30our $CONN; 30our $CONN;
31 31
32our $WIDTH; 32our $WIDTH;
33our $HEIGHT; 33our $HEIGHT;
34our $FULLSCREEN; 34our $FULLSCREEN;
35
36our $NOW;
35 37
36our $MAPWIDGET; 38our $MAPWIDGET;
37our $FONTSIZE; 39our $FONTSIZE;
38 40
39our $SDL_TIMER; 41our $SDL_TIMER;
111 $CFClient::Widget::TOPLEVEL->add ($MAPWIDGET); 113 $CFClient::Widget::TOPLEVEL->add ($MAPWIDGET);
112 $MAPWIDGET->focus_in; 114 $MAPWIDGET->focus_in;
113 115
114 # Test code #d# 116 # Test code #d#
115 unless ($tw) { # haha... 117 unless ($tw) { # haha...
116 $te = new CFClient::Widget::FancyFrame x => 300, z => 1; 118 my $w = new CFClient::Widget::Window
117 $te->add (new CFClient::Widget::Entry); 119 w => 300, h => 300,
120 child => (my $frame = new CFClient::Widget::FancyFrame);
118 $CFClient::Widget::TOPLEVEL->add ($te); 121 $CFClient::Widget::TOPLEVEL->add ($w);
122
123 $frame->add (my $vbox = new CFClient::Widget::VBox);
124
125 $vbox->add (new CFClient::Widget::Entry text => "hallo");
126 $vbox->add (new CFClient::Widget::Slider);
119 127
120 $tw = new CFClient::Widget::Animator x => $WIDTH - 200, w => 600, h => 300; 128 $tw = new CFClient::Widget::Animator x => $WIDTH - 200, w => 600, h => 300;
121 my $lbl1 = new CFClient::Widget::Label text => "<i>This</i> is a\n<u>TEST</u>!\nOf a themed\nFrame!"; 129 my $lbl1 = new CFClient::Widget::Label text => "<i>This</i> is a\n<u>TEST</u>!\nOf a themed\nFrame!";
122 my $lbl2 = new CFClient::Widget::Label text => "LBL2"; 130 my $lbl2 = new CFClient::Widget::Label text => "LBL2";
123 my $vb = new CFClient::Widget::VBox; 131 my $vb = new CFClient::Widget::VBox;
197my $FPS; 205my $FPS;
198 206
199sub refresh { 207sub refresh {
200 $refresh_handler ||= add Glib::Idle sub { 208 $refresh_handler ||= add Glib::Idle sub {
201 if ($SDL_APP) { 209 if ($SDL_APP) {
202 my $next_refresh = SDL::GetTicks; 210 $NOW = SDL::GetTicks;
203 211
204 if ($next_refresh - $last_refresh < $TICKS_PER_FRAME) { 212 if ($NOW - $last_refresh < $TICKS_PER_FRAME) {
205 SDL::Delay $TICKS_PER_FRAME - ($next_refresh - $last_refresh); 213 SDL::Delay $TICKS_PER_FRAME - ($NOW - $last_refresh);
206 $next_refresh = SDL::GetTicks; 214 $NOW = SDL::GetTicks;
207 } 215 }
208 216
209 my $interval = ($next_refresh - $last_refresh) * 0.001; 217 my $interval = ($NOW - $last_refresh) * 0.001;
210 $last_refresh = $next_refresh; 218 $last_refresh = $NOW;
211 219
212 if ($interval) { 220 if ($interval) {
213 $FPS ||= 1 / $interval; 221 $FPS ||= 1 / $interval;
214 $FPS = $FPS * 0.96 + (1 / $interval) * 0.04; 222 $FPS = $FPS * 0.96 + (1 / $interval) * 0.04;
215 debug sprintf "%5.02f", $FPS; 223 debug sprintf "%5.02f", $FPS;
273 }, 281 },
274 SDL_MOUSEBUTTONUP() => sub { 282 SDL_MOUSEBUTTONUP() => sub {
275 CFClient::Widget::feed_sdl_button_up_event ($SDL_EV); 283 CFClient::Widget::feed_sdl_button_up_event ($SDL_EV);
276 }, 284 },
277 SDL_ACTIVEEVENT() => sub { 285 SDL_ACTIVEEVENT() => sub {
278 printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# 286# printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d#
279 }, 287 },
280); 288);
281 289
282@conn::ISA = Crossfire::Protocol::; 290@conn::ISA = Crossfire::Protocol::;
283 291

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines