NAME

SDL::App::FPS::Group - a container class for SDL::App::FPS

SYNOPSIS

	use SDL::FPS::App;
	use SDL::FPS::App::Group;
	use SDL::FPS::App::Timer;

	$app = SDL::FPS::App->new( ... );

	my $group = SDL::App::FPS::Group->new( $app );

	my $handler = SDL::App::FPS::EventHandler->new(
          SDL_KEYDOWN, SDLK_SPACE, { ... });

        $group->add($handler);

	$group->for_each( $CODE_ref, @arguments );

DESCRIPTION

This package provides a container class, which is used to store timers, event handlers and other things.

It is used by SDL::App::FPS and you need not to use it directly for timer and event handlers. However, it may be usefull for other things.

CALLBACK

Once for_each() is called, the given callback code (CODE ref) is called with the following parameters:

&{$callback}($self,$object,$object_id,@arguments);

$self is the app the object resides in (e.g. the object of type SDL::App::FPS), $object is the object itself, $id it's id, and the additional arguments are whatever was passed when for_each() was called.

METHODS

new()
my $group = SDL::App::FPS::Group->new();

Creates a new group container.

add()
$group->add($object);
$group->add(@objects);

Add a list of obects (given as reference) to the group. The object(s) must have one internal field, called id. These IDs should be unique numbers or strings.

del()
$group->del($object_id);

Given an object ID, remove this object from the group.

contains()
$group->contains($object_id);

Given an object ID, returns true when the group contains an object with this ID.

id()
$group->id();

Returns the ID of the group itself.

member()
$object = $group->member($id);

Given an object ID, returns the object or undef.

member()
$count = $group->members();

Returns the number of members in this group.

for_each()
$count = $group->for_each($methodname, @arguments);

For each of the members in this group call their method $methodname with the @arguments.

BUGS

None known yet.

AUTHORS

(c) 2002, 2003 Tels <http://bloodgate.com/>

SEE ALSO

SDL:App::FPS, SDL::App and SDL.