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.83 by root, Wed Apr 12 15:35:55 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 destroy_screen ();
90 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] };
91 $FULLSCREEN = $CFG->{fullscreen};
92 init_screen ();
93 });
75 94
95 $vbox->add (new CFClient::UI::Label align => 0, text => "Server");
96 $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"); 97 $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}); 98 $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host});
78 99
79 $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Port"); 100 $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}); 101 $table->add (1, 3, my $port = new CFClient::UI::Entry text => $CFG->{port});
81 102
82 $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Username"); 103 $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}); 104 $table->add (1, 4, my $user = new CFClient::UI::Entry text => $CFG->{user});
84 105
85 $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Password"); 106 $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); 107 $table->add (1, 5, my $pass = new CFClient::UI::Entry text => $CFG->{password}, hidden => 1);
87 108
88 $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Map Size"); 109 $table->add (0, 6, new CFClient::UI::Label align => 1, text => "Map Size");
89 $table->add (1, 5, new CFClient::UI::Slider 110 $table->add (1, 6, new CFClient::UI::Slider
90 req_w => 100, 111 req_w => 100,
91 range => [$CFG->{mapsize}, 10, 100 + 1, 1], 112 range => [$CFG->{mapsize}, 10, 100 + 1, 1],
92 connect_changed => sub { 113 connect_changed => sub {
93 my ($self, $value) = @_; 114 my ($self, $value) = @_;
94 115
95 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 116 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
96 }, 117 },
97 ); 118 );
98 119
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 { 120 $table->add (1, 7, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub {
104 warn "login\n"; 121 warn "login\n";
105 }); 122 });
123
124 $vbox->add (my $hbox = new CFClient::UI::HBox);
125
106 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 126 $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Save", connect_activate => sub {
107 warn "apply\n"; 127 CFClient::write_cfg "$CFrossfire::VARDIR/pclientrc";
128 status "Configuration Saved";
108 }); 129 });
109
110 $CFClient::UI::TOPLEVEL->add ($dialog); 130 $CFClient::UI::TOPLEVEL->add ($dialog);
111} 131}
112 132
113sub init_screen { 133sub init_screen {
114 $SDL_APP = new SDL::App 134 $SDL_APP = new SDL::App
214 glClear GL_COLOR_BUFFER_BIT; 234 glClear GL_COLOR_BUFFER_BIT;
215 235
216 $CFClient::UI::TOPLEVEL->draw; 236 $CFClient::UI::TOPLEVEL->draw;
217 237
218 SDL::GLSwapBuffers; 238 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} 239}
226 240
227my $FPS; 241my $FPS;
228 242
229sub refresh { 243sub refresh {
456CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; 470CFClient::read_cfg "$Crossfire::VARDIR/pclientrc";
457 471
458$CFG ||= { 472$CFG ||= {
459 width => 640, 473 width => 640,
460 height => 480, 474 height => 480,
475 fullscreen => 0,
476 sdl_mode => 0,
461 mapsize => 100, 477 mapsize => 100,
462 fullscreen => 0,
463 host => "crossfire.schmorp.de", 478 host => "crossfire.schmorp.de",
464 port => 13327, 479 port => 13327,
465}; 480};
466 481
467{ 482{
478 logout => sub { stop_game }; 493 logout => sub { stop_game };
479 494
480main Gtk2; 495main Gtk2;
481 496
482Crossfire::save_ref $FACECACHE, "$Crossfire::VARDIR/pclient.faces"; 497Crossfire::save_ref $FACECACHE, "$Crossfire::VARDIR/pclient.faces";
498

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines