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

ktx.artemis.mapper.kt Maven / Gradle / Ivy

Go to download

Artemis-odb entity component system utilities for Kotlin libGDX applications.

The newest version!
package ktx.artemis

import com.artemis.Component
import com.artemis.ComponentMapper
import com.artemis.World

/**
 * Checks if the entity has this type of [Component].
 *
 * @receiver the [ComponentMapper] for checking if the entity has the component.
 * @param entityId the ID of entity to check.
 * @return `true` if the entity has this component type, `false`` if it does not or is scheduled for removal.
 * @throws ArrayIndexOutOfBoundsException if the component was removed or never existed.
 */
operator fun ComponentMapper.contains(entityId: Int): Boolean = has(entityId)

/**
 * Retrieves a ComponentMapper instance for a [Component].
 *
 * @receiver the [World].
 * @param T type of the [ComponentMapper] to retrieve.
 * @return the [ComponentMapper] of the given type.
 */
inline fun  World.mapperFor(): ComponentMapper = getMapper(T::class.java)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy