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.110 by root, Sat Apr 15 12:30:53 2006 UTC vs.
Revision 1.111 by root, Sat Apr 15 12:46:48 2006 UTC

87 87
88sub stop_game { 88sub stop_game {
89 undef $CONN; 89 undef $CONN;
90} 90}
91 91
92sub config_dialog { 92sub client_setup {
93 my $dialog = new CFClient::UI::FancyFrame 93 my $dialog = new CFClient::UI::FancyFrame
94 child => (my $vbox = new CFClient::UI::VBox); 94 child => (my $vbox = new CFClient::UI::VBox);
95 $vbox->add (new CFClient::UI::Label align => 0, text => "Client Setup"); 95 $vbox->add (new CFClient::UI::Label align => 0, text => "Client Setup");
96 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 96 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
97 97
147 147
148 $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 148 $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub {
149 destroy_screen (); 149 destroy_screen ();
150 init_screen (); 150 init_screen ();
151 }); 151 });
152
153 $dialog
154}
155
156sub server_setup {
157 my $dialog = new CFClient::UI::FancyFrame
158 child => (my $vbox = new CFClient::UI::VBox);
152 159
153 $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup"); 160 $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup");
154 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 161 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
155 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host"); 162 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host");
156 $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host}, connect_changed => sub { 163 $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host}, connect_changed => sub {
195 202
196 $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub { 203 $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub {
197 start_game; 204 start_game;
198 }); 205 });
199 206
200 $vbox->add (my $hbox = new CFClient::UI::HBox);
201
202 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Save", connect_activate => sub {
203 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
204 status "Configuration Saved";
205 });
206
207 $dialog 207 $dialog
208} 208}
209 209
210sub console_window { 210sub message_window {
211 my $window = new CFClient::UI::FancyFrame 211 my $window = new CFClient::UI::FancyFrame
212 border_bg => [1, 1, 1, 0.5], 212 border_bg => [1, 1, 1, 0.5],
213 bg => [0.3, 0.3, 0.3, 0.8], 213 bg => [0.3, 0.3, 0.3, 0.8],
214 user_w => $::WIDTH/4, 214 user_w => $::WIDTH/4,
215 user_h => $::HEIGHT, 215 user_h => $::HEIGHT,
292 $FONTSIZE = int $HEIGHT / 40; 292 $FONTSIZE = int $HEIGHT / 40;
293 293
294 ############################################################################# 294 #############################################################################
295 295
296 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100; 296 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100;
297 $CFClient::UI::TOPLEVEL->add ($DEBUG_STATUS); 297 $CFClient::UI::ROOT->add ($DEBUG_STATUS);
298 298
299 $STATUS_LINE = new CFClient::UI::Label 299 $STATUS_LINE = new CFClient::UI::Label
300 padding => 0, 300 padding => 0,
301 y => $HEIGHT * 44 / 45 - $FONTSIZE; 301 y => $HEIGHT * 44 / 45 - $FONTSIZE;
302 $CFClient::UI::TOPLEVEL->add ($STATUS_LINE); 302 $CFClient::UI::ROOT->add ($STATUS_LINE);
303 303
304 $ALT_ENTER_MESSAGE = new CFClient::UI::Label 304 $ALT_ENTER_MESSAGE = new CFClient::UI::Label
305 padding => 0, 305 padding => 0,
306 y => $HEIGHT * 44 / 45, 306 y => $HEIGHT * 44 / 45,
307 height => $HEIGHT / 45, 307 height => $HEIGHT / 45,
308 text => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; 308 text => "Use <b>Alt-Enter</b> to toggle fullscreen mode";
309 $CFClient::UI::TOPLEVEL->add ($ALT_ENTER_MESSAGE); 309 $CFClient::UI::ROOT->add ($ALT_ENTER_MESSAGE);
310 310
311 $CFClient::UI::TOPLEVEL->add ($MAPWIDGET = new CFClient::UI::MapWidget); 311 $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::UI::MapWidget);
312 $MAPWIDGET->focus_in; 312 $MAPWIDGET->focus_in;
313 $MAPWIDGET->connect (activate_console => sub { 313 $MAPWIDGET->connect (activate_console => sub {
314 my ($mapwidget, $preset) = @_; 314 my ($mapwidget, $preset) = @_;
315 315
316 if ($CONSOLE) { 316 if ($CONSOLE) {
320 $CONSOLE->{input}->set_text ($preset); 320 $CONSOLE->{input}->set_text ($preset);
321 } 321 }
322 } 322 }
323 }); 323 });
324 324
325 $CFClient::UI::TOPLEVEL->add ($BUTTONBAR = new CFClient::UI::HBox); 325 $CFClient::UI::ROOT->add ($BUTTONBAR = new CFClient::UI::HBox);
326 326
327 $BUTTONBAR->add (my $setup = new CFClient::UI::Flopper text => "Client Setup", other => config_dialog, state => 1); 327 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup);
328 $BUTTONBAR->add (my $setup = new CFClient::UI::Flopper text => "Server", other => config_dialog, state => 1); 328 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup);
329 $BUTTONBAR->add (my $setup = new CFClient::UI::Flopper text => "Console", other => console_window); 329 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window);
330 $BUTTONBAR->add (my $setup = new CFClient::UI::Button text => "Save Config", other => console_window); 330
331 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
332 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
333 status "Configuration Saved";
334 });
335
336 $BUTTONBAR->{children}[0]->emit ("activate");
331} 337}
332 338
333sub destroy_screen { 339sub destroy_screen {
334 $CFClient::UI::TOPLEVEL->{children} = []; 340 $CFClient::UI::ROOT->{children} = [];
335 undef $SDL_ACTIVE; 341 undef $SDL_ACTIVE;
336 undef $SDL_EV; 342 undef $SDL_EV;
337 SDL::Quit; 343 SDL::Quit;
338} 344}
339 345
350 debug sprintf "%3.2f", $fps; 356 debug sprintf "%3.2f", $fps;
351 357
352 $want_refresh = 0; 358 $want_refresh = 0;
353 $can_refresh = 0; 359 $can_refresh = 0;
354 360
355 $CFClient::UI::TOPLEVEL->draw; 361 $CFClient::UI::ROOT->draw;
356 362
357 SDL::GLSwapBuffers; 363 SDL::GLSwapBuffers;
358 364
359 $LAST_REFRESH = $NOW; 365 $LAST_REFRESH = $NOW;
360} 366}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines