--- deliantra/Deliantra-Client/DC/UI.pm 2006/04/08 22:23:57 1.26 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/04/09 00:09:50 1.29 @@ -150,7 +150,8 @@ sub _draw { my ($self) = @_; - my ($w, $h) = $self->size_request;#TODO# use widht/height of texture + my ($w, $h) = $self->size_request;#TODO# use width/height of texture + my $tex = $self->{texture} or return; @@ -329,9 +330,9 @@ use SDL::OpenGL; sub new { - my ($class, $x, $y, $z, $ttf, $text) = @_; + my ($class, $x, $y, $z, $height, $text) = @_; - my $self = $class->SUPER::new (x => $x, y => $y, z => $z, ttf => $ttf); + my $self = $class->SUPER::new (x => $x, y => $y, z => $z, height => $height); $self->set_text ($text); @@ -340,11 +341,15 @@ sub set_text { my ($self, $text) = @_; - $self->{texture} = new_from_ttf Crossfire::Client::Texture $self->{ttf}, $self->{text} = $text; + + $self->{text} = $text; + + $self->{texture} = new_from_text Crossfire::Client::Texture $text, $self->{height}; } sub get_text { my ($self, $text) = @_; + $self->{text} } @@ -364,10 +369,10 @@ glEnable GL_BLEND; glEnable GL_TEXTURE_2D; - glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;#DECAL; + glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; glBindTexture GL_TEXTURE_2D, $tex->{name}; - glColor 1, 0, 1; + glColor 1, 1, 1, 0.8; glBegin GL_QUADS; glTexCoord 0, 0; glVertex 0 , 0; @@ -432,13 +437,13 @@ my $sh = 1 + int $::HEIGHT / 32; if ($::CONN->{mapw} > $sw) { - $xofs = ($sw - $::CONN->{mapw}) * 0.5; + $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5; } else { $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs}; } if ($::CONN->{maph} > $sh) { - $yofs = ($sh - $::CONN->{maph}) * 0.5; + $yofs = $my + ($::CONN->{maph} - $sh) * 0.5; } else { $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs}; } @@ -447,8 +452,6 @@ glEnable GL_BLEND; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; - warn "<$mx,$my> <$xofs,$yofs>\n";#d# - for my $x (0 .. $sw - 1) { for my $y (0 .. $sh - 1) {