--- deliantra/Deliantra-Client/DC/UI.pm 2006/04/11 13:29:24 1.63 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/04/11 13:38:22 1.64 @@ -217,10 +217,12 @@ our @ISA = CFClient::Widget::; sub new { - my ($class, @widgets) = @_; + my ($class, %arg) = @_; + + my $children = delete $arg{children} || []; my $self = $class->SUPER::new (children => []); - $self->add ($_) for @widgets; + $self->add ($_) for @$children; $self } @@ -298,11 +300,9 @@ use SDL::OpenGL; sub new { - my ($class, $x, $y, $z, $w, $h) = @_; - - my $self = $class->SUPER::new; + my ($class, %arg) = @_; - @$self{qw(x y z w h)} = ($x, $y, $z, $w, $h); + my $self = $class->SUPER::new (%arg); } sub update { @@ -636,21 +636,18 @@ use SDL::OpenGL; sub new { - my ($class, $x, $y, $z, $height, $text) = @_; - - $height ||= $::FONTSIZE; + my ($class, %arg) = @_; # TODO: color, and make height, xyz etc. optional my $self = $class->SUPER::new ( - color => [1, 1, 1], - x => $x, - y => $y, - z => $z, - height => $height, - layout => new CFClient::Layout $height, + color => [1, 1, 1], + height => $::FONTSIZE, + text => "", + layout => new CFClient::Layout, + %arg ); - $self->set_text ($text); + $self->set_text ($self->{text}); $self } @@ -674,6 +671,7 @@ my ($self) = @_; $self->{layout}->set_width; + $self->{layout}->set_height ($self->{height}); $self->{layout}->size # if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack # ( @@ -787,6 +785,12 @@ our @ISA = CFClient::Widget::; +sub new { + my $class = shift; + + $class->SUPER::new (z => -1, @_) +} + sub key_down { print "MAPKEYDOWN\n"; }