--- deliantra/Deliantra-Client/DC/UI.pm 2006/04/24 03:43:51 1.161 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/04/24 06:05:35 1.162 @@ -25,7 +25,7 @@ $tip = $tip->($widget) if CODE:: eq ref $tip; - $TOOLTIP->set_text ($widget->{tooltip}); + $TOOLTIP->set_markup ($widget->{tooltip}); $TOOLTIP->move ($widget->coord2global ($widget->{w}, 0)); $TOOLTIP->show; } @@ -322,6 +322,20 @@ glEnd; glDisable GL_BLEND; } + + if ($ENV{PCLIENT_DEBUG}) { + glPushMatrix; + glColor 1, 1, 0, 1; + glTranslate $self->{x} + 0.375, $self->{y} + 0.375; + glBegin GL_LINE_LOOP; + glVertex 0 , 0; + glVertex $self->{w}, 0; + glVertex $self->{w}, $self->{h}; + glVertex 0 , $self->{h}; + glEnd; + glPopMatrix; + CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; + } } sub _draw { @@ -501,6 +515,15 @@ $self->update; } +sub clear { + my ($self) = @_; + + delete $_->{parent} + for @{ delete $self->{children} }; + + $self->{children} = []; +} + sub find_widget { my ($self, $x, $y) = @_; @@ -1133,7 +1156,7 @@ $self } -sub escape_text { +sub escape { local $_ = $_[1]; s/&/&/g; @@ -2185,11 +2208,11 @@ ) } -sub set_text { +sub set_markup { my ($self, $text) = @_; $self->{label} ||= new CFClient::UI::Label fontsize => 0.8, fg => [0, 0, 0]; - $self->{label}->set_text ($text); + $self->{label}->set_markup ($text); $self->add ($self->{label}); } @@ -2203,6 +2226,12 @@ ($w + 4, $h + 4) } +sub size_allocate { + my ($self, $w, $h) = @_; + + $self->SUPER::size_allocate ($w - 4, $h - 4); +} + sub _draw { my ($self) = @_; @@ -2234,6 +2263,44 @@ } ############################################################################# + +package CFClient::UI::Face; + +our @ISA = CFClient::UI::Base::; + +use CFClient::OpenGL; + +sub new { + my $class = shift; + + $class->SUPER::new ( + aspect => 1, + @_, + ) +} + +sub size_request { + (32, 8) +} + +sub draw { + my ($self) = @_; + + my $tex = $::CONN->{texture}[$::CONN->{faceid}[$self->{face}]]; + + if ($tex) { + 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_REPLACE; + glColor 1, 1, 1, 1; + $tex->draw_quad (0, 0, $self->{w}, $self->{h}); + glDisable GL_TEXTURE_2D; + glDisable GL_BLEND; + } +} + +############################################################################# package CFClient::UI::Root;