ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.36 by root, Thu May 25 00:26:19 2006 UTC vs.
Revision 1.40 by root, Sat May 27 20:46:54 2006 UTC

20 ); 20 );
21 21
22 $self->{completer} = new CFClient::MapWidget::Command:: 22 $self->{completer} = new CFClient::MapWidget::Command::
23 command => $self->{command}, 23 command => $self->{command},
24 can_focus => 1, 24 can_focus => 1,
25 tooltip => "<b>The Command Completer</b>\n\n"
26 . "This is your central interface to send text commands to the server. "
27 . "To enter a verbatim command to send to the server, just type the command, "
28 . "followed by a space, and press return. "
29 . "Typing the initial letters of words (or just any letters) displays guesses "
30 . "for commands you might want to use.\n"
31 . "You can use the cursor-up and cursor-down keys to select between those guesses.\n"
32 . "<b>Right-Click</b> opens a menu where you cna select further options, sich as redefining keybindings.",
25 ; 33 ;
26 34
27 $self 35 $self
28} 36}
29 37
124 $::CONN->user_send ("stay fire"); 132 $::CONN->user_send ("stay fire");
125 } elsif ($uni == ord ",") { 133 } elsif ($uni == ord ",") {
126 $::CONN->user_send ("take"); 134 $::CONN->user_send ("take");
127 } elsif ($uni == ord " ") { 135 } elsif ($uni == ord " ") {
128 $::CONN->user_send ("apply"); 136 $::CONN->user_send ("apply");
137 } elsif ($uni == ord ".") {
138 $::CONN->user_send ($self->{completer}{last_command})
139 if exists $self->{completer}{last_command};
129 } elsif ($uni == ord "\t") { 140 } elsif ($uni == ord "\t") {
130 # TODO: toggle inventory 141 # TODO: toggle inventory
131 } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { 142 } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") {
132 $::CONN->user_send ("rotateshoottype +"); 143 $::CONN->user_send ("rotateshoottype +");
133 } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { 144 } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") {
193 glTranslate $sx0 - 32, $sy0 - 32, 0; 204 glTranslate $sx0 - 32, $sy0 - 32, 0;
194 205
195 my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); 206 my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1);
196 207
197 if ($::CFG->{fow_enable}) { 208 if ($::CFG->{fow_enable}) {
198 if ($::CFG->{fow_smooth} && $CFClient::GL_VERSION >= 1.2) { # smooth fog of war 209 if ($::CFG->{fow_smooth} && $CFClient::OpenGL::GL_VERSION >= 1.2) { # smooth fog of war
199 glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); 210 glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER);
200 glConvolutionFilter2D ( 211 glConvolutionFilter2D (
201 GL_CONVOLUTION_2D, 212 GL_CONVOLUTION_2D,
202 GL_ALPHA, 213 GL_ALPHA,
203 3, 3, 214 3, 3,
256 glVertex $::WIDTH, $::HEIGHT; 267 glVertex $::WIDTH, $::HEIGHT;
257 glVertex $::WIDTH, 0; 268 glVertex $::WIDTH, 0;
258 glEnd; 269 glEnd;
259 glDisable GL_BLEND; 270 glDisable GL_BLEND;
260 271
261 $self->{out_of_focus} ||= do { 272# $self->{out_of_focus} ||= do {
262 my $label = new CFClient::UI::Label 273# my $label = new CFClient::UI::Label
263 x => 0, 274# x => 0,
264 y => 0, 275# y => 0,
265 z => 1, 276# z => 1,
266 ellipsise => 0, 277# ellipsise => 0,
267 text => "map out of focus (click map to play)"; 278# text => "map out of focus (click map to play)";
268 279#
269 $label->show; 280# $label->show;
270 $label->update; 281# $label->update;
271 282#
272 $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { 283# $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub {
273 $label->move ( 284# $label->move (
274 ($::WIDTH - $label->{w}) * 0.5, 285# ($::WIDTH - $label->{w}) * 0.5,
275 ($::HEIGHT - $label->{h}) * 0.5, 286# ($::HEIGHT - $label->{h}) * 0.5,
276 ); 287# );
277 }); 288# });
278 289#
279 $label 290# $label
280 }; 291# };
281 } 292 }
282} 293}
283 294
284sub DESTROY { 295sub DESTROY {
285 my $self = shift; 296 my $self = shift;
395 fontsize => $_, 406 fontsize => $_,
396 ), (0.8) x 16 407 ), (0.8) x 16
397 ]; 408 ];
398 409
399 $self->{entry} = new CFClient::UI::Entry 410 $self->{entry} = new CFClient::UI::Entry
400 connect_changed => sub { 411 on_changed => sub {
401 $self->update_labels; 412 $self->update_labels;
402 }, 413 },
403 connect_key_down => sub { 414 on_key_down => sub {
404 my ($entry, $ev) = @_; 415 my ($entry, $ev) = @_;
405 416
406 my $self = $entry->{parent}{parent}; 417 my $self = $entry->{parent}{parent};
407 418
408 if ($ev->{sym} == 13) { 419 if ($ev->{sym} == 13) {
409 if (exists $self->{select}) { 420 if (exists $self->{select}) {
421 $self->{last_command} = $self->{select};
410 $::CONN->user_send ($self->{select}); 422 $::CONN->user_send ($self->{select});
411 $self->hide; 423 $self->hide;
412 } 424 }
413 } elsif ($ev->{sym} == 27) { 425 } elsif ($ev->{sym} == 27) {
414 $self->hide; 426 $self->hide;
509 521
510 @match = map $self->{command}{$_->[0]}, 522 @match = map $self->{command}{$_->[0]},
511 sort { 523 sort {
512 $a->[1] <=> $b->[1] 524 $a->[1] <=> $b->[1]
513 or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] 525 or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4]
514 or (length $a->[0]) <=> (length $b->[0]) 526 or (length $b->[0]) <=> (length $a->[0])
515 } @match; 527 } @match;
516 } 528 }
517 529
518 $self->{last_search} = $cmd; 530 $self->{last_search} = $text;
519 $self->{last_match} = \@match; 531 $self->{last_match} = \@match;
520 532
521 $self->{select_offset} = 0; 533 $self->{select_offset} = 0;
522 } 534 }
523 535

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines