#!/usr/bin/perl -w

#############################################################################
# Brush - a thing that is a brush
#
# Copyright (C) 1999-2000 by Tels. All rights reserved.
#############################################################################

package CoW::Brush;
use vars qw($VERSION);
$VERSION = 1.00;    # Current version of this package
require  5.005;     # requires this Perl version or later

use base CoW::Thing;
use strict;
use vars qw($AUTOLOAD);

use CoW::Texture;
use CoW::Dromed::Constants qw(AIR CUBE);

#############################################################################
# private, initialize self 

my $id = 1;

sub _init
  {
  my $self = shift;
  my $args = shift;

  $self->SUPER::_init($args); 	# use things _init to make copy and checks
  # now imply some more checks
  my $txt = new CoW::Texture;
  $self->SUPER::_default( {
    texture => $txt,
    kind => AIR,
    shape => CUBE,
    id => $id,
    time => $id,
    name => 'brush_'.$id,
   } ); 
  $id++;
  return $self;
  }

#############################################################################
# public

sub kind
  {
  my $self = shift;
  my $kind = shift;
  if (defined $kind)
    {
    die ('Illegal brush kind $kind') if ($kind < 0) || ($kind > 5); # XXX
    $self->{kind} = $kind; 
    }
  return $self->{kind};
  }

sub shape
  {
  my $self = shift;
  my $shape = shift;
  if (defined $shape)
    {
    die ('Illegal brush shape $shape') if ($shape < 0) || ($shape > 4); # XXX
    $self->{shape} = $shape;
    }
  return $self->{shape};
  }  

1; 

__END__

#############################################################################

=pod

=head1 NAME

Brush -- a brush is the basic building block for terrain.

=head1 SYNOPSIS

	use CoW::Brush;
	use CoW::Dromed::Constants qw(AIR CUBE);

	$brush = new CoW::Brush ( kind => AIR, shape => CUBE, );

	print $brush->as_string(),"\n";

=head1 REQUIRES

perl5.005, L<Bunch|Bunch>, L<Thing|Thing>, L<Dromed::Constants|Dromed::Constants>

=head1 EXPORTS

Exports nothing.

=head1 DESCRIPTION

This represents one Brush, which is the basic building block in DromEd.

=head1 FIELDS

=over 2

=item kind

The kind of the brush, either AIR, WATER, SOLID, FLOOD, EVAPORATE XXX,

=item shape

The shape of the brush, either CUBE, CYLINDER, WEDGE, PYRAMID. XXX

=back

=head1 METHODS

=head2 kind

Set/sets the brush kind (WATER, AIR etc).

=head2 shape

Set/gets the brush shape (CUBE, WEDGE etc).

=head1 BUGS

None known yet.

=head1 AUTHOR

Tels http://bloodgate.com 1999-2000.

=cut

