Skip to main content

FlixelGroup

View source

class

org.flixelgdx.group.FlixelGroup

public class FlixelGroup<T> implements FlixelGroupable<T>

Framework-agnostic member list backed by a SnapshotArray. Use this in a plain libGDX Screen or game loop with any member type (FlixelGroup<Actor>, FlixelGroup<YourEntity>, etc.): call FlixelGroup.add(T), FlixelGroup.remove(T), and FlixelGroup.forEachMember yourself; there is no automatic update/draw.

For gameplay objects that implement IFlixelBasic (including FlixelBasic subclasses), use FlixelBasicGroup or FlixelState instead so members receive the usual update/draw/recycle lifecycle.

See Also: FlixelBasicGroup

Constructors

FlixelGroup(ArraySupplier<T[]>)

public FlixelGroup(ArraySupplier<T[]> arrayFactory)

Creates a new group with the given array factory and unlimited size by default.

Parameters:

NameDescription
arrayFactoryThe array factory to use.

FlixelGroup(ArraySupplier<T[]>, int)

public FlixelGroup(ArraySupplier<T[]> arrayFactory, int maxSize)

Creates a new group with the given array factory and maximum size.

Parameters:

NameDescription
arrayFactoryThe array factory to use.
maxSizeThe maximum size of the group.

Fields

members

protected SnapshotArray<T> members

maxSize

protected int maxSize

Methods

ensureMembers()

public void ensureMembers()

add(T)

public void add(T member)

remove(T)

public void remove(T member)

clear()

public void clear()

resetStorage()

public void resetStorage()

Clears the member list and discards the backing SnapshotArray so the next FlixelGroup.ensureMembers() or FlixelGroup.add(T) allocates a fresh array. Does not call any method on member instances.


getMembers()

public SnapshotArray<T> getMembers()

getMaxSize()

public int getMaxSize()

setMaxSize(int)

public void setMaxSize(int maxSize)