All pastes #717356 Raw Edit

Someone

public text v1 · immutable
#717356 ·published 2007-09-27 15:54 UTC
rendered paste body
# UI stuff

package UI;
use Moose;

has 'name' => (
	is => 'rw',
	required => 1,
	isa => 'Str',
	default => 'Base'
);


has 'type' => (
	is => 'rw',
 	required =>1,
	isa => 'Str'
);

has 'x' => (
	is => 'rw',
 	required =>1,
	isa => 'Num',
	default => 0
);

has 'y' => (
	is => 'rw',
 	required =>1,
	isa => 'Num',
	default=> 0
);


has 'xsize' => (
	is => 'rw',
 	required =>1,
	isa => 'Num',
	default => 1 
);

has 'ysize' => (
	is => 'rw',
 	required =>1,
	isa => 'Num',
	default => 1 
);

has 'content' => (
	is =>'rw',
	required =>0,
	isa => 'Array'
);

sub show($) {
	my ( $self,$screen ) = @_;
	
	my $color = SDL::Color->new(
		-r => 0x00,
		-g => 0x00,
		-b => 0xff,
	);
	
	my $window = SDL::Rect->new(
		-height => $self->xsize,
		-width  => $self->ysize,
		-x      => $self->x,
		-y      => $self->y,
	);

	$screen->fill( $window, $color );
	$screen->update( $window );	
	return 0;
}

#object is destroyed.
sub die() {
	my ($self) = @_;
	print $self->name . " a ete detruit !";
}

return 1;