ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.139 by root, Wed Apr 19 23:55:58 2006 UTC vs.
Revision 1.140 by root, Thu Apr 20 04:20:52 2006 UTC

148sub configure { 148sub configure {
149 my ($self, $x, $y, $w, $h) = @_; 149 my ($self, $x, $y, $w, $h) = @_;
150 150
151 $self->{x} = $x; 151 $self->{x} = $x;
152 $self->{y} = $y; 152 $self->{y} = $y;
153
154 if ($self->{aspect}) {
155 $w = List::Util::min $w, int $h * $self->{aspect};
156 $h = List::Util::min $h, int $w / $self->{aspect};
157 }
153 158
154 return unless $self->{w} != $w || $self->{h} != $h; 159 return unless $self->{w} != $w || $self->{h} != $h;
155 160
156 $self->{w} = $w; 161 $self->{w} = $w;
157 $self->{h} = $h; 162 $self->{h} = $h;
1449 1454
1450# eg. VGauge->new (gauge => 'food'), default gauge: food 1455# eg. VGauge->new (gauge => 'food'), default gauge: food
1451sub new { 1456sub new {
1452 my $class = shift; 1457 my $class = shift;
1453 1458
1454 my $self = $class->SUPER::new (gauge => 'food', @_); 1459 my $self = $class->SUPER::new (
1460 gauge => 'food',
1461 @_
1462 );
1463
1464 $self->{aspect} = $tex{$self->{gauge}}[0]{w} / $tex{$self->{gauge}}[0]{h};
1455 1465
1456 $self 1466 $self
1457} 1467}
1458 1468
1459sub size_request { 1469sub size_request {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines