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.147 by root, Sat Apr 22 03:50:25 2006 UTC vs.
Revision 1.148 by elmex, Sat Apr 22 12:14:45 2006 UTC

582 582
583our @ISA = CFClient::UI::Bin::; 583our @ISA = CFClient::UI::Bin::;
584 584
585use CFClient::OpenGL; 585use CFClient::OpenGL;
586 586
587sub new {
588 my $class = shift;
589
590 my $self = $class->SUPER::new (
591 bg => [1, 1, 1, 1],
592 border_bg => [1, 1, 1, 1],
593 border => 0.8,
594 @_
595 );
596
597 $self
598}
599
600sub set_size {
601 my ($self, $w, $h) = @_;
602 $self->{req_w} = $w;
603 $self->{req_h} = $h;
604 $self->check_size;
605}
606
587sub size_request { 607sub size_request {
588 my ($self) = @_; 608 my ($self) = @_;
589 my $chld = $self->child 609 ($self->{req_w}, $self->{req_h})
590 or return (0, 0);
591
592 $chld->move (2, 2);
593
594 map { $_ + 4 } $chld->size_request;
595} 610}
596 611
597sub size_allocate { 612sub size_allocate {
598 my ($self, $x, $y, $w, $h) = @_; 613 my ($self, $w, $h) = @_;
599 614 $self->{w} = $w;
615 $self->{h} = $h;
600 $self->child->configure (2, 2, $w - 4, $h - 4); 616 $self->child->configure (0, 0, $w, $h);
601} 617}
602 618
603sub _draw { 619sub _draw {
604 my ($self) = @_; 620 my ($self) = @_;
605 621
606 my $chld = $self->child; 622 my ($w, $h) = ($self->{w}, $self->{h});
607 623
608 my ($w, $h) = $chld->size_request; 624 glEnable GL_BLEND;
625 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
626 glEnable GL_TEXTURE_2D;
627 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
609 628
610 glBegin GL_QUADS; 629# glBegin GL_QUADS;
611 glColor 0, 0, 0; 630# glColor 0, 0, 0, 0;
612 glVertex 0 , 0; 631# glVertex 0 , 0;
613 glVertex 0 , $h + 4; 632# glVertex 0 , $h;
614 glVertex $w + 4 , $h + 4; 633# glVertex $w, $h;
615 glVertex $w + 4 , 0; 634# glVertex $w, 0;
616 glEnd; 635# glEnd;
617 636
637
618 $chld->draw; 638 $self->child->draw;
639 glDisable GL_BLEND;
640 glDisable GL_TEXTURE_2D;
619} 641}
620 642
621############################################################################# 643#############################################################################
622 644
623package CFClient::UI::FancyFrame; 645package CFClient::UI::FancyFrame;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines