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.277 by root, Sun Jun 4 00:21:52 2006 UTC vs.
Revision 1.278 by root, Sun Jun 4 23:05:06 2006 UTC

548 return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w) 548 return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w)
549 || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h); 549 || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h);
550 550
551 glPushMatrix; 551 glPushMatrix;
552 glTranslate $self->{x}, $self->{y}, 0; 552 glTranslate $self->{x}, $self->{y}, 0;
553 $self->_draw;
554 glPopMatrix;
555 553
556 if ($self == $HOVER && $self->{can_hover}) { 554 if ($self == $HOVER && $self->{can_hover}) {
557 my ($x, $y) = @$self{qw(x y)};
558
559 glColor 1, 0.8, 0.5, 0.2; 555 glColor 1*0.2, 0.8*0.2, 0.5*0.2, 0.2;
560 glEnable GL_BLEND; 556 glEnable GL_BLEND;
561 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 557 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
562 glBegin GL_QUADS; 558 glBegin GL_QUADS;
563 glVertex $x , $y; 559 glVertex 0 , 0;
564 glVertex $x + $self->{w}, $y; 560 glVertex $self->{w}, 0;
565 glVertex $x + $self->{w}, $y + $self->{h}; 561 glVertex $self->{w}, $self->{h};
566 glVertex $x , $y + $self->{h}; 562 glVertex 0 , $self->{h};
567 glEnd; 563 glEnd;
568 glDisable GL_BLEND; 564 glDisable GL_BLEND;
569 } 565 }
570 566
571 if ($ENV{CFPLUS_DEBUG} & 1) { 567 if ($ENV{CFPLUS_DEBUG} & 1) {
572 glPushMatrix; 568 glPushMatrix;
573 glColor 1, 1, 0, 1; 569 glColor 1, 1, 0, 1;
574 glTranslate $self->{x} + 0.375, $self->{y} + 0.375; 570 glTranslate 0.375, 0.375;
575 glBegin GL_LINE_LOOP; 571 glBegin GL_LINE_LOOP;
576 glVertex 0 , 0; 572 glVertex 0 , 0;
577 glVertex $self->{w} - 1, 0; 573 glVertex $self->{w} - 1, 0;
578 glVertex $self->{w} - 1, $self->{h} - 1; 574 glVertex $self->{w} - 1, $self->{h} - 1;
579 glVertex 0 , $self->{h} - 1; 575 glVertex 0 , $self->{h} - 1;
580 glEnd; 576 glEnd;
581 glPopMatrix; 577 glPopMatrix;
582 #CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; 578 #CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw;
583 } 579 }
580
581 $self->_draw;
582 glPopMatrix;
584} 583}
585 584
586sub _draw { 585sub _draw {
587 my ($self) = @_; 586 my ($self) = @_;
588 587
626 625
627 if ($color && (@$color < 4 || $color->[3])) { 626 if ($color && (@$color < 4 || $color->[3])) {
628 my ($w, $h) = @$self{qw(w h)}; 627 my ($w, $h) = @$self{qw(w h)};
629 628
630 glEnable GL_BLEND; 629 glEnable GL_BLEND;
631 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 630 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
632 glColor @$color; 631 glColor_premultiply @$color;
633 632
634 glBegin GL_QUADS; 633 glBegin GL_QUADS;
635 glVertex 0 , 0; 634 glVertex 0 , 0;
636 glVertex 0 , $h; 635 glVertex 0 , $h;
637 glVertex $w, $h; 636 glVertex $w, $h;
856 my $tex = $self->{texture} 855 my $tex = $self->{texture}
857 or return; 856 or return;
858 857
859 glEnable GL_TEXTURE_2D; 858 glEnable GL_TEXTURE_2D;
860 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 859 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
860 glEnable GL_BLEND;
861 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
861 glColor 1, 1, 1, 1; 862 glColor 0, 0, 0, 1;
862 863
863 $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); 864 $tex->draw_quad (0, 0, $w, $h);
864 865
866 glDisable GL_BLEND;
865 glDisable GL_TEXTURE_2D; 867 glDisable GL_TEXTURE_2D;
866} 868}
867 869
868############################################################################# 870#############################################################################
869 871
1035 1037
1036 if ($self->{bg}) { 1038 if ($self->{bg}) {
1037 my ($w, $h) = @$self{qw(w h)}; 1039 my ($w, $h) = @$self{qw(w h)};
1038 1040
1039 glEnable GL_BLEND; 1041 glEnable GL_BLEND;
1040 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1042 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
1041 glColor @{ $self->{bg} }; 1043 glColor_premultiply @{ $self->{bg} };
1042 1044
1043 glBegin GL_QUADS; 1045 glBegin GL_QUADS;
1044 glVertex 0 , 0; 1046 glVertex 0 , 0;
1045 glVertex 0 , $h; 1047 glVertex 0 , $h;
1046 glVertex $w, $h; 1048 glVertex $w, $h;
1784 my ($self) = @_; 1786 my ($self) = @_;
1785 1787
1786 local $self->{fg} = $self->{fg}; 1788 local $self->{fg} = $self->{fg};
1787 1789
1788 if ($FOCUS == $self) { 1790 if ($FOCUS == $self) {
1789 glColor @{$self->{active_bg}}; 1791 glColor_premultiply @{$self->{active_bg}};
1790 $self->{fg} = $self->{active_fg}; 1792 $self->{fg} = $self->{active_fg};
1791 } else { 1793 } else {
1792 glColor @{$self->{bg}}; 1794 glColor_premultiply @{$self->{bg}};
1793 } 1795 }
1794 1796
1795 glEnable GL_BLEND; 1797 glEnable GL_BLEND;
1796 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1798 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
1797 glBegin GL_QUADS; 1799 glBegin GL_QUADS;
1798 glVertex 0 , 0; 1800 glVertex 0 , 0;
1799 glVertex 0 , $self->{h}; 1801 glVertex 0 , $self->{h};
1800 glVertex $self->{w}, $self->{h}; 1802 glVertex $self->{w}, $self->{h};
1801 glVertex $self->{w}, 0; 1803 glVertex $self->{w}, 0;
2150 2152
2151 my $h1 = $self->{h} * (1 - $ycut1); 2153 my $h1 = $self->{h} * (1 - $ycut1);
2152 my $h2 = $self->{h} * (1 - $ycut2); 2154 my $h2 = $self->{h} * (1 - $ycut2);
2153 2155
2154 glEnable GL_BLEND; 2156 glEnable GL_BLEND;
2155 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 2157 glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
2158 GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
2156 glEnable GL_TEXTURE_2D; 2159 glEnable GL_TEXTURE_2D;
2157 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2160 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2158 2161
2159 glBindTexture GL_TEXTURE_2D, $t1->{name}; 2162 glBindTexture GL_TEXTURE_2D, $t1->{name};
2160 glBegin GL_QUADS; 2163 glBegin GL_QUADS;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines