--- deliantra/Deliantra-Client/DC/UI.pm 2009/01/11 23:50:27 1.477 +++ deliantra/Deliantra-Client/DC/UI.pm 2011/08/13 23:18:19 1.482 @@ -1,10 +1,10 @@ package DC::UI; -use utf8; -use strict; +use common::sense; use List::Util (); +use AnyEvent (); use Guard (); use DC; @@ -225,7 +225,7 @@ package DC::UI::Base; -use strict; +use common::sense; use DC::OpenGL; @@ -645,7 +645,8 @@ our @ISA = DC::UI::Base::; -use strict; +use common::sense; + use DC::OpenGL; sub new { @@ -668,8 +669,8 @@ sub _draw { my ($self) = @_; - my $color = $FOCUS == $self && $self->{active_bg} - ? $self->{active_bg} + my $color = $FOCUS == $self + ? $self->{active_bg} || $self->{bg} : $self->{bg}; if ($color && (@$color < 4 || $color->[3])) { @@ -2596,7 +2597,7 @@ package DC::UI::Image; -our @ISA = DC::UI::Base::; +our @ISA = DC::UI::DrawBG::; use DC::OpenGL; @@ -2639,6 +2640,13 @@ $self->new (path => $path) } +sub set_texture { + my ($self, $tex) = @_; + + $self->{tex} = $tex; + $self->update; +} + sub size_request { my ($self) = @_; @@ -2648,6 +2656,8 @@ sub _draw { my ($self) = @_; + $self->SUPER::_draw; + my $tex = $self->{tex}; my ($w, $h) = ($self->{w}, $self->{h}); @@ -2675,8 +2685,6 @@ use DC::OpenGL; -my %textures; - sub new { my $class = shift; @@ -3049,7 +3057,7 @@ package DC::UI::Slider; -use strict; +use common::sense; use DC::OpenGL; @@ -3145,7 +3153,7 @@ my (undef, $lo, $hi, $page) = @{$self->{range}}; - $x = ($x - $self->{click}[1]) / ($w * $self->{scale}); + $x = ($x - $self->{click}[1]) / ($w * $self->{scale} || 1e999); $self->set_value ($self->{click}[0] + $x * ($hi - $page - $lo)); } else { @@ -4287,7 +4295,7 @@ sub reorder { my ($self) = @_; - my $NOW = EV::time; + my $NOW = AE::time; # freeze display when hovering over any label return if $DC::UI::TOOLTIP->{owner}