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.142 by elmex, Thu Apr 20 16:29:40 2006 UTC vs.
Revision 1.144 by root, Fri Apr 21 07:09:11 2006 UTC

625our @ISA = CFClient::UI::Bin::; 625our @ISA = CFClient::UI::Bin::;
626 626
627use CFClient::OpenGL; 627use CFClient::OpenGL;
628 628
629my @tex = 629my @tex =
630 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 630 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
631 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); 631 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png);
632 632
633sub new { 633sub new {
634 my $class = shift; 634 my $class = shift;
635 635
1344our @ISA = CFClient::UI::Label::; 1344our @ISA = CFClient::UI::Label::;
1345 1345
1346use CFClient::OpenGL; 1346use CFClient::OpenGL;
1347 1347
1348my @tex = 1348my @tex =
1349 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1349 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
1350 qw(b1_button_active.png); 1350 qw(b1_button_active.png);
1351 1351
1352sub new { 1352sub new {
1353 my $class = shift; 1353 my $class = shift;
1354 1354
1401package CFClient::UI::CheckBox; 1401package CFClient::UI::CheckBox;
1402 1402
1403our @ISA = CFClient::UI::DrawBG::; 1403our @ISA = CFClient::UI::DrawBG::;
1404 1404
1405my @tex = 1405my @tex =
1406 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1406 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
1407 qw(c1_checkbox_bg.png c1_checkbox_active.png); 1407 qw(c1_checkbox_bg.png c1_checkbox_active.png);
1408 1408
1409use CFClient::OpenGL; 1409use CFClient::OpenGL;
1410 1410
1411sub new { 1411sub new {
1468 1468
1469use CFClient::OpenGL; 1469use CFClient::OpenGL;
1470 1470
1471my %tex = ( 1471my %tex = (
1472 food => [ 1472 food => [
1473 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1473 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
1474 qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ 1474 qw/g1_food_gauge_empty.png g1_food_gauge_full.png/
1475 ], 1475 ],
1476 grace => [ 1476 grace => [
1477 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1477 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
1478 qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/ 1478 qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/
1479 ], 1479 ],
1480 hp => [ 1480 hp => [
1481 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1481 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
1482 qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/ 1482 qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/
1483 ], 1483 ],
1484 mana => [ 1484 mana => [
1485 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1485 map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 }
1486 qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/ 1486 qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/
1487 ], 1487 ],
1488); 1488);
1489 1489
1490# eg. VGauge->new (gauge => 'food'), default gauge: food 1490# eg. VGauge->new (gauge => 'food'), default gauge: food
1491sub new { 1491sub new {
1492 my $class = shift; 1492 my $class = shift;
1493 1493
1494 my $self = $class->SUPER::new ( 1494 my $self = $class->SUPER::new (
1495 type => 'food', 1495 type => 'food',
1496 scale => 1,
1497 @_ 1496 @_
1498 ); 1497 );
1499 1498
1500 $self->{aspect} = $tex{$self->{type}}[0]{w} / $tex{$self->{type}}[0]{h}; 1499 $self->{aspect} = $tex{$self->{type}}[0]{w} / $tex{$self->{type}}[0]{h};
1501 1500
1503} 1502}
1504 1503
1505sub size_request { 1504sub size_request {
1506 my ($self) = @_; 1505 my ($self) = @_;
1507 1506
1508 my $tex = $tex{$self->{type}}[0]; 1507 #my $tex = $tex{$self->{type}}[0];
1509 1508 #@$tex{qw(w h)}
1510 my ($w, $h) = map { $_ * $self->{scale} } @$tex{qw(w h)}; 1509 (0, 0)
1511 ($self->{vertical}) ? ($h, $w) : ($w, $h)
1512} 1510}
1513 1511
1514sub set_max { 1512sub set_max {
1515 my ($self, $max) = @_; 1513 my ($self, $max) = @_;
1516 1514
1589 my $self = $class->SUPER::new ( 1587 my $self = $class->SUPER::new (
1590 @_, 1588 @_,
1591 ); 1589 );
1592 1590
1593 $self->add ($self->{value} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); 1591 $self->add ($self->{value} = new CFClient::UI::Label valign => 1, align => 0, template => "999");
1594 $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1, scale => ($self->{scale} || 0.5)); 1592 $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1);
1595 $self->add ($self->{max} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); 1593 $self->add ($self->{max} = new CFClient::UI::Label valign => 1, align => 0, template => "999");
1596 1594
1597 $self 1595 $self
1598} 1596}
1599 1597

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines