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.88 by root, Wed Apr 12 21:01:47 2006 UTC vs.
Revision 1.89 by root, Wed Apr 12 21:20:42 2006 UTC

107 $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { 107 $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub {
108 my ($self, $value) = @_; 108 my ($self, $value) = @_;
109 $CFG->{fullscreen} = $value; 109 $CFG->{fullscreen} = $value;
110 }); 110 });
111 111
112 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Fast & Ugly");
113 $table->add (1, 2, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub {
114 my ($self, $value) = @_;
115 $CFG->{fast} = $value;
116 });
117
112 $table->add (1, 2, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 118 $table->add (1, 3, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub {
113 destroy_screen (); 119 destroy_screen ();
114 init_screen (); 120 init_screen ();
115 }); 121 });
116 122
117 $vbox->add (new CFClient::UI::Label align => 0, text => "Server"); 123 $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup");
118 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 124 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
119 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host"); 125 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host");
120 $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host}); 126 $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host});
121 127
122 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Port"); 128 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Port");
150 status "Configuration Saved"; 156 status "Configuration Saved";
151 }); 157 });
152 $CFClient::UI::TOPLEVEL->add ($dialog); 158 $CFClient::UI::TOPLEVEL->add ($dialog);
153} 159}
154 160
161sub sdl_init {
162 SDL::Init SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO
163 and die "SDL::Init failed!\n";
164}
165
155sub init_screen { 166sub init_screen {
167 sdl_init;
168
156 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; 169 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] };
157 $FULLSCREEN = $CFG->{fullscreen}; 170 $FULLSCREEN = $CFG->{fullscreen};
171 $FAST = $CFG->{fast};
158 172
159 SDL::GLSetAttribute SDL_GL_RED_SIZE, 5; 173 SDL::GLSetAttribute SDL_GL_RED_SIZE, 5;
160 SDL::GLSetAttribute SDL_GL_GREEN_SIZE, 5; 174 SDL::GLSetAttribute SDL_GL_GREEN_SIZE, 5;
161 SDL::GLSetAttribute SDL_GL_BLUE_SIZE, 5; 175 SDL::GLSetAttribute SDL_GL_BLUE_SIZE, 5;
162 SDL::GLSetAttribute SDL_GL_ALPHA_SIZE, 0; 176 SDL::GLSetAttribute SDL_GL_ALPHA_SIZE, 0;
283 delete $animate_object{$widget}; 297 delete $animate_object{$widget};
284} 298}
285 299
286@conn::ISA = Crossfire::Protocol::; 300@conn::ISA = Crossfire::Protocol::;
287 301
288sub conn::send { 302sub conn::user_send {
289 my ($self, $command) = @_; 303 my ($self, $command) = @_;
290 304
291 $self->Crossfire::Protocol::send ($command); 305 $self->send ($command);
292 status $command; 306 status $command;
293} 307}
294 308
295sub conn::map_update { 309sub conn::map_update {
296 my ($self, $dirty) = @_; 310 my ($self, $dirty) = @_;
371CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; 385CFClient::read_cfg "$Crossfire::VARDIR/pclientrc";
372 386
373$CFG ||= { 387$CFG ||= {
374 width => 640, 388 width => 640,
375 height => 480, 389 height => 480,
390 fast => 0,
376 fullscreen => 0, 391 fullscreen => 0,
377 sdl_mode => 0, 392 sdl_mode => 0,
378 mapsize => 100, 393 mapsize => 100,
379 host => "crossfire.schmorp.de", 394 host => "crossfire.schmorp.de",
380 port => 13327, 395 port => 13327,
381}; 396};
382 397
383SDL::Init SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO 398sdl_init;
384 and die "SDL::Init failed!\n";
385 399
386@SDL_MODES = reverse map [SDL::RectW ($_), SDL::RectH ($_)], 400@SDL_MODES = reverse map [SDL::RectW ($_), SDL::RectH ($_)],
387 @{ SDL::ListModes 0, SDL_FULLSCREEN | SDL_HWSURFACE | SDL_OPENGL }; 401 @{ SDL::ListModes 0, SDL_FULLSCREEN | SDL_HWSURFACE | SDL_OPENGL };
388 402
403@SDL_MODES or CFClient::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)";
404
405$CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES;
406
389init_screen; 407init_screen;
390 408
391{ 409{
392 my @fonts = map CFClient::find_rcfile $_, qw(uifont.ttf uifontb.ttf uifonti.ttf uifontbi.ttf); 410 my @fonts = map CFClient::find_rcfile $_, qw(uifont.ttf uifontb.ttf uifonti.ttf uifontbi.ttf);
393 411

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines