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.81 by root, Wed Apr 12 02:05:46 2006 UTC vs.
Revision 1.82 by root, Wed Apr 12 12:16:59 2006 UTC

51 51
52my $last_refresh; 52my $last_refresh;
53my %ANIMATE; 53my %ANIMATE;
54my $refresh_handler; 54my $refresh_handler;
55 55
56sub status {
57 $STATUS_LINE->set_text ($_[0]);
58 my ($w, $h) = $STATUS_LINE->size_request;
59 $STATUS_LINE->size_allocate (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $h, $w, $h);
60}
61
62sub debug {
63 $DEBUG_STATUS->set_text ($_[0]);
64 my ($w, $h) = $DEBUG_STATUS->size_request;
65 $DEBUG_STATUS->size_allocate ($WIDTH - $w, 0, $w, $h);
66}
67
56sub config_dialog { 68sub config_dialog {
57 my $dialog = new CFClient::UI::FancyFrame x => 300, y => 100, 69 my $dialog = new CFClient::UI::FancyFrame x => 300, y => 100,
58 child => (my $vbox = new CFClient::UI::VBox); 70 child => (my $vbox = new CFClient::UI::VBox);
59 $vbox->add (new CFClient::UI::Label align => 0, text => "Setup"); 71 $vbox->add (new CFClient::UI::Label align => 0, text => "Client Setup");
60 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 72 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
61 73
62 $table->add (0, 0, new CFClient::UI::Label align => 1, text => "Video Mode"); 74 $table->add (0, 0, new CFClient::UI::Label align => 1, text => "Video Mode");
63 $table->add (1, 0, my $hbox = new CFClient::UI::HBox); 75 $table->add (1, 0, my $hbox = new CFClient::UI::HBox);
64 76
70 82
71 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; 83 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value;
72 $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); 84 $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]});
73 }); 85 });
74 $mode_slider->emit (changed => $mode_slider->{range}[0]); 86 $mode_slider->emit (changed => $mode_slider->{range}[0]);
87
88 $table->add (1, 1, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub {
89 warn "apply\n";
90 });
75 91
92 $vbox->add (new CFClient::UI::Label align => 0, text => "Server");
93 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
76 $table->add (0, 1, new CFClient::UI::Label align => 1, text => "Host"); 94 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host");
77 $table->add (1, 1, my $host = new CFClient::UI::Entry text => $CFG->{host}); 95 $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host});
78 96
79 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Port"); 97 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Port");
80 $table->add (1, 2, my $port = new CFClient::UI::Entry text => $CFG->{port}); 98 $table->add (1, 3, my $port = new CFClient::UI::Entry text => $CFG->{port});
81 99
82 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Username"); 100 $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Username");
83 $table->add (1, 3, my $user = new CFClient::UI::Entry text => $CFG->{user}); 101 $table->add (1, 4, my $user = new CFClient::UI::Entry text => $CFG->{user});
84 102
85 $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Password"); 103 $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Password");
86 $table->add (1, 4, my $pass = new CFClient::UI::Entry text => $CFG->{password}, hidden => 1); 104 $table->add (1, 5, my $pass = new CFClient::UI::Entry text => $CFG->{password}, hidden => 1);
87 105
88 $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Map Size"); 106 $table->add (0, 6, new CFClient::UI::Label align => 1, text => "Map Size");
89 $table->add (1, 5, new CFClient::UI::Slider 107 $table->add (1, 6, new CFClient::UI::Slider
90 req_w => 100, 108 req_w => 100,
91 range => [$CFG->{mapsize}, 10, 100 + 1, 1], 109 range => [$CFG->{mapsize}, 10, 100 + 1, 1],
92 connect_changed => sub { 110 connect_changed => sub {
93 my ($self, $value) = @_; 111 my ($self, $value) = @_;
94 112
95 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 113 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
96 }, 114 },
97 ); 115 );
98 116
99 $vbox->add (my $hbox = new CFClient::UI::HBox);
100 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Save", connect_activate => sub {
101 warn "save\n";
102 });
103 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub { 117 $table->add (1, 7, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub {
104 warn "login\n"; 118 warn "login\n";
105 }); 119 });
120
121 $vbox->add (my $hbox = new CFClient::UI::HBox);
122
106 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 123 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Save", connect_activate => sub {
107 warn "apply\n"; 124 CFClient::write_cfg "$CFrossfire::VARDIR/pclientrc";
125 status "Configuration Saved";
108 }); 126 });
109
110 $CFClient::UI::TOPLEVEL->add ($dialog); 127 $CFClient::UI::TOPLEVEL->add ($dialog);
111} 128}
112 129
113sub init_screen { 130sub init_screen {
114 $SDL_APP = new SDL::App 131 $SDL_APP = new SDL::App
214 glClear GL_COLOR_BUFFER_BIT; 231 glClear GL_COLOR_BUFFER_BIT;
215 232
216 $CFClient::UI::TOPLEVEL->draw; 233 $CFClient::UI::TOPLEVEL->draw;
217 234
218 SDL::GLSwapBuffers; 235 SDL::GLSwapBuffers;
219}
220
221sub debug {
222 $DEBUG_STATUS->set_text ($_[0]);
223 my ($w, $h) = $DEBUG_STATUS->size_request;
224 $DEBUG_STATUS->size_allocate ($WIDTH - $w, 0, $w, $h);
225} 236}
226 237
227my $FPS; 238my $FPS;
228 239
229sub refresh { 240sub refresh {
456CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; 467CFClient::read_cfg "$Crossfire::VARDIR/pclientrc";
457 468
458$CFG ||= { 469$CFG ||= {
459 width => 640, 470 width => 640,
460 height => 480, 471 height => 480,
472 fullscreen => 0,
473 sdl_mode => 0,
461 mapsize => 100, 474 mapsize => 100,
462 fullscreen => 0,
463 host => "crossfire.schmorp.de", 475 host => "crossfire.schmorp.de",
464 port => 13327, 476 port => 13327,
465}; 477};
466 478
467{ 479{
478 logout => sub { stop_game }; 490 logout => sub { stop_game };
479 491
480main Gtk2; 492main Gtk2;
481 493
482Crossfire::save_ref $FACECACHE, "$Crossfire::VARDIR/pclient.faces"; 494Crossfire::save_ref $FACECACHE, "$Crossfire::VARDIR/pclient.faces";
495

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines