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

ktx.artemis.archetype.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.Archetype
import com.artemis.ArchetypeBuilder
import com.artemis.Component
import kotlin.reflect.KClass

/**
 * Adds a [Component] to an [ArchetypeBuilder].
 *
 * @receiver the [ArchetypeBuilder] for creating an [Archetype].
 * @param T the component to add to the [ArchetypeBuilder].
 * @return the [ArchetypeBuilder].
 */
inline fun  ArchetypeBuilder.add(): ArchetypeBuilder = add(T::class.java)

/**
 * Removes a [Component] from an [ArchetypeBuilder].
 *
 * @receiver the [ArchetypeBuilder] for creating an [Archetype].
 * @param T the component to remove from the [ArchetypeBuilder].
 * @return the [ArchetypeBuilder].
 */
inline fun  ArchetypeBuilder.remove(): ArchetypeBuilder = remove(T::class.java)

/**
 * Adds multiple components to an [ArchetypeBuilder].
 *
 * @receiver the [ArchetypeBuilder] for creating an [Archetype].
 * @param components the components to add to the [ArchetypeBuilder].
 * @return the [ArchetypeBuilder].
 */
fun ArchetypeBuilder.add(vararg components: KClass): ArchetypeBuilder =
  add(*components.asJavaClasses())

/**
 * Removes multiple components from an [ArchetypeBuilder].
 *
 * @receiver the [ArchetypeBuilder] for creating an [Archetype].
 * @param components - the components to remove from the [ArchetypeBuilder]
 * @return the [ArchetypeBuilder].
 */
fun ArchetypeBuilder.remove(vararg components: KClass): ArchetypeBuilder =
  remove(*components.asJavaClasses())




© 2015 - 2024 Weber Informatics LLC | Privacy Policy