--- deliantra/Deliantra-Client/DC/UI.pm 2006/05/19 16:43:57 1.216 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/05/19 23:18:42 1.217 @@ -799,7 +799,7 @@ ; $self = $class->SUPER::new ( - vp => (new CFClient::UI::ViewPort), + vp => (new CFClient::UI::ViewPort expand => 1), slider => $slider, @_, ); @@ -2052,7 +2052,7 @@ req_h => $::WIDTH / 80, vertical => 0, can_hover => 1, - inner_pad => .05, + inner_pad => 0.02, @_ ); @@ -2491,10 +2491,26 @@ sub new { my $class = shift; - $class->SUPER::new ( + my $self = $class->SUPER::new ( aspect => 1, @_, - ) + ); + + if ($self->{anim} && $self->{animspeed}) { + Scalar::Util::weaken (my $widget = $self); + + $self->{timer} = Event->timer ( + at => $self->{animspeed} * int $::NOW / $self->{animspeed}, + hard => 1, + interval => $self->{animspeed}, + cb => sub { + ++$widget->{frame}; + $widget->update; + }, + ); + } + + $self } sub size_request { @@ -2505,9 +2521,18 @@ my ($self) = @_; return unless $::CONN;#d# manage and cache textures differently - my $tex = $::CONN->{texture}[$::CONN->{faceid}[$self->{face}]]; - # TODO animation + my $face; + + if ($self->{frame}) { + my $anim = $::CONN->{anim}[$self->{anim}]; + + $face = $anim->[ $self->{frame} % @$anim ] + if $anim && @$anim; + } + + my $tex = $::CONN->{texture}[$::CONN->{faceid}[$face || $self->{face}]]; + if ($tex) { glEnable GL_TEXTURE_2D; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; @@ -2517,6 +2542,15 @@ } } +sub DESTROY { + my ($self) = @_; + + $self->{timer}->cancel + if $self->{timer}; + + $self->SUPER::DESTROY; +} + ############################################################################# package CFClient::UI::InventoryItem; @@ -2529,7 +2563,7 @@ my $desc = $item->{nrof} < 2 ? $item->{name} - : "$item->{nrof} $item->{name_pl}"; + : "$item->{nrof} × $item->{name_pl}"; $item->{flags} & Crossfire::Protocol::F_OPEN and $desc .= " (open)"; @@ -2559,9 +2593,9 @@ my $desc = _item_to_desc ($item); my $self = $class->SUPER::new ( - can_hover => 1, + can_hover => 1, can_events => 1, - tooltip => ((CFClient::UI::Label::escape $desc) + tooltip => ((CFClient::UI::Label::escape $desc) . "\nleftclick - pick up\nmiddle click - apply\nrightclick - menu"), connect_button_down => sub { my ($self, $ev, $x, $y) = @_;