Kotlin extensions for the libGDX game framework
The first release to support libGDX 1.12.1.
ktx-math
) New extension and factory functions were introduced to Vector4
, offering similar utilities to the other vectors.
vec4
factory methods allow creating new Vector4
instances with default and named parameters.+=
, -=
, *=
, /=
mutating operators are now supported.+
, -
(including unary -
), ++
, --
, *
, /
operators are now supported, returning new instances of vectors as a result.<
, >
, <=
, >=
operators.Vector4
instances can now be deconstructed into 4 four values (X, Y, Z, W) using extension component methods.dot
infix function allows calculating the dot product of 2 vectors.Known issues:
ktx-assets
) Pools created via the pool
factory method do not reset the discarded objects by default, which is inconsistent with the libGDX pool behavior. To replicate this, pass a discard
lambda parameter calling reset
on the discarded objects that implement the Poolable
interface.The first release to officially support libGDX 1.12.0 and Kotlin 1.9.0.
ktx-app
) KtxInputAdapter
now supports the touchCancelled
event handling. By default, it calls the touchUp
method for consistency with the previous libGDX versions.The first KTX release to support the gdxAI library with a new module: ktx-ai
. Includes notable updates to core dependencies.
ktx-ai
) new KTX module with utilities and type-safe builders for gdxAI.
GdxAiSequence<E>
for com.badlogic.gdx.ai.btree.branch.Sequence<E>
GdxAiSelector<E>
for com.badlogic.gdx.ai.btree.branch.Selector<E>
GdxAiRandom<E>
for com.badlogic.gdx.ai.btree.decorator.Random<E>
add
behaviorTree
dynamicGuardSelector
parallel
randomSelector
randomSequence
selector
sequence
alwaysFail
alwaysSucceed
include
invert
random
repeat
semaphoreGuard
untilFail
untilSuccess
failureLeaf
successLeaf
waitLeaf
A maintenance release with a bug fix in ktx-assets-async
for older Android devices.
ktx-assets-async
) AssetStorage
no longer uses ConcurrentHashMap.getOrDefault
method unsupported on older Android devices.A maintenance release with support for Kotlin 1.8.0 and notable documentation improvements.
gdx-liftoff
.gdx-liftoff
on every release.
ktx-scene2d
and ktx-vis
README files. If you are migrating from an old KTX version, please refer to the 1.11.0-rc3 tag.ktx-assets-async
) AssetStorage.silenceAssetManagerWarnings
property was added, allowing to silence logging on non-fatal AssetLoader
issues.ktx-assets-async
) AssetManagerWrapper
warnings caused by AssetLoader
issues were extended and improved.Known issues:
ktx-assets-async
) AssetStorage
might work incorrectly on older Android devices due to access to unsupported Java APIs (ConcurrentHashMap.getOrDefault
).The first stable release to support a new KTX module: ktx-artemis
.
ktx-ashley
) Added tagFor<Component>
utility functions that automatically create a mapper for a flag component. These properties can be used to check for Component
presence within the Entity
, as well as automatically add and remove Component
instances upon property modification.ktx-artemis
) new KTX module with Artemis-odb entity component system utilities: ktx-artemis
.
ArchetypeBuilder.add
and ArchetypeBuilder.remove
extension methods for adding and removing components from an ArchetypeBuilder
.oneOf
, allOf
, exclude
DSL and extension methods for Aspect.Builder
.EntityEdit.plusAssign
operator function for adding components.EntityEdit.with
builder function for adding components to an entity.EntityEdit.remove
extension function for removing components from an entity.EntityTransmuterFactory.add
and EntityTransmuterFactory.remove
extension functions for adding and removing components from an EntityTransmuterFactory
.ComponentMapper.contains
operator function to check if an entity has a component.World.edit
extension builder function to edit an entity.World.entity
extension builder function to create and edit an entity.World.get
operator function for retrieving a system which returns null if it doesn't exist.World.getSystem
extension function for retrieving a system which throws an exception if it doesn't exist.World.mapperFor
extension function for retrieving a ComponentMapper
instance.ktx-assets-async
) AssetStorage
now stores a basic path-to-type map, which allows it to support more AssetManager
methods called by some AssetLoader
implementations. These include:
AssetManager.contains(String)
AssetManager.get(String)
AssetManager.get(String, Boolean)
AssetManager.get(String, Class, Boolean)
AssetManager.getAssetType(String)
AssetManager.isLoaded(String)
AssetManager.unload(String)
AssetManager.getDependencies(String)
AssetManager.getReferenceCount(String)
Known issues:
ktx-assets-async
) AssetStorage
might work incorrectly on older Android devices due to access to unsupported Java APIs (ConcurrentHashMap.getOrDefault
).Maintenance release with support for Kotlin 1.7
and Dokka 1.7
, as well as several new utilities.
ktx-actors
) Added Actor.onEnter
, Actor.onExit
, Actor.onEnterEvent
and Actor.onExitEvent
extension methods that attach ClickListener
instances listening for enter and exit events.ktx-ashley
) Added ComponentDelegate
and OptionalComponentDelegate
that allow accessing component via Entity
extension properties.ktx-ashley
) Added propertyFor<Component>
and optionalPropertyFor<Component>
utility functions that automatically create a mapper for the component delegates.The first stable release to support libGDX 1.11.0.
ktx-app
) Added gdxError
utility that throws a GdxRuntimeException
.ktx-assets-async
) Fixed a niche bug with AsyncAssetManager
which could lead to missed custom user callbacks after attempting to load the same asset concurrently with loadAsync
.A maintenance release with notable changes to the ktx-ashley
and ktx-script
modules.
ktx-ashley
) Added utilities for working with Ashley's EntityListener
interface:
EntityAdditionListener
: an interface extending EntityListener
that only requires implementation of the entityAdded
method.EntityRemovalListener
: an interface extending EntityListener
that only requires implementation of the entityRemoved
method.Engine.onEntityAdded
and Engine.onEntityRemoved
extension methods that create entity listeners from lambdas.Engine.onEntityAdded
and Engine.onEntityRemoved
for IteratingSystem
, IntervalIteratingSystem
and SortedIteratingSystem
that use system's Family
and Engine
automatically.ktx-script
) Added KotlinScriptEngine.evaluateOn
methods that can execute scripts with a custom receiver.ktx-script
) Generic libGDX and Java exceptions replaced with a custom ScriptEngineException
.The first release to support a new KTX module: ktx-script
with a Kotlin scripting engine.
Note that the KTX stable versions will have a -rc
suffix instead of -b
from now on.
-rc
suffix.ktx-actors
) Added Tree.onSelectionChange
extension method that attaches a ChangeListener
to a Tree
.ktx-scene2d
) The generic Node
type of KTreeWidget
was changed to KNode<*>
.ktx-script
) Added a new module with KotlinScriptEngine
evaluating Kotlin scripts in runtime.
evaluate(String)
: compiles and executes a script passed as a string.evaluate(FileHandle)
: compiles and executes a script from the selected file.evaluateAs<T>(String)
: compiles and executes a script passed as a string. Casts the result to T
.evaluateAs<T>(FileHandle)
: compiles and executes a script from the selected file. Casts the result to T
.set(String, Any)
: adds a variable to the script execution context.get(String)
: returns the current value assigned to the selected variable.remove(String)
: removes the variable registered under the given name.import(String, String?)
: adds an import to the script context. Accepts optional alias.importAll(vararg String)
, importAll(Iterable<String>)
: adds the selected imports to the script context.setPackage(String)
: sets the package for the scripts.ktx-vis
) The generic Node
type of KVisTree
was changed to KNode<*>
.