Game-Collisions

 view release on metacpan or  search on metacpan

lib/Game/Collisions.pm  view on Meta::CPAN

# ABSTRACT: Fast, pure Perl collision 2D detection


sub new
{
    my ($class) = @_;
    my $self = {
        root_aabb => undef,
        all_aabbs => {},
    };
    bless $self => $class;


    return $self;
}


sub make_aabb
{
    my ($self, $args) = @_;
    my $aabb = Game::Collisions::AABB->new( $args );

lib/Game/Collisions/AABB.pm  view on Meta::CPAN

        $args->{height},
        $args->{x} + $args->{length},
        $args->{y} + $args->{height},
        undef, # parent node
        undef, # left node
        undef, # right node
        $args->{user_data},
        $do_call_user_data,
    ];

    bless $self => $class;
}


sub x { $_[0]->[_X] }
sub y { $_[0]->[_Y] }
sub length { $_[0]->[_LENGTH] }
sub height { $_[0]->[_HEIGHT] }
sub left_node { $_[0]->[_LEFT_NODE] }
sub right_node { $_[0]->[_RIGHT_NODE] }
sub parent { $_[0]->[_PARENT_NODE] }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.176 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )