--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/25 00:26:19 1.36 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/27 20:46:54 1.40 @@ -22,6 +22,14 @@ $self->{completer} = new CFClient::MapWidget::Command:: command => $self->{command}, can_focus => 1, + tooltip => "The Command Completer\n\n" + . "This is your central interface to send text commands to the server. " + . "To enter a verbatim command to send to the server, just type the command, " + . "followed by a space, and press return. " + . "Typing the initial letters of words (or just any letters) displays guesses " + . "for commands you might want to use.\n" + . "You can use the cursor-up and cursor-down keys to select between those guesses.\n" + . "Right-Click opens a menu where you cna select further options, sich as redefining keybindings.", ; $self @@ -126,6 +134,9 @@ $::CONN->user_send ("take"); } elsif ($uni == ord " ") { $::CONN->user_send ("apply"); + } elsif ($uni == ord ".") { + $::CONN->user_send ($self->{completer}{last_command}) + if exists $self->{completer}{last_command}; } elsif ($uni == ord "\t") { # TODO: toggle inventory } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { @@ -195,7 +206,7 @@ my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); if ($::CFG->{fow_enable}) { - if ($::CFG->{fow_smooth} && $CFClient::GL_VERSION >= 1.2) { # smooth fog of war + if ($::CFG->{fow_smooth} && $CFClient::OpenGL::GL_VERSION >= 1.2) { # smooth fog of war glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); glConvolutionFilter2D ( GL_CONVOLUTION_2D, @@ -258,26 +269,26 @@ glEnd; glDisable GL_BLEND; - $self->{out_of_focus} ||= do { - my $label = new CFClient::UI::Label - x => 0, - y => 0, - z => 1, - ellipsise => 0, - text => "map out of focus (click map to play)"; - - $label->show; - $label->update; - - $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { - $label->move ( - ($::WIDTH - $label->{w}) * 0.5, - ($::HEIGHT - $label->{h}) * 0.5, - ); - }); - - $label - }; +# $self->{out_of_focus} ||= do { +# my $label = new CFClient::UI::Label +# x => 0, +# y => 0, +# z => 1, +# ellipsise => 0, +# text => "map out of focus (click map to play)"; +# +# $label->show; +# $label->update; +# +# $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { +# $label->move ( +# ($::WIDTH - $label->{w}) * 0.5, +# ($::HEIGHT - $label->{h}) * 0.5, +# ); +# }); +# +# $label +# }; } } @@ -397,16 +408,17 @@ ]; $self->{entry} = new CFClient::UI::Entry - connect_changed => sub { + on_changed => sub { $self->update_labels; }, - connect_key_down => sub { + on_key_down => sub { my ($entry, $ev) = @_; my $self = $entry->{parent}{parent}; if ($ev->{sym} == 13) { if (exists $self->{select}) { + $self->{last_command} = $self->{select}; $::CONN->user_send ($self->{select}); $self->hide; } @@ -511,11 +523,11 @@ sort { $a->[1] <=> $b->[1] or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] - or (length $a->[0]) <=> (length $b->[0]) + or (length $b->[0]) <=> (length $a->[0]) } @match; } - $self->{last_search} = $cmd; + $self->{last_search} = $text; $self->{last_match} = \@match; $self->{select_offset} = 0;