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.62 by root, Tue Apr 11 13:27:48 2006 UTC vs.
Revision 1.64 by root, Tue Apr 11 13:38:22 2006 UTC

215package CFClient::Widget::Container; 215package CFClient::Widget::Container;
216 216
217our @ISA = CFClient::Widget::; 217our @ISA = CFClient::Widget::;
218 218
219sub new { 219sub new {
220 my ($class, @widgets) = @_; 220 my ($class, %arg) = @_;
221
222 my $children = delete $arg{children} || [];
221 223
222 my $self = $class->SUPER::new (children => []); 224 my $self = $class->SUPER::new (children => []);
223 $self->add ($_) for @widgets; 225 $self->add ($_) for @$children;
224 226
225 $self 227 $self
226} 228}
227 229
228sub add { 230sub add {
296our @ISA = CFClient::Widget::Bin::; 298our @ISA = CFClient::Widget::Bin::;
297 299
298use SDL::OpenGL; 300use SDL::OpenGL;
299 301
300sub new { 302sub new {
301 my ($class, $x, $y, $z, $w, $h) = @_; 303 my ($class, %arg) = @_;
302 304
303 my $self = $class->SUPER::new; 305 my $self = $class->SUPER::new (%arg);
304
305 @$self{qw(x y z w h)} = ($x, $y, $z, $w, $h);
306} 306}
307 307
308sub update { 308sub update {
309 my ($self) = @_; 309 my ($self) = @_;
310 310
311 # we want to do this delayed...
311 $self->render_chld; 312 $self->render_chld;
312 $self->SUPER::update; 313 $self->SUPER::update;
313} 314}
314 315
315sub render_chld { 316sub render_chld {
633our @ISA = CFClient::Widget::; 634our @ISA = CFClient::Widget::;
634 635
635use SDL::OpenGL; 636use SDL::OpenGL;
636 637
637sub new { 638sub new {
638 my ($class, $x, $y, $z, $height, $text) = @_; 639 my ($class, %arg) = @_;
639
640 $height ||= $::FONTSIZE;
641 640
642 # TODO: color, and make height, xyz etc. optional 641 # TODO: color, and make height, xyz etc. optional
643 my $self = $class->SUPER::new ( 642 my $self = $class->SUPER::new (
644 color => [1, 1, 1], 643 color => [1, 1, 1],
645 x => $x, 644 height => $::FONTSIZE,
646 y => $y, 645 text => "",
647 z => $z,
648 height => $height,
649 layout => new CFClient::Layout $height, 646 layout => new CFClient::Layout,
647 %arg
650 ); 648 );
651 649
652 $self->set_text ($text); 650 $self->set_text ($self->{text});
653 651
654 $self 652 $self
655} 653}
656 654
657sub set_text { 655sub set_text {
671 669
672sub size_request { 670sub size_request {
673 my ($self) = @_; 671 my ($self) = @_;
674 672
675 $self->{layout}->set_width; 673 $self->{layout}->set_width;
674 $self->{layout}->set_height ($self->{height});
676 $self->{layout}->size 675 $self->{layout}->size
677# if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack 676# if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack
678# ( 677# (
679# $self->{texture}{width}, 678# $self->{texture}{width},
680# $self->{texture}{height}, 679# $self->{texture}{height},
783use SDL; 782use SDL;
784use SDL::OpenGL; 783use SDL::OpenGL;
785use SDL::OpenGL::Constants; 784use SDL::OpenGL::Constants;
786 785
787our @ISA = CFClient::Widget::; 786our @ISA = CFClient::Widget::;
787
788sub new {
789 my $class = shift;
790
791 $class->SUPER::new (z => -1, @_)
792}
788 793
789sub key_down { 794sub key_down {
790 print "MAPKEYDOWN\n"; 795 print "MAPKEYDOWN\n";
791} 796}
792 797

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines