--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/19 18:39:08 1.30 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/23 21:14:41 1.34 @@ -117,26 +117,26 @@ glEnable GL_CONVOLUTION_2D; } - undef $self->{fow_texture};#d# remove + # try to re-use the texture name: TODO improve texture class instead + my $prev_name = ((delete $self->{fow_texture}) || {})->{name}; + $self->{fow_texture} = new CFClient::Texture w => $w, h => $h, data => $data, + name => $prev_name, # a bit hackish internalformat => GL_ALPHA, format => GL_ALPHA; glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; - glEnable GL_BLEND; - glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; glEnable GL_TEXTURE_2D; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; glColor +($::CFG->{fow_intensity}) x 3, 0.8; - $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32); + $self->{fow_texture}->draw_quad_alpha (0, 0, $w * 32, $h * 32); glDisable GL_TEXTURE_2D; - glDisable GL_BLEND; } glPopMatrix; @@ -150,8 +150,11 @@ glPopMatrix; # TNT2 emulates logops in software (or worse :) - if ($CFClient::UI::FOCUS != $self) { - glColor 0.4, 0.2, 0.2, 0.9; + if ($CFClient::UI::FOCUS == $self) { + (delete $self->{out_of_focus})->destroy + if $self->{out_of_focus}; + } else { + glColor 0.4, 0.2, 0.2, 0.6; glEnable GL_BLEND; glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; glBegin GL_QUADS; @@ -161,6 +164,27 @@ glVertex $::WIDTH, 0; 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 + }; } } @@ -458,6 +482,7 @@ sort { $a->[1] <=> $b->[1] or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] + or (length $a->[0]) <=> (length $b->[0]) } @match; $self->{last_search} = $cmd;