All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.artemis.PackedComponent Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package com.artemis;

import com.artemis.annotations.UnstableApi;

import java.nio.ByteBuffer;

/**
 * Packs components into a memory-friendly storage, such as a primitive array or {@link ByteBuffer},
 * reuses the same instance for all entities.
 * 

* Constructor must either be zero-length or take a {@link World} instance. * Calling the constructor must not change the underlying component data - ie, * it's the equivalent of a {@link #clone()}. *

* * UnsatbleApi: Pending optimization work might result in changes to this interface. */ @UnstableApi public abstract class PackedComponent extends Component { /** * Sets the currently processed entity. Automatically * called by {@link PackedComponentMapper}. * * @param e entity to process. * @deprecated use #forEntity(int) instead. */ @Deprecated protected void forEntity(Entity e) { forEntity(e.getId()); } /** * Sets the currently processed entity. Automatically * called by {@link PackedComponentMapper}. * * @param entityId id of entity to process. */ protected abstract void forEntity(int entityId); /** * Internal method, used by the {@link ComponentManager}, * will always send the highest seen {@link Entity#getId()}. *

* Ensures that the backing data storage can accomodate * all entities. * * @param id Highest seen entity id. */ protected abstract void ensureCapacity(int id); /** * Resets the component upon deletion. */ protected abstract void reset(); /** * Marks packed component for freeing of resources upon {@link World#dispose()}. Called once. */ public static interface DisposedWithWorld { void free(World world); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy