See also: the official libGDX changelog.
- [UPDATE] Updated to Kotlin 1.9.25.
- [UPDATE] Updated to Kotlin Coroutines 1.8.1.
- [UPDATE] Updated to Gradle 7.6.4.
- [UPDATE] Updated to Dokka 1.9.20.
- [MISC] JDK 11 or newer is now required to build the KTX project.
- [CHANGE] (
ktx-assets
) Thepool
factory method now attempts to resetPoolable
objects with the defaultdiscard
lambda to match the default libGDX pool behavior. Pass a custom function to override it. - [FEATURE] (
ktx-math
) Added component deconstructing operators for 2D shapes:Rectangle
: x, y, width, heightEllipse
: x, y, width, heightCircle
: x, y, radiusPolygon
: x, yPolyline
: x, y
- [CHANGE] (
ktx-scene2d
)image
factory method can now be called without parameters or withnull
to create anImage
without aDrawable
. - [FEATURE] (
ktx-tiled
) Addeduse
extension method toBatchTiledMapRenderer
that automatically callsbeginRender()
andendRender()
.
- [UPDATE] Updated to libGDX 1.12.1.
- [UPDATE] Updated to Kotlin 1.9.20.
- [UPDATE] Updated to Kotlin Coroutines 1.7.3.
- [UPDATE] Updated to VisUI 1.5.3.
- [UPDATE] Updated to Dokka 1.9.10.
- [FEATURE] (
ktx-math
) New extension and factory functions were introduced toVector4
, offering similar utilities to the other vectors.vec4
factory methods allow creating newVector4
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.- Vectors are now comparable by length, adding support for
<
,>
,<=
,>=
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.
- [UPDATE] Updated to libGDX 1.12.0.
- [UPDATE] Updated to Kotlin 1.9.0.
- [UPDATE] Updated to Kotlin Coroutines 1.7.2.
- [UPDATE] Updated to VisUI 1.5.2.
- [UPDATE] Updated to Dokka 1.8.20.
- [MISC] KTX project should now work locally under JDK 17, including the test suite.
- [FEATURE] (
ktx-app
)KtxInputAdapter
now supports thetouchCancelled
event handling. By default, it calls thetouchUp
method for consistency with the previous libGDX versions.
- [UPDATE] Updated to Kotlin 1.8.21.
- [UPDATE] Updated to Kotlin Coroutines 1.7.1.
- [UPDATE] Updated to Gradle 7.6.1.
- [UPDATE] Updated to Dokka 1.8.10.
- [FEATURE] (
ktx-ai
) new KTX module with utilities and type-safe builders for gdxAI.- Type aliases to avoid name clashes with common libraries:
GdxAiSequence<E>
forcom.badlogic.gdx.ai.btree.branch.Sequence<E>
GdxAiSelector<E>
forcom.badlogic.gdx.ai.btree.branch.Selector<E>
GdxAiRandom<E>
forcom.badlogic.gdx.ai.btree.decorator.Random<E>
- Extension functions for building behavior trees:
add
behaviorTree
dynamicGuardSelector
parallel
randomSelector
randomSequence
selector
sequence
alwaysFail
alwaysSucceed
include
invert
random
repeat
semaphoreGuard
untilFail
untilSuccess
failureLeaf
successLeaf
waitLeaf
- Type aliases to avoid name clashes with common libraries:
- [UPDATE] Updated to Kotlin 1.8.10.
- [FIX] (
ktx-assets-async
)AssetStorage
no longer usesConcurrentHashMap.getOrDefault
method unsupported on older Android devices.
- [UPDATE] Updated to Kotlin 1.8.0.
- [UPDATE] Updated to VisUI 1.5.1.
- [MISC] Project README now includes installation instructions for new projects using
gdx-liftoff
. - [MISC] Sample KTX projects are now generated by
gdx-liftoff
on every release. - [MISC] Removed migration guides from
ktx-scene2d
andktx-vis
README files. If you are migrating from an old KTX version, please refer to the 1.11.0-rc3 tag. - [FEATURE] (
ktx-assets-async
)AssetStorage.silenceAssetManagerWarnings
property was added, allowing to silence logging on non-fatalAssetLoader
issues. - [FEATURE] (
ktx-assets-async
)AssetManagerWrapper
warnings caused byAssetLoader
issues were extended and improved.
- [UPDATE] Updated to Kotlin 1.7.22.
- [UPDATE] Updated to Dokka 1.7.20.
- [FEATURE] (
ktx-ashley
) AddedtagFor<Component>
utility functions that automatically create a mapper for a flag component. These properties can be used to check forComponent
presence within theEntity
, as well as automatically add and removeComponent
instances upon property modification. - [FEATURE] (
ktx-artemis
) new KTX module with Artemis-odb entity component system utilities:ktx-artemis
.ArchetypeBuilder.add
andArchetypeBuilder.remove
extension methods for adding and removing components from anArchetypeBuilder
.oneOf
,allOf
,exclude
DSL and extension methods forAspect.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
andEntityTransmuterFactory.remove
extension functions for adding and removing components from anEntityTransmuterFactory
.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 aComponentMapper
instance.
- [FEATURE] (
ktx-assets-async
)AssetStorage
now stores a basic path-to-type map, which allows it to support moreAssetManager
methods called by someAssetLoader
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)
- [UPDATE] Updated to Kotlin 1.7.10.
- [UPDATE] Updated to Kotlin Coroutines 1.6.4.
- [UPDATE] Updated to Dokka 1.7.10.
- [MISC] New Dokka theme is available on the documentation website.
- [FEATURE] (
ktx-actors
) AddedActor.onEnter
,Actor.onExit
,Actor.onEnterEvent
andActor.onExitEvent
extension methods that attachClickListener
instances listening for enter and exit events. - [FEATURE] (
ktx-ashley
) AddedComponentDelegate
andOptionalComponentDelegate
that allow accessing component viaEntity
extension properties. - [FEATURE] (
ktx-ashley
) AddedpropertyFor<Component>
andoptionalPropertyFor<Component>
utility functions that automatically create a mapper for the component delegates.
- [UPDATE] Updated to libGDX 1.11.0.
- [MISC] Gradle dependencies changed from compile-only to API scope.
- [FEATURE] (
ktx-app
) AddedgdxError
utility that throws aGdxRuntimeException
. - [FIX] (
ktx-assets-async
) Fixed a niche bug withAsyncAssetManager
which could lead to missed callbacks after attempting to load the same asset concurrently withloadAsync
.
- [UPDATE] Updated to Kotlin 1.6.21.
- [UPDATE] Updated to Kotlin Coroutines 1.6.1.
- [FEATURE] (
ktx-ashley
) Added utilities for working with Ashley'sEntityListener
interface:EntityAdditionListener
: an interface extendingEntityListener
that only requires implementation of theentityAdded
method.EntityRemovalListener
: an interface extendingEntityListener
that only requires implementation of theentityRemoved
method.Engine.onEntityAdded
andEngine.onEntityRemoved
extension methods that create entity listeners from lambdas.- Wrappers for
Engine.onEntityAdded
andEngine.onEntityRemoved
forIteratingSystem
,IntervalIteratingSystem
andSortedIteratingSystem
that use system'sFamily
andEngine
automatically.
- [FEATURE] (
ktx-script
) AddedKotlinScriptEngine.evaluateOn
methods that can execute scripts with a custom receiver. - [CHANGE] (
ktx-script
) Generic libGDX and Java exceptions replaced with a customScriptEngineException
.
- [UPDATE] Updated to Kotlin 1.6.10.
- [UPDATE] Updated to Kotlin Coroutines 1.6.0.
- [MISC] Links to the libGDX wiki were updated.
- [MISC] Stable KTX releases are now marked with the
-rc
suffix. - [FEATURE] (
ktx-actors
) AddedTree.onSelectionChange
extension method that attaches aChangeListener
to aTree
. - [CHANGE] (
ktx-scene2d
) The genericNode
type ofKTreeWidget
was changed toKNode<*>
. - [FEATURE] (
ktx-script
) Added a new module withKotlinScriptEngine
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 toT
.evaluateAs<T>(FileHandle)
: compiles and executes a script from the selected file. Casts the result toT
.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.
- [CHANGE] (
ktx-vis
) The genericNode
type ofKVisTree
was changed toKNode<*>
.
- [UPDATE] Updated to Gradle 7.2.
- [UPDATE] Updated to Dokka 1.5.30.
- [FEATURE] (
ktx-app
) AddedPlatform
object that exposes various utilities for platform-specific code.Platform.currentPlatform
returns currentApplicationType
or throwsGdxRuntimeException
if unable to determine.Platform.version
returns the current version of the platform (e.g., Android API version, iOS major OS version).- Boolean properties that allow to determine current platform:
Platform.isAndroid
checks if the current platform is Android.Platform.isDesktop
checks if the current platform is desktop with graphical application.Platform.isHeadless
checks if the current platform is desktop without graphical application.Platform.isiOS
checks if the current platform is iOS.Platform.isMobile
checks if the current platform is Android or iOS.Platform.isWeb
checks if the current platform is HTML/WebGL.
- Inlined methods that allow to execute code on specific platforms:
Platform.runOnAndroid
executes an action if the current platform is Android. Returns action result or null.Platform.runOnDesktop
executes an action if the current platform is desktop. Returns action result or null.Platform.runOnHeadless
executes an action if the current platform is headless desktop. Returns action result or null.Platform.runOniOS
executes an action if the current platform is iOS. Returns action result or null.Platform.runOnMobile
executes an action if the current platform is Android or iOS. Returns action result or null.Platform.runOnWeb
executes an action if the current platform is HTML/WebGL. Returns action result or null.
- Inlined
runOnVersion
executes an action if the current platform version is within minimum and maximum values.
- [FEATURE] (
ktx-ashley
)Mapper
abstract class designed forcompanion object
s ofComponent
s. Allows to easily obtain instances of aComponentMapper
corresponding to the enclosingComponent
class. - [FEATURE] (
ktx-assets-async
)AssetStorage.loadSync(String)
now supports optional loading parameters. - [FEATURE] (
ktx-collections
)isEmpty
andisNotEmpty
extension methods of libGDX collections now support Kotlin contracts. If they returntrue
, the collection is implied not to be null. - [CHANGE] (
ktx-collections
) AsIdentityMap
now extendsObjectMap
, some redundant utilities specific toIdentityMap
were removed. From the user point of view, all additional functionalities are covered by theObjectMap
utilities. - [FEATURE] (
ktx-freetype-async
)AssetStorage.loadFreeTypeFontAsync
was added, mimickingloadAsync
behavior. - [FEATURE] (
ktx-freetype-async
)AssetStorage.loadFreeTypeFontSync
was added, mimickingloadSync
behavior. - [FEATURE] (
ktx-freetype-async
)AsyncAssetManager.loadFreeTypeFontAsync
was added, returning aDeferred<BitmapFont>
instance. - [CHANGE] (
ktx-scene2d
)Scene2DSkin.defaultSkin
now throwsIllegalStateException
when accessed before overriding.
- [UPDATE] Updated to Kotlin 1.5.31.
- [UPDATE] Updated to Kotlin Coroutines 1.5.2.
- [FEATURE] (
ktx-assets-async
)AssetStorage
now supports loadingPolygonRegion
assets out of the box if the default loaders are registered. - [FEATURE] (
ktx-assets-async
)AsyncAssetManager
is a newAssetManager
extension with basic support for Kotlin coroutines.AsyncAssetManager.loadAsync
allows to schedule an asset for loading, returning aDeferred
asset reference.AsyncAssetManager.getDefaultParameters
allows to create a default instance ofAssetLoaderParameters
for a selected asset.AsyncAssetManager.setLoaderParameterSupplier
has to be called for each custom asset loader in order to enable asynchronous loading without explicitly passing loader parameters.
- [FEATURE] (
ktx-collections
) Factory methods for libGDX arrays of primitives:gdxBooleanArrayOf
gdxByteArrayOf
gdxCharArrayOf
gdxShortArrayOf
gdxIntArrayOf
gdxLongArrayOf
gdxFloatArrayOf
- [FEATURE] (
ktx-inject
) New reflection-basedContext
methods with automatic dependency injection:newInstanceOf
: constructs an instance of the selected class. Injects constructor dependencies from theContext
.bind<Type>
: registers a provider that creates a new instance of selected class via reflection each time it is requested.bindSingleton<Type>
: creates, registers, and returns a singleton of selected class using reflection.
- [FEATURE] (
ktx-reflect
) Added a new module with reflection utilities.Reflection
annotation, which requires opt-in, allows marking functionalities that rely on reflection.ReflectedClass
is an inlined wrapper forClass
that allows to easily use libGDX reflection API.ClassReflection
methods exposed asReflectedClass
read-only properties:simpleName
isMemberClass
isStatic
isArray
isPrimitive
isEnum
isAnnotation
isInterface
isAbstract
componentType
constructors
methods
declaredMethods
fields
declaredFields
annotations
declaredAnnotations
interfaces
enumConstants
ClassReflection
methods exposed asReflectedClass
methods with improved Kotlin class handling:isInstance
isAssignableFrom
newInstance
getConstructor
getDeclaredConstructor
getMethod
getDeclaredMethod
getField
getDeclaredField
isAnnotationPresent
getAnnotation
getDeclaredAnnotation
- Additional
ReflectedClass
utilities:constructor
property allows to extract the only class constructor if it is available.newArrayInstance
method allows to create a type array of the given size usingArrayReflection
.KClass
constructor allows creatingReflectedClass
from aKClass
.
reflect<Type>()
function allows to wrap a selected class withReflectedClass
.reflect(KClass<Type>)
function allows to wrap a selectedKClass
withReflectedClass
.reflect(Class<Type>)
function allows to wrap a selectedClass
withReflectedClass
.reflect(String)
function allows to find a selected class by qualified name and wrap it withReflectedClass
.Annotation.get
extension method with a reified type allowing to get an instance of the annotation.
- [UPDATE] Updated to Gradle 7.0.2.
- [UPDATE] Updated to Kotlin 1.5.21.
- [UPDATE] Updated to Kotlin Coroutines 1.5.1.
- [UPDATE] Updated to VisUI 1.5.0.
- [CHANGE] The JVM target compatibility of all modules was set to
1.8
, since Java1.6
target was deprecated and is incompatible with the latest coroutines library. Note that source compatibility level is still set to1.7
. - [FEATURE] (
ktx-assets
) Addeddiscard
lambda parameter to thepool
factory method that is invoked after an object is rejected from the createdPool
. - [FEATURE] (
ktx-scene2d
) Added support forParticleEffectActor
in Scene2D DSL viaparticleEffect
factory method. - [FEATURE] (
ktx-log
) AddedDEBUG
,INFO
andERROR
constants with default logger tags. - [CHANGE] (
ktx-log
) Default tags are no longer wrapped in square brackets. This caused a change of the logs structure. - [CHANGE] (
ktx-log
)Logger.tag
variable was renamed toLogger.name
. - [CHANGE] (
ktx-log
) Log prefix variables fromLogger
were removed. Message tags are now configurable directly through the constructor. - [CHANGE] (
ktx-log
) Logger name is no longer a part of the message tag. Instead, it is now prepended to the message. This causes a change of the logs structure. - [FEATURE] (
ktx-log
) AddedLogger.buildMessage
method that allows to modify logged message structure. This method can be overridden when extending theLogger
class, simplifying the usage of custom message formats.
- [UPDATE] Updated to libGDX 1.10.0.
- [CHANGE] The Java source compatibility and JVM target version of the KTX modules was changed from 1.6 to 1.7.
- [UPDATE] Updated to Ashley 1.7.4.
- [UPDATE] Updated to Kotlin 1.4.32.
- [UPDATE] Updated to Kotlin Coroutines 1.4.3.
- [UPDATE] Updated to Gradle 6.8.3.
- [UPDATE] Updated to Dokka 1.4.30.
- [MISC] Due to the newly added support for multimodule projects in Dokka, published documentation URLs will change.
- [FEATURE] (
ktx-tiled
) AddedisEmpty
andisNotEmpty
extension function forMapLayers
andMapObjects
collections. - [FEATURE] (
ktx-tiled
) AddedforEachLayer
extension function forTiledMap
to iterate over an exact type ofMapLayer
instances of a specific map. - [FIX] (
ktx-vis
)visScrollPane
andvisSplitPane
now define the correct types forthis
in theinit
lambdas, adding support for Scene2D and VisUI DSL.
- [UPDATE] Updated to libGDX 1.9.14.
- [UPDATE] Updated to Kotlin 1.4.30.
- [UPDATE] Updated to VisUI 1.4.11.
- [FEATURE] (
ktx-app
)clearScreen
now accepts additionalclearDepth
boolean parameter that controls whether theGL_DEPTH_BUFFER_BIT
is added to the mask. - [FEATURE] (
ktx-assets-async
) AddedAssetStorageSnapshot
class that stores a copy ofAssetStorage
state for debugging purposes. Supports formatted string output withprettyFormat
. - [FEATURE] (
ktx-assets-async
)AssetStorage
now includestakeSnapshot
andtakeSnapshotAsync
methods that allow to copy and inspect the internal state of the storage for debugging purposes. - [FEATURE] (
ktx-collections
) AddedgetOrPut
extension function for libGDX map collections includingObjectMap
,IdentityMap
,ArrayMap
andIntMap
.
- [UPDATE] Updated to libGDX 1.9.13.
- [UPDATE] Updated to Kotlin 1.4.21-2.
- [UPDATE] Updated to VisUI 1.4.8.
- [FEATURE] (
ktx-style
) AddedSkin.register
extension method that allows to register widget styles with the DSL. - [FEATURE] (
ktx-vis
) AddedflowGroup
factory method that allows to constructFlowGroup
actors. - [CHANGE] (
ktx-vis
)horizontalFlowGroup
andverticalFlowGroup
are now deprecated. UseflowGroup
instead.
- [UPDATE] Updated to libGDX 1.9.12.
- [UPDATE] Updated to Kotlin 1.4.20.
- [UPDATE] Updated to Kotlin Coroutines 1.4.2.
- [UPDATE] Updated to Kotlin 1.4.10.
- [UPDATE] Updated to Kotlin Coroutines 1.4.0.
- [UPDATE] Updated to Gradle 6.7.
- [UPDATE] Updated to Dokka 1.4.10-2.
- [MISC] Groovy Gradle scripts and configuration files migrated to Kotlin.
- [MISC] The generated sources documentation is vastly improved and moved to a new URL.
- [FEATURE] (
ktx-collections
) AddedGdxIdentityMap
andGdxArrayMap
aliases for libGDXIdentityMap
andArrayMap
collections. - [FEATURE] (
ktx-collections
) Addedset
operator extension method toArrayMap
to support square brackets assignment. - [FEATURE] (
ktx-graphics
) Added optionalCamera
and projection matrix parameters toShapeRenderer.use
. - [FEATURE] (
ktx-scene2d
) Addedimage
builders forNinePatch
,TextureRegion
,Texture
andDrawable
.
- [UPDATE] Updated to libGDX 1.9.11.
- [UPDATE] Updated to Kotlin Coroutines 1.3.6.
- [UPDATE] Updated VisUI to 1.4.6.
- [FEATURE] (
ktx-scene2d
) Added a genericcontainer
factory method that supports adding a custom actor.
- [MISC] Added
ktlint
formatting. Contributors are asked to runformat
Gradle task before committing files. - [CHANGE] (
ktx-actors
) DeprecatedAction.parallelTo
andParallelAction.parallelTo
extension methods were removed. Usealong
instead. - [CHANGE] (
ktx-actors
) Touch event listeners attached with extension methods now extendInputListener
rather thanClickListener
. - [CHANGE] (
ktx-actors
)onTouchEvent
parameters renamed fromdownListener
andupListener
toonDown
andonUp
. - [CHANGE] (
ktx-actors
) Event listeners attached with extension methods now consume theActor
asthis
. Listeners that used to consume actors as regular parameters now should rely onthis
instead. - [FEATURE] (
ktx-actors
)KtxApplicationAdapter
,KtxGame
andKtxScreen
now explicitly implement theDisposable
interface, matching thedispose
method fromApplicationListener
andScreen
respectively. This allows to leverage existingDisposable
utilities. - [FEATURE] (
ktx-ashley
) AddedEngine.configureEntity
extension method that allows to add components to an existing entity. - [FEATURE] (
ktx-assets
) AddedDisposableRegistry
andDisposableContainer
for management of multipleDisposable
instances. - [FEATURE] (
ktx-graphics
) Added support forColor
destructuring syntax. - [CHANGE] (
ktx-scene2d
) Deprecated top-level widget factory methods and tooltip utilities were removed.
- [UPDATE] Updated to Kotlin 1.3.72.
- [UPDATE] Updated to Dokka 0.10.1.
- [CHANGE] Javadocs are no longer generated with Dokka. Since KTX focuses solely on Kotlin support for libGDX, usability from Java is not a priority. The generated Javadocs are not very helpful, especially for Kotlin development. Instead, the Javadoc jar published to Maven Central now contains exported Kotlin-compatible Dokka documentation. Starting from this release, GitHub releases will no longer contain the Javadoc archives.
- [FEATURE] (
ktx-actors
) AddedAction.repeat
extension method that allows to repeat an action for the given amount of times. - [FEATURE] (
ktx-ashley
) AddedEngine.get
operator to access a chosenEntitySystem
. - [FEATURE] (
ktx-ashley
) AddedEngine.getSystem
extension method to access a chosenEntitySystem
. ThrowsMissingEntitySystemException
in case the system is not added. - [FEATURE] (
ktx-ashley
) AddedEntity.addComponent
extension method to create aComponent
for an existingEntity
. - [FEATURE] (
ktx-ashley
) AddedEntity.plusAssign
(+=
) operator that allows to add anComponent
to anEntity
. - [FEATURE] (
ktx-ashley
) Added contracts support toEngineEntity.with
,Engine.create
,Engine.add
,Engine.entity
addEntity.addComponent
. Now their lambda parameters are ensured to be executed exactly once:
// Before:
lateinit var value: Int
engine.add {
value = 42
}
// Now:
val value: Int
engine.add {
value = 42
}
- [FEATURE] (
ktx-assets
)Iterable.dispose
andArray.dispose
extension methods consuming an error handler are now inlined. - [FEATURE] (
ktx-box2d
) Added contracts support to body, fixture and joint factory methods, as well asFixtureDef.filter
This ensures that the configuration lambdas are executed exactly once. - [CHANGE] (
ktx-collections
)PooledList
was removed due to concurrent iteration safety issues. Use standard library lists instead. - [CHANGE] (
ktx-collections
)-
and+
operators no longer mutate the collections. Instead, they create a new collection instance and add or removed the selected elements. To modify an existing collection, use new mutating+=
and-=
operators. - [FEATURE] (
ktx-freetype
) Added contracts support toAssetManager.loadFreeTypeFont
,freeTypeFontParameters
andFreeTypeFontGenerator.generateFont
. This ensures that the font configuration lambdas are executed exactly once. - [FEATURE] (
ktx-freetype-async
) Added contracts support toAssetStorage.loadFreeTypeFont
. - [FEATURE] (
ktx-graphics
) Added contracts support toCamera.update
,Batch.use
,ShaderProgram.use
,GLFrameBuffer.use
andShapeRenderer.use
. - [FEATURE] (
ktx-inject
) Added contracts support toContext.register
. - [CHANGE] (
ktx-log
) Added contracts to logging methods. Logging methods now might need to be imported explicitly. - [FEATURE] (
ktx-preferences
) Added contracts support toPreferences.flush
. - [FEATURE] (
ktx-math
) Added+=
,+
,-=
and-
operators supporting floats and ints toVector2
andVector3
. - [CHANGE] (
ktx-math
)-
,!
,++
and--
operators no longer mutate vectors and matrices, returning new instances instead. - [FIX] (
ktx-math
) Operators documentation regarding mutating of vectors and matrices was updated. - [FEATURE] (
ktx-scene2d
)scene2d
object was added. It supports the entire Scene2D DSL and allows to create root-level widgets. - [FEATURE] (
ktx-scene2d
)Stage.actors
extension method was added. It allows to define actors with Scene2D DSL and adds all top-level actors to theStage
. - [CHANGE] (
ktx-scene2d
) Root-levelactor
function was deprecated. - [CHANGE] (
ktx-scene2d
) Root-level widget factory functions were deprecated. Usescene2d.
prefix orStage.actors
to create these widgets. Note that the actors can still be created via standard DSL. See the migration guide in README. This includes:stack
horizontalGroup
verticalGroup
container
splitPane
scrollPane
table
window
dialog
buttonGroup
tree
- [CHANGE] (
ktx-scene2d
)listWidget
andselectBox
now have a single generic type to improve usability. Their building blocks no longer consumeCell
andNode
instances. - [CHANGE] (
ktx-scene2d
) InternalKWidget.appendActor
andKGroup.add
methods were removed. - [FEATURE] (
ktx-scene2d
) Added contracts support to widget factory methods andStage.actors
. This ensures that widget configuration lambdas are executed exactly once. - [FEATURE] (
ktx-style
) Added contracts support to style factory methods and top-levelskin
functions. - [CHANGE] (
ktx-vis
) Overhaul of the module.ktx-vis
now includes and extends thektx-scene2d
module. The majority of APIs are now shared.- All factory methods for VisUI widgets are now inlined, which can improve the performance of GUI building.
- Factory methods of some VisUI widgets were renamed to avoid clashes with Scene2D methods and better reflect the wrapped widget class names:
label
:visLabel
image
:visImage
list
:visList
,visListOf
selectBox
:visSelectBox
,visSelectBoxOf
slider
:visSlider
textArea
:visTextArea
textField
:visTextField
validatableTextField
:visValidatableTextField
textButton
:visTextButton
imageButton
:visImageButton
imageTextButton
:visImageTextButton
radioButton
:visRadioButton
tree
:visTree
table
:visTable
scrollPane
:visScrollPane
splitPane
:visSplitPane
addTooltip
:visTooltip
addTextTooltip
:visTextTooltip
- Parental actors including
collapsible
,dragPane
,horizontalCollapsible
,visScrollPane
,visSplitPane
andmultiSplitPane
now do not require passing widgets to their factory methods. Instead, widgets are either automatically created or can be defined as nested children with the same DSL. - Inlined functions with lambda parameters, such as widget factories with their building block lambdas, now use Kotlin contracts to ensure that they are executed exactly once.
DEFAULT_STYLE
constant is removed in favor ofdefaultStyle
fromktx-scene2d
.styleName
parameters in factory methods were renamed tostyle
for consistency withktx-scene2d
.@VisDsl
DSL marker is replaced with@Scene2dDsl
marker fromktx-scene2d
.- The sources documentation was greatly expanded.
- [FEATURE] (
ktx-vis-style
) Added contracts support to widget style factory methods.
Known issues:
- [BUG] (
ktx-box2d
) Due to a Kotlin compiler bug, methods with vararg parameters do not support contracts. This includes somepolygon
,chain
andloop
factory methods. See this issue. They can still be used and work as expected, but the compiler does not ensure that their lambda parameters are executed exactly once.
- [UPDATE] Updated to Kotlin 1.3.71.
- [UPDATE] Updated to Kotlin Coroutines 1.3.5.
- [UPDATE] Updated to Gradle 5.6.4.
- [FEATURE] (
ktx-app
) Added profiling utilities.profile
inlined function allows to profile an operation with the libGDXPerformanceCounter
.PerformanceCounter.profile
inlined extension method eases usage ofPerformanceCounter
API.PerformanceCounter.prettyPrint
allows to print basic performance data after profiling.
- [CHANGE] (
ktx-app
)LetterboxingViewport
moved fromktx-app
toktx-graphics
. - [FEATURE] (
ktx-ashley
) AddedEntity.contains
(in
operator) that checks if anEntity
has aComponent
. - [FEATURE] (
ktx-assets-async
) Added a new KTX module: coroutines-based asset loading.AssetStorage
is a non-blocking coroutines-based alternative to libGDXAssetManager
.get
operator obtains an asset from the storage or throws aMissingAssetException
.getOrNull
obtains an asset from the storage or returnnull
if the asset is unavailable.getAsync
obtains a reference to the asset from the storage asDeferred
.load
suspends a coroutine until an asset is loaded and returns its instance.loadAsync
schedules asynchronous loading of an asset.loadSync
blocks the thread until selected asset is loaded.unload
schedules asynchronous unloading of an asset.add
allows to manually add a loaded asset toAssetManager
.dispose
unloads all assets from the storage.getLoader
andsetLoader
manageAssetLoader
instances used to load assets.isLoaded
checks if loading of an asset was finished.contains
operator checks if the asset was scheduled for loading or added to the storage.progress
allows to check asset loading progress.getReferenceCount
returns how many times the asset was loaded or referenced by other assets as a dependency.getDependencies
returns a list of dependencies of the selected asset.getAssetDescriptor
creates anAssetDescriptor
with loading data for the selected asset.getIdentifier
creates anIdentifier
uniquely pointing to an asset of selected type and file path.
Identifier
data class added as an utility to uniquely identify assets by their type and path.Identifier.toAssetDescriptor
allows to convert anIdentifier
to anAssetDescriptor
.
AssetDescriptor.toIdentifier
allows to convert anAssetDescriptor
toIdentifier
used to uniquely identifyAssetStorage
assets.LoadingProgress
is an internal class used by theAssetStorage
to track loading progress.
- [FEATURE] (
ktx-async
) AddedRenderingScope
factory function for custom scopes using rendering thread dispatcher. - [FEATURE] (
ktx-async
)newAsyncContext
andnewSingleThreadAsyncContext
now supportthreadName
parameter that allows to set thread name pattern ofAsyncExecutor
threads. - [FIX] (
ktx-async
)isOnRenderingThread
now behaves consistently regardless of launching coroutine context. - [FEATURE] (
ktx-freetype-async
) This KTX module is now restored and updated to the newAssetStorage
API. There are no public API changes since the last released version. - [FEATURE] (
ktx-graphics
) AddedLetterboxingViewport
fromktx-app
. - [FEATURE] (
ktx-graphics
) AddedtakeScreenshot
utility function that allows to save a screenshot of the application. - [FEATURE] (
ktx-graphics
) AddedBitmapFont.center
extension method that allows to center text on an object. - [FEATURE] (
ktx-graphics
) AddedCamera
utilities.center
extension method allows to center the camera's position to screen center or the center of the chosen rectangle.moveTo
extension method allows to move the camera immediately at the chosen target position with optional offset.lerpTo
extension method allows to move the camera smoothly to the chosen target position with optional offset.update
inlined extension method allows to change camera state with automaticCamera.update
call.
- [FEATURE] (
ktx-math
) Addedlerp
andinterpolate
extension functions forFloat
ranges. - [FEATURE] (
ktx-preferences
) Added a new KTX module: Preferences API extensions.- Added
set
operators forString
,Int
,Float
,Double
,Long
,Boolean
,Pair<String, Any>
andAny
- Added
get
operator which automatically determines preference type and retrieves them with the correct method. get
andset
will automatically attempt to (de)serialize non-basic preferences to and from JSON.set(String, Double)
is deprecated, since the libGDXPreferences
do not support doubles.- Added
flush
inlined extension method that executes a lambda and automatically callsPreferences.flush
.
- Added
- [CHANGE] (
ktx-scene2d
) Improved typing support forTree.Node
widgets. Since libGDX 1.9.10,Tree.Node
is a generic class, but KTXKNode
remained non-generic until now. Type of stored actors must now be specified forKNode
variables, but thanks to that actors fromKNode
instances are now correctly typed and easier to handle. This required minor internal changes -KWidget.storeActor
is now generic. - [FEATURE] (
ktx-vis
) Addedimage
(VisImage
) factory methods consumingTexture
,TextureRegion
andNinePatch
.
- [FEATURE] (
ktx-actors
) AddedonTouchDown
,onTouchUp
andonTouchEvent
extension methods that allow to attachClickListener
instances to actors. - [CHANGE] (
ktx-collections
)Array.removeAll
andretainAll
now return a boolean if any elements were removed. - [CHANGE] (
ktx-collections
)Array.transfer
is now less strict about typing. - [FEATURE] (
ktx-math
) Added Kotlin ranges extensions that simplify creating ranges and rolling random numbers:Int.amid
,Float.amid
;+
,-
,*
and/
for ranges;ClosedRange<Float>.random
,IntRange.random
;ClosedRange<Float>.randomGaussian
;ClosedRange<Float>.randomTriangular
.
- [FEATURE] (
ktx-tiled
) Added a new KTX module: Tiled API extensions.- Added
contains
(in
) andset
([]
) operators support toMapProperties
. - Added extension methods that simplify properties extraction from
MapLayer
,MapObject
,TiledMap
,TiledMapTile
andTiledMapTileSet
:property
propertyOrNull
containsProperty
- Added
shape
extension field toMapObject
. - Added extension fields that ease extraction of basic properties from
TiledMap
andMapObject
.
- Added
- [UPDATE] Updated to Kotlin 1.3.61.
- [UPDATE] Updated to Kotlin Coroutines 1.3.3.
- [FEATURE] (
ktx-assets
) AddedAssetGroup
abstract class that allows to manage groups of assets. - [FEATURE] (
ktx-collections
) AddedremoveAll
,retainAll
andtransfer
extensions to libGDXArray
using lambda predicates to modify the array in-place. - [CHANGE] (
ktx-collections
)PooledList
now implementsMutableIterable
. - [FEATURE] (
ktx-graphics
) AddedBatch.begin
extension methods that automatically set projection matrix from aCamera
orMatrix4
. - [FEATURE] (
ktx-style
) AddedSkin
extension methods with reified resource types:optional
,add
,remove
,has
andgetAll
. - [FEATURE] (
ktx-style
) The overloaded+=
operator can now be used to add"default"
resources toSkin
. - [FEATURE] (
ktx-json
) AddedJsonSerializer
andReadOnlyJsonSerializer
adapters to facilitate writing custom serializers. - [FEATURE] (
ktx-json
) AddedreadOnlySerializer()
factory functions to simplify creation ofReadOnlyJsonSerializer
.
- [UPDATE] Updated to Kotlin 1.3.50.
- [UPDATE] Updated to Kotlin Coroutines 1.3.0.
- [UPDATE] Updated to Gradle 5.6.1.
- [CHANGE] (
ktx-actors
)Action.parallelTo
changed toAction.along
. - [CHANGE] (
ktx-actors
)Action.along
(formerlyAction.parallelTo
) andAction.then
no longer unwrap the second action. - [CHANGE] (
ktx-actors
)ParallelAction.along
(formerlyParallelAction.parallelTo
) andSequenceAction.then
simply add the second action to the group without unwrapping. - [FEATURE] (
ktx-actors
) Added/
operator toAction
, which performs the non-mutating version ofalong
, wrapping the caller and argument in a newParallelAction
. - [CHANGE] (
ktx-actors
)ParallelAction.plus()
andSequenceAction.plus()
no longer unwrap their components. - [FIX] (
ktx-actors
)along
,then
,+
and/
Action
extension methods now properly differentiate betweenSequenceAction
andParallelAction
, taking their inheritance into account. - [CHANGE] (
ktx-box2d
) AddeddisposeOfShape
parameters tofixture
extension methods ofBody
andBodyDefinition
. Setting these values totrue
will cause the fixture shapes to be immediately disposed of afterFixture
construction. - [FIX] (
ktx-box2d
) Removed memory leak caused by undisposed shapes. - [FEATURE] (
ktx-graphics
)Batch.use
extension methods now acceptMatrix4
andCamera
to update the batch's projection matrix before rendering.
- [UPDATE] Updated libGDX to 1.9.10.
- [UPDATE] Updated to Kotlin 1.3.41.
- [UPDATE] Updated to Kotlin Coroutines 1.3.0-RC2.
- [UPDATE] Updated VisUI to 1.4.4.
- [UPDATE] Updated to Gradle 5.5.1.
- [CHANGE] (
ktx-app
)clearScreen
now also clears depth buffer to support 3D applications. - [FEATURE] (
ktx-json
) Added a new KTX module with the goal of improving libGDXJson
API:ktx-json
. The following extension methods were added to avoid passing Java class instances:fromJson
addClassTag
getTag
setElementType
setSerializer
readValue
- [FEATURE] (
ktx-graphics
) AddedGLFrameBuffer.use
to allow safe omission of thebegin()
andend()
calls.
- [UPDATE] Updated to Kotlin 1.3.31.
- [UPDATE] Updated to Kotlin Coroutines 1.2.1.
- [FEATURE] (
ktx-assets
) AddedTextAssetLoader
that can be registered in anAssetManager
to load text files asynchronously. - [FEATURE] (
ktx-style
) AddedSkin.get
extension method that allows to pass enum instances as style names. - [CHANGE] (
ktx-style
)Skin.get
extension method are no longer infix. - [CHANGE] (
ktx-style
)Skin.get
now has accepts default parameter equal to the default style name.
- [UPDATE] Updated libGDX to 1.9.9.
- [UPDATE] Updated to Kotlin 1.3.20.
- [UPDATE] Updated to Kotlin Coroutines 1.1.1.
- [UPDATE] Updated VisUI to 1.4.2.
- [UPDATE] Updated to Gradle 5.0.
- [CHANGE] (
ktx-actors
) ReplacedStage
andGroup
extension operator methodsplus
andminus
withplusAssign
andminusAssign
to avoid mutating the objects with addition and subtraction operators.
// Adding an actor to a Stage/Group - before:
stage + actor
group + actor
// Now:
stage += actor
group += actor
- [CHANGE] (
ktx-actors
) ReplacedStage
andActor
extension operator methodsplus
andminus
withplusAssign
andminusAssign
to avoid mutating the objects with addition and subtraction operators.
// Adding an action to a Stage/Actor - before:
stage + action
actor + action
// Now:
stage += action
actor += action
- [CHANGE] (
ktx-actors
)SequenceAction.then
was removed. Using the method on a sequence no longer mutates it for consistency withAction.then
.then
now unwraps actors from passedSequenceActions
. - [CHANGE] (
ktx-actors
)ParallelAction.parallelTo
was removed. Using the method on aParallelAction
no longer mutates it for consistency withAction.parallelTo
.parallelTo
now unwraps actors from passedParallelActions
. - [CHANGE] (
ktx-async
) Overhaul of thektx-async
module.KtxAsync
is now the main coroutines scope that should be used instead of theGlobalScope
.Dispatchers.KTX
can be used to access a coroutines dispatcher that executes tasks on the main rendering thread.AsyncExecutorDispatcher
can be used to wrap libGDXAsyncExecutor
to execute tasks asynchronously.newSingleThreadAsyncContext
allows to create anAsyncExecutorDispatcher
with a single thread.newAsyncContext
allows to create anAsyncExecutorDispatcher
with the given max amount of threads.onRenderingThread
suspends the coroutine to execute a task on the main rendering thread and return its result.isOnRenderingThread
allows to check whether the coroutine is executed on the main rendering thread.skipFrame
attempts to suspend the coroutine for at least one rendering frame.httpRequest
allows to perform an asynchronous HTTP request.schedule
andinterval
functions simplify libGDXTimer
API usage.AssetStorage
and associated asset loading utilities were temporarily removed. They will be added to a separate module.- Asynchronous tests were significantly simplified.
- Assume that other utilities were either removed or integrated with the listed utilities.
- [CHANGE] (
ktx-freetype-async
) The module is temporarily disabled due to the removal ofAssetStorage
. - [FEATURE] (
ktx-actors
) Added+
operator to create sequence of actions (an alternative syntax tothen
). - [FEATURE] (
ktx-actors
) Added+=
operators toSequenceAction
andParallelAction
to ease adding new actions to these action groups. - [FEATURE] (
ktx-actors
) Addedstage
factory method that uses named and default parameters to easeStage
creation. - [FEATURE] (
ktx-graphics
) AddedShapeRenderer.use
to allow safe omission of thebegin()
andend()
calls. - [FEATURE] (
ktx-math
) AddedImmutableVector2
, an immutable equivalent toVector2
.
- [UPDATE] Updated to Kotlin 1.2.70.
- [UPDATE] Updated to Kotlin Coroutines 0.26.1.
- [UPDATE] Updated to Gradle 4.10.2.
- [FIX] (
ktx-ashley
) Component classes without a default no-arg constructors could not have been initiated by the Ashley engine. This is still the case, but now an exception with a meaningful message is thrown.
- [UPDATE] Updated to Kotlin 1.2.51.
- [UPDATE] Updated to Kotlin Coroutines 0.24.0.
- [UPDATE] Updated to Dokka 0.9.17.
- [UPDATE] Updated to Gradle 4.9.
- [CHANGE] (
ktx-async
)KtxAsync.asynchronous
is now inlined. The action lambda is cross-inlined to avoid excessive object creation.
- [UPDATE] Updated to Kotlin 1.2.41.
- [UPDATE] Updated to Gradle 4.7.
- [FEATURE] (
ktx-graphics
) Added new graphics module with the followingShapeRenderer
extension methods:arc
box
circle
cone
ellipse
rect
rectLine
rotate
scale
translate
triangle
- [CHANGE] (
ktx-app
,ktx-graphics
) Utility functions moved fromktx-app
to the newktx-graphics
:color
Color.copy
Batch.use
ShaderProgram.use
- [MISC] Removed migration guides from very old versions. If you are in a process of migrating an existing
application to the latest KTX and facing any errors, see
README
files in1.9.8-b2
tag.
- [UPDATE] Updated to Kotlin 1.2.30.
- [UPDATE] Updated to Kotlin Coroutines 0.22.5.
- [UPDATE] Updated to Dokka 0.9.16.
- [UPDATE] Updated to Gradle 4.6.
- [FEATURE] (
ktx-math
)dot
andx
infix functions added toVector2
andVector3
allow to calculate dot products and cross products of two vectors respectively. - [FEATURE] (
ktx-box2d
) Initiation blocks ofBody
inWorld.body
extension method is now optional thanks to default lambda parameters in inlined functions. - [FEATURE] (
ktx-box2d
)World.query
extension method allowing to execute AABB query with idiomatic Kotlin. - [CHANGE] (
ktx-math
) Binary operators ofVector2
,Vector3
,Matrix3
andMatrix4
(+
,-
,*
,/
) no longer modify the first vector or matrix. Instead, they create new instances of vectors or matrices that store the operation result. Use the assign operators (+=
,-=
,*=
,/=
) instead to avoid creating new instances. - [CHANGE] (
ktx-math
) New mutating assign operators (+=
,-=
,*=
,/=
) were added toVector2
,Vector3
,Matrix3
andMatrix4
. - [CHANGE] (
ktx-math
) Parameters of matrix vector multiplication operators are switched.vector * matrix
does not exist anymore and now is available asmatrix * vector
. - [CHANGE] (
ktx-math
) Operators ofMatrix3
to left-multiply aVector3
were removed.
- [UPDATE] Updated to libGDX 1.9.8.
- [UPDATE] Updated to Kotlin 1.2.21.
- [UPDATE] Updated to Kotlin Coroutines 0.22.
- [UPDATE] Updated to Gradle 4.4.
- [UPDATE] Updated to VisUI 1.4.0.
- [CHANGE] (
ktx-scene2d
) Duplicate functions in Scene2D building DSL were removed thanks to optional default lambda parameters in inlined functions (added in Kotlin 1.2). Due to the limitation in inlined methods, there used to be two inlined methods for each actor to support syntax both with braces (init block) and without. Now there is just one factory method supporting both syntax variants per widget. This should not affect most application, but might require Kotlin 1.2 usage. - [CHANGE] (
ktx-ashley
) Default functional parameters were added tocreate
,entity
andwith
, simplifying the implementation and making configuration blocks optional. - [CHANGE] (
ktx-inject
) Parameters ofbindSingleton
consuming multiple classes have been swapped to be more compatible with thebind
functions. - [CHANGE] (
ktx-inject
)bind
andbindSingleton
methods consuming multiple classes now takeKClass
as parameters instead ofClass
, so now you can useYourType::class
instead of more verboseYourType::class.java
. - [FEATURE] (
ktx-style
) Initiation blocks ofSkin
and Scene2D actor styles are now optional. - [FEATURE] (
ktx-vis-style
) Initiation blocks of VisUI actor styles are now optional. - [FEATURE] (
ktx-box2d
) Initiation blocks of fixtures and joints are now optional thanks to default lambda parameters in inlined functions.
fun createCircle(body: Body) {
// Before - would not compile without additional braces:
body.circle(radius = 2f) {}
// Now - braces are optional (lambda parameter defaults to no-op):
body.circle(radius = 2f)
}
- [FEATURE] (
ktx-inject
) Add higher-order function parameters forbindSingleton
to allow the use of lambda expressions. - [FEATURE] (
ktx-freetype
) Implementedktx-freetype
module.AssetManager.registerFreeTypeFontLoaders
allows to register all loaders necessary to handle FreeType font assets.AssetManager.loadFreeTypeFont
provides Kotlin DSL for loading of FreeType fonts.freeTypeFontParameters
function provides Kotlin DSL for building FreeType font loading parameters.FreeTypeFontGenerator.generateFont
extension function allows to generateBitmapFont
with Kotlin DSL.
- [FEATURE] (
ktx-freetype-async
) Implementedktx-freetype-async
module.AssetStorage.registerFreeTypeFontLoaders
allows to register all loaders necessary to handle FreeType font assets.AssetStorage.loadFreeTypeFont
provides Kotlin DSL for asynchronous loading of FreeType fonts.
- [FIX] (
ktx-box2d
) As libGDX 1.9.8 fixes itsChainShape
implementation,ChainShape
utilities are supported once again.
- [UPDATE] Updated libGDX to 1.9.7.
- [UPDATE] Updated to Kotlin 1.1.51.
- [UPDATE] Updated to Kotlin Coroutines 0.19.3.
- [UPDATE] Updated to Gradle 4.3.
- [BUG] (
ktx-box2d
)ChainShape
does not work correctly in libGDX 1.9.7, and hence is not supported in KTX. This might break existing applications.
- [UPDATE] Updated to Kotlin 1.1.3-2.
- [UPDATE] Updated to Kotlin Coroutines 0.17.
- [UPDATE] Updated to Gradle 4.0.2.
- [CHANGE] (
ktx-app
)KotlinApplication
was removed. UseKtxApplicationAdapter
orKtxGame
instead. - [CHANGE] (
ktx-app
)KtxGame
no longer supports fixed rendering time steps. - [FEATURE] (
ktx-app
) Clearing screen on rendering is now optional when usingKtxGame
. ChangeclearScreen
parameter tofalse
to turn off screen clearing. - [FEATURE] (
ktx-box2d
)World.rayCast
extension methods that allow creating ray-cast callbacks with the Kotlin lambda syntax.KtxRayCastCallback
alias added to ease implementation of this utility. - [FEATURE] (
ktx-box2d
) AddedRayCast
object with constants that can be returned by the customRayCastCallback
implementations.
- [UPDATE] Updated to Gradle 4.0.
- [UPDATE] Updated to Ashley 1.7.3.
- [CHANGE] (
ktx-ashley
) Extensions updated to supportEngine
base class additionally to thePooledEngine
.Engine.add
andEngine.entity
extension methods to replacePooledEngine
equivalents.- Changed
PooledEntity
toEngineEntity
, wrappingEntity
and providing access toEngine
API.
- [CHANGE] (
ktx-async
)TextAssetLoader
now extendsAsynchronousAssetLoader
instead ofSynchronousAssetLoader
. - [FIX] (
ktx-async
)AssetStorage
now correctly handlesSynchronousAssetLoader
instances on the main rendering thread.
- [UPDATE] Updated to Kotlin 1.1.2-5.
- [UPDATE] Updated to Kotlin Coroutines 0.16.
- [FEATURE] (
ktx-actors
)onChange
,onClick
,onKey
,onKeyDown
,onKeyUp
,onScrollFocus
andonKeyboardFocus
factory methods forEventListener
instances were added. Contrary to existing factory methods, these use minimal set of parameters to make listeners creation as concise as possible. - [CHANGE] (
ktx-actors
) ExistingonChange
,onClick
,onKey
,onKeyDown
,onKeyUp
,onScrollFocus
andonKeyboardFocus
factory methods where renamed toonChangeEvent
,onClickEvent
,onKeyEvent
,onKeyDownEvent
,onKeyUpEvent
,onScrollFocusEvent
andonKeyboardFocusEvent
respectively. Their excessive amount of parameters, useful only on rare occasions, led to unnecessary boilerplate during listeners creation. Seektx-actors
file documentation for migration guide. - [FEATURE] (
ktx-ashley
) new KTX module with Ashley entity component system utilities:ktx-ashley
.PooledEngine.add
andPooledEngine.entity
extension methods.PooledEntity
wrappingEntity
and providing access toPooledEngine
API.mapperFor
factory method that allows to createComponentMapper
instances.- Accessors for
Entity
objects usingComponentMappers
:get
,has
,hasNot
,remove
. - DSL methods for constructing
Family
builders withKClass
instances:oneOf
,allOf
,exclude
.
- [FEATURE] (
ktx-app
) AddedKtxGame
: KTX equivalent of libGDXGame
. - [FEATURE] (
ktx-app
) AddedKtxScreen
: adapter of the libGDXScreen
interface making all methods optional to implement. - [FEATURE] (
ktx-app
) AddedemptyScreen
utility method returning a no-op implementation ofScreen
. - [FEATURE] (
ktx-collections
) Addedmap
,filter
andflatten
extension methods that return libGDX collections. - [FEATURE] (
ktx-collections
)PooledList
now properly implementshashCode
andequals
. - [FEATURE] (
ktx-inject
)Context
now implementsDisposable
and allows to dispose of all registered singletons and providers. - [FEATURE] (
ktx-inject
) AddedContext.remove
andremoveProvider
methods. Now providers for particular types can be removed without clearing the whole context. - [FEATURE] (
ktx-inject
)getProvider
,setProvider
andclear
methods ofContext
are now open and can be overridden.
- [UPDATE] Updated to Kotlin 1.1.2-3.
- [UPDATE] Updated to Kotlin Coroutines 0.15.
- [CHANGE] (
ktx-assets
) StaticAssetManager
instance container -Assets
- was removed. All top level functions depending on the globalAssetManager
were removed. - [FEATURE] (
ktx-assets
) AddedFileType.getResolver
extension method creatingFileHandleResolver
instances. - [FEATURE] (
ktx-assets
) AddedFileHandleResolver.withPrefix
extension method decorating resolvers withPrefixFileHandleResolver
. - [FEATURE] (
ktx-assets
) AddedFileHandleResolver.forResolutions
extension method decorating resolvers withResolutionFileResolver
. - [FEATURE] (
ktx-assets
) Addedresolution
function constructingResolutionFileResolver.Resolution
instances. - [FEATURE] (
ktx-async
) AddedAssetStorage
: a lightweight coroutines-based alternative toAssetManager
. - [FEATURE] (
ktx-box2d
) Implemented a new KTX module with Box2D physics engine utilities:ktx-box2d
.world
factory method constructingWorld
instances.World.body
extension method providing type-safe builder DSL forBody
instances.FixtureDef
builder methods supporting all shapes (CircleShape
,PolygonShape
,ChainShape
,EdgeShape
).FixtureDef.filder
extension methods simplifyingFilter
properties setup.BodyDefinition
is aBodyDef
extension providingBody
building DSL. Used internally byWorld.body
.FixtureDefinition
is aFixtureDef
extension providingFixture
building DSL. Used internally byBodyDefinition
.fixture
,circle
,box
,polygon
,chain
,loop
andedge
extensionFixture
building methods added toBody
.earthGravity
property allowing to setWorld
gravity roughly matching Earth's gravity.onCreate
callbacks inBodyDefinition
andFixtureDefinition
giving access to builtBody
andFixture
instances in building blocks.Body
extension methods that ease creation ofJoint
instances between 2 bodies:jointWith
,gearJointWith
,ropeJointWith
,weldJointWith
,motorJointWith
,mouseJointWith
,wheelJointWith
,pulleyJointWith
,distanceJointWith
,frictionJointWith
,revoluteJointWith
,prismaticJointWith
.
- [CHANGE] (
ktx-i18n
) StaticI18NBundle
instance container -I18n
- was removed. - [CHANGE] (
ktx-i18n
) Top levelnls
functions were removed. - [FEATURE] (
ktx-i18n
)nls
property and method added toBundleLine
for extra readability. - [CHANGE] (
ktx-inject
) StaticContext
instance container was removed. All top level functions depending on the globalContext
were removed. - [FEATURE] (
ktx-inject
)Context.register
builder method added to ease context initiation process.
- [UPDATE] Updated to Kotlin 1.1.1.
- [UPDATE] Updated to VisUI 1.3.0.
- [FEATURE] (
ktx-actors
) Added inlinedtxt
extension properties toLabel
andTextButton
widgets. - [FEATURE] (
ktx-actors
) AddedKtxInputListener
: anInputListener
extension with parameter types improvements. - [FEATURE] (
ktx-actors
)alpha
extension properties ofActor
andStage
are now inlined. - [FEATURE] (
ktx-app
) AddedKtxApplicationAdapter
interface which makes implementing all ofApplicationListener
methods optional. - [FEATURE] (
ktx-app
) AddedKtxInputAdapter
interface which makes implementing all ofInputProcessor
methods optional. - [FEATURE] (
ktx-app
) Addeduse
inlined methods toBatch
andShaderProgram
, allowing to omitbegin()
andend()
calls. - [FEATURE] (
ktx-app
) Addedcolor
factory method to allow constructing libGDXColor
instances with named parameters. - [FEATURE] (
ktx-app
) AddedColor.copy
extension method that allows to copyColor
instances with optional overriding of chosen values. - [CHANGE] (
ktx-app
)KotlinApplication#timeSinceLastRender
now has a protected default getter. - [CHANGE] (
ktx-assets
) StaticAssetManager
instance container was deprecated. Static access toAssetManager
will be removed in the next release. - [FEATURE] (
ktx-assets
) Addedload
,loadAsset
,loadOnDemand
,getAsset
,unload
andunloadSafety
extension methods toAssetManager
to provide an alternative to equivalent utility functions using static manager instance. - [FEATURE] (
ktx-assets
) AddedgetLoader
andsetLoader
extension methods toAssetManager
forAssetLoader
handling. - [FEATURE] (
ktx-async
) Implemented a new KTX module with multi-threaded operations utilities:ktx-async
.- Implemented coroutines context using libGDX threading model:
KtxAsync
. It resumes suspending operations on the main rendering thread withGdx.app.postRunnable
utility. It has to be initiated on the main thread withenableKtxCoroutines
. - Added utility
ktxAsync
function which launches non-blocking coroutine usingKtxAsync
context. - Added
skipFrame
method that suspends the coroutine and resumes it on the next frame usingGdx.app.postRunnable
. - Added
delay
method that offers non-blocking coroutine suspensions for the given period of time. - Added
httpRequest
method that performs asynchronous suspending HTTP request using libGDXNet
API. - Added
asynchronous
method, which allows to perform suspending operations on a separate thread. schedule
andinterval
utility methods added to ease the use ofcom.badlogic.gdx.utils.Timer
API.- Added
HttpRequestResult
: a thread-safeHttpResponse
wrapper that addresses libgdx#4700.
- Implemented coroutines context using libGDX threading model:
- [FEATURE] (
ktx-collections
) AddedsortDescending
,sortBy
andsortByDescending
utility methods to libGDXArray
. - [FEATURE] (
ktx-collections
) Added type aliases to libGDX collections to avoid name collisions with standard library:GdxArray
:com.badlogic.gdx.utils.Array
GdxIntArray
:com.badlogic.gdx.utils.IntArray
GdxFloatArray
:com.badlogic.gdx.utils.FloatArray
GdxBooleanArray
:com.badlogic.gdx.utils.BooleanArray
GdxCharArray
:com.badlogic.gdx.utils.CharArray
GdxLongArray
:com.badlogic.gdx.utils.LongArray
GdxShortArray
:com.badlogic.gdx.utils.ShortArray
GdxSet
:com.badlogic.gdx.utils.ObjectSet
GdxMap
:com.badlogic.gdx.utils.ObjectMap
GdxList
:ktx.collections.PooledList
- [FEATURE] (
ktx-collections
)lastIndex
extension properties of libGDX arrays are now inlined. - [FEATURE] (
ktx-collections
) Addedcomponent1()
andcomponent2()
operator extension methods toEntry
classes of libGDX maps to support destructing syntax and simplify iteration. - [CHANGE] (
ktx-i18n
) StaticI18NBundle
instance container was deprecated. Static access toI18NBundle
will be removed in the next release. - [CHANGE] (
ktx-inject
) StaticContext
instance container was deprecated. Static access toContext
will be removed in the next release. - [FEATURE] (
ktx-scene2d
,ktx-vis
)inCell
extension property added toTable
children. Now you can easily accessCell
instance outside of the actors' building blocks. - [FEATURE] (
ktx-scene2d
,ktx-vis
)inNode
extension property added toTree
children. Now you can easily accessNode
instance outside of the actors' building blocks. - [FEATURE] (
ktx-scene2d
,ktx-vis
) fluentcell
extension method added toTable
children, allowing to configureCell
properties outside of actors' building blocks. - [FEATURE] (
ktx-scene2d
,ktx-vis
) fluentnode
extension method added toTree
children, allowing to configureNode
properties outside of actors' building blocks. - [FEATURE] (
ktx-scene2d
,ktx-vis
) Resolved DSL scoping issues with Kotlin 1.1@DslMarker
API. - [CHANGE] (
ktx-scene2d
,ktx-vis
) Due to@DslMarker
introduction, implicit access to parental widgets is no longer possible in children building blocks. Seektx-scene2d
orktx-vis
documentation for more info on the migration. - [CHANGE] (
ktx-scene2d
)KNode.invoke
extension method was moved directly toKNode
API and no longer has to be imported. - [FEATURE] (
ktx-style
)Skin
instance is now available under lambda parameter ofskin
method init blocks. - [FEATURE] (
ktx-style
,ktx-style-vis
) Resolved DSL scoping issues with Kotlin 1.1@DslMarker
API. - [CHANGE] (
ktx-style
,ktx-style-vis
) Due to@DslMarker
introduction, implicit access toSkin
instance is no longer possible. Seektx-style
documentation for more info on the migration. - [FEATURE] (
ktx-vis
) Added support forHorizontalCollapsibleWidget
:horizontalCollapsible
builder methods added to all parental actors. - [FEATURE] (
ktx-vis
) Added support forVisTree
building using type-safe API. - [CHANGE] (
ktx-vis
) Cells and nodes are now available as lambda parameters. Seektx-vis
documentation for migration guide.
- [UPDATE] Updated to libGDX 1.9.6.
- [UPDATE] Updated to Kotlin 1.1.0.
- [FEATURE] (
ktx-collections
) Added null-safesize()
method to libGDXIntArray
,FloatArray
andBooleanArray
collections. - [FEATURE] (
ktx-collections
) Added null-safe extension propertylastIndex
to libGDXArrayList
equivalents:Array
,IntArray
,FloatArray
andBooleanArray
.
- [UPDATE] Updated to libGDX 1.9.5.
- [FEATURE] (
ktx-actors
) AddedActor.onKeyUp
andActor.onKeyDown
extension methods that attachEventListener
implementations listening toInputEvent
instances. - [FEATURE] (
ktx-app
) Implementedktx-app
module.KotlinApplication
is anApplicationAdapter
equivalent with fixed rendering time step.clearScreen
utility function allows to easily clear the application screen.LetterboxingViewport
is aViewport
implementation that combinesScreenViewport
andFitViewport
behaviors.
- [FEATURE] (
ktx-vis
) AddedListViewStyle
support toListView
factory methods. - [FEATURE] (
ktx-vis
) Added top leveltab()
method. - [FEATURE] (
ktx-vis-style
) AddedListViewStyle
factory method:listView
. - [FIX] (
ktx-scene2d
) Added missingTextButton
factory methods.
- [UPDATE] Updated to libGDX 1.9.4.
- [FEATURE] (
ktx-actors
) Implementedktx-actors
module.isShown
,centerPosition
,setKeyBoardFocus
andsetScrollFocus
extension methods forActor
.contains
operator extension method ofGroup
andStage
supportingactor in group
syntax.+
and-
operator for adding actors toGroup
andStage
.alpha
extension field forActor
andStage
.- Lambda consuming
onChange
,onClick
,onKey
,onScrollFocus
andonKeyboardFocus
extension methods forActor
, allowing to quickly define event listeners. +
and-
operator extension methods can be used to addAction
instances to aStage
.Action.then
infix extension method can be used to chain actions into sequences.Action.repeatForever
wraps an action in aRepeatAction
without a repetitions limit.
- [FEATURE] (
ktx-assets
) Implementedktx-assets
module.Assets.manager
globalAssetManager
instance.load
function can be used to load assets asynchronously via the globalAssetManager
instance.loadOnDemand
can be used to load assets immediately in a blocking manner.unload
can unload the assets.asset
function can be used to access loaded assets from the globalAssetManager
instance.isLoaded
allows to check if an asset has been loaded by the globalAssetManager
.
disposeSafely
and lambda consumingdispose
were added toDisposable
.Iterable
andArray
instances storingDisposable
elements can now be disposed.Exception.ignore
extension method was added for explicit no-op handling of exceptions.Pool.invoke
operator extension method was added as an alternative toPool.obtain
.Pool.invoke(T)
operator extension method was added as an alternative toPool.free(T)
.- Lambda consuming
pool
factory function was added. toClasspathFile
,toInternalFile
,toLocalFile
,toExternalFile
andtoAbsoluteFile
converter methods added toFileHandle
.file
factory function was added.
- [FEATURE] (
ktx-collections
) Implementedktx-collections
module.Array
factory functiongdxArrayOf
and converter methodtoGdxArray
.Array
extensions including:isEmpty
,isNotEmpty
,size
,+
,-
,getLast
,removeLast
,get
,addAll
,removeAll
,iterate
.ObjectSet
factory functiongdxSetOf
and converter methodtoGdxSet
.ObjectSet
extensions including:isEmpty
,isNotEmpty
,size
,+
,-
,addAll
,removeAll
,iterate
.ObjectMap
factory functiongdxMapOf
andIdentityMap
factorygdxIdentityMapOf
.- Maps extensions including:
isEmpty
,isNotEmpty
,size
,contains
(in
),set
([]
),iterate
,toGdxSet
. - Lambda consuming
Iterable.toGdxMap
allows to convert any collection to aObjectMap
. PooledList
collection as an alternative toPooledLinkedList
. IncludesgdxListOf
andtoGdxList
factory methods.
- [FEATURE] (
ktx-i18n
) Implementedktx-i18n
module.I18n.defaultBundle
globalI18NBundle
instance loaded byI18n.load
.addListener
,removeListener
andclearListeners
ofI18n
allow to handle the lifecycle of the globalI18NBundle
.nls
functions allow to access globalI18NBundle
.I18NBundle.get
operator function improves access to the bundle lines.BundleLine
is an interface designed to be implemented by enums that match bundle line names stored in an i18n properties file.
- [FEATURE] (
ktx-inject
) Implementedktx-inject
module.Context
is the core of the dependency injection framework, storing the registered singletons and providers.- Global
Context
instance is available viaContextContainer.defaultContext
. inject
andprovider
functions allow to extract instances and providers of selected type from the globalContext
.register
allows to add singletons and providers to the globalContext
.
- [FEATURE] (
ktx-log
) Implementedktx-log
module.debug
,info
anderror
functions allow to log data with the libGDX logging API.logger
factory function provides instances of the KTXLogger
that wraps libGDX logging API.
- [FEATURE] (
ktx-math
) Implementedktx-math
module.vec2
,vec3
,mat3
andmat4
factory methods forVector2
,Vector3
,Matrix3
andMatrix4
respectively.+
,-
,*
,/
,-
,++
,--
,<
,>
,<=
,>=
operators support forVector2
andVector3
.+
,-
,*
,!
,-
operators support forMatrix3
andMatrix4
.Vector2
,Vector3
,Matrix3
andMatrix4
are now decomposable into 2, 3, 9 and 16 components respectively.
- [FEATURE] (
ktx-scene2d
) Implementedktx-scene2d
module.- Added DSL for constructing complex
Scene2D
widgets.- Factory methods for parental actors:
buttonTable
,container
,dialog
,horizontalGroup
,scrollPane
,splitPane
,stack
,table
,tree
,verticalGroup
andwindow
. - Factory methods for secondary parental actors:
button
,checkBox
,imageButton
andimageTextButton
. - Factory methods for child actors:
image
,label
,list
,progressBar
,selectBox
,slider
,textArea
,textField
andtouchpad
.
- Factory methods for parental actors:
- Added DSL for constructing complex
- [FEATURE] (
ktx-style
) Implementedktx-style
module.skin
factory methods producingSkin
instances.get
operator infix function for quick access ofSkin
resources.set
operator function for quick modification ofSkin
resources.- Factory methods for styles of
Scene2D
widgets:color
,button
,checkBox
,imageButton
,imageTextButton
,label
,list
,progressBar
,selectBox
,slider
,splitPane
,textButton
,textField
,textTooltip
,touchpad
,tree
,window
.
- [FEATURE] (
ktx-vis
) Implementedktx-vis
module.- Added DSL for constructing complex
VisUI
widgets.
- Added DSL for constructing complex
- [FEATURE] (
ktx-vis-style
) Implementedktx-vis-style
module.- Factory methods for styles of
VisUI
widgets.
- Factory methods for styles of