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.477 by root, Sun Jan 11 23:50:27 2009 UTC vs.
Revision 1.479 by root, Thu Feb 4 20:01:09 2010 UTC

1package DC::UI; 1package DC::UI;
2 2
3use utf8; 3use common::sense;
4use strict;
5 4
6use List::Util (); 5use List::Util ();
7 6
8use Guard (); 7use Guard ();
9 8
666} 665}
667 666
668sub _draw { 667sub _draw {
669 my ($self) = @_; 668 my ($self) = @_;
670 669
671 my $color = $FOCUS == $self && $self->{active_bg} 670 my $color = $FOCUS == $self
672 ? $self->{active_bg} 671 ? $self->{active_bg} || $self->{bg}
673 : $self->{bg}; 672 : $self->{bg};
674 673
675 if ($color && (@$color < 4 || $color->[3])) { 674 if ($color && (@$color < 4 || $color->[3])) {
676 my ($w, $h) = @$self{qw(w h)}; 675 my ($w, $h) = @$self{qw(w h)};
677 676
2594 2593
2595############################################################################# 2594#############################################################################
2596 2595
2597package DC::UI::Image; 2596package DC::UI::Image;
2598 2597
2599our @ISA = DC::UI::Base::; 2598our @ISA = DC::UI::DrawBG::;
2600 2599
2601use DC::OpenGL; 2600use DC::OpenGL;
2602 2601
2603our %texture_cache; 2602our %texture_cache;
2604 2603
2637 my ($self, $cloning, $path) = @_; 2636 my ($self, $cloning, $path) = @_;
2638 2637
2639 $self->new (path => $path) 2638 $self->new (path => $path)
2640} 2639}
2641 2640
2641sub set_texture {
2642 my ($self, $tex) = @_;
2643
2644 $self->{tex} = $tex;
2645 $self->update;
2646}
2647
2642sub size_request { 2648sub size_request {
2643 my ($self) = @_; 2649 my ($self) = @_;
2644 2650
2645 (int $self->{tex}{w} * $self->{scale}, int $self->{tex}{h} * $self->{scale}) 2651 (int $self->{tex}{w} * $self->{scale}, int $self->{tex}{h} * $self->{scale})
2646} 2652}
2647 2653
2648sub _draw { 2654sub _draw {
2649 my ($self) = @_; 2655 my ($self) = @_;
2656
2657 $self->SUPER::_draw;
2650 2658
2651 my $tex = $self->{tex}; 2659 my $tex = $self->{tex};
2652 2660
2653 my ($w, $h) = ($self->{w}, $self->{h}); 2661 my ($w, $h) = ($self->{w}, $self->{h});
2654 2662
2672package DC::UI::ImageButton; 2680package DC::UI::ImageButton;
2673 2681
2674our @ISA = DC::UI::Image::; 2682our @ISA = DC::UI::Image::;
2675 2683
2676use DC::OpenGL; 2684use DC::OpenGL;
2677
2678my %textures;
2679 2685
2680sub new { 2686sub new {
2681 my $class = shift; 2687 my $class = shift;
2682 2688
2683 my $self = $class->SUPER::new ( 2689 my $self = $class->SUPER::new (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines