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

ktx.artemis.aspect.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.Aspect
import com.artemis.Component
import kotlin.reflect.KClass

/**
 * Includes entities to an [Aspect] if they have at least one of the specified components.
 *
 * @param components one of the components the entities must have.
 * @return an [Aspect.Builder] for the [Aspect].
 */
fun oneOf(vararg components: KClass): Aspect.Builder = Aspect.one(*components.asJavaClasses())

/**
 * Includes entities to an [Aspect] if they have all the specified components.
 *
 * @param components all the components the entities must have.
 * @return an [Aspect.Builder] for the [Aspect].
 */
fun allOf(vararg components: KClass): Aspect.Builder = Aspect.all(*components.asJavaClasses())

/**
 * Excludes entities from an [Aspect] if they have at least one of the specified components.
 *
 * @param components all the components the entities cannot have.
 * @return an [Aspect.Builder] for the [Aspect].
 */
fun exclude(vararg components: KClass): Aspect.Builder = Aspect.exclude(*components.asJavaClasses())

/**
 * Includes entities to an [Aspect] if they have at least one of the specified components.
 *
 * @receiver the [Aspect.Builder] for creating an [Aspect].
 * @param components one of the components the entities must have.
 * @return an [Aspect.Builder] for the [Aspect].
 */
fun Aspect.Builder.oneOf(vararg components: KClass): Aspect.Builder = one(*components.asJavaClasses())

/**
 * Includes entities to an [Aspect] if they have all the specified components.
 *
 * @receiver the [Aspect.Builder] for creating an [Aspect].
 * @param components all the components the entities must have.
 * @return an [Aspect.Builder] for the [Aspect].
 */
fun Aspect.Builder.allOf(vararg components: KClass): Aspect.Builder = all(*components.asJavaClasses())

/**
 * Excludes entities from an [Aspect] if they have at least one of the specified components.
 *
 * @receiver the [Aspect.Builder] for creating an [Aspect].
 * @param components all the components the entities cannot have.
 * @return an [Aspect.Builder] for the [Aspect].
 */
fun Aspect.Builder.exclude(vararg components: KClass): Aspect.Builder =
  exclude(*components.asJavaClasses())




© 2015 - 2024 Weber Informatics LLC | Privacy Policy