Releases: libktx/ktx
KTX 1.9.11-b1
The first release to officially support LibGDX 1.9.11. No major changes otherwise.
- [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.
KTX 1.9.10-b7
The last release to officially support LibGDX 1.9.10. A few deprecated functionalities were removed.
- [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.
KTX 1.9.10-b6
A major release with breaking changes in ktx-scene2d
, a rewrite of ktx-vis
, removal of Javadocs generation, Kotlin contracts support and refactoring of operator extensions to conform to Kotlin guidelines.
- [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.
KTX 1.9.10-b5
This major release contains 2 new KTX modules: ktx-preferences
with utilities for application preferences and ktx-assets-async
with an asset manager based on Kotlin coroutines. ktx-freetype-async
is also no longer disabled and now it can be used along with the ktx-assets-async
to load FreeType fonts asynchronously.
ktx-assets-async
comes with a complete rewrite of AssetStorage
that used to be available in a limited form in a few older versions of ktx-async
. Updated to the new coroutines API, AssetStorage
can now be used as a more performant and Kotlin-idiomatic alternative to AssetManager
from LibGDX.
- [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
.
KTX 1.9.10-b4
The first release to include a new KTX module with Tiled map editor utilities: ktx-tiled
.
- [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
KTX 1.9.10-b3
Includes multiple new utilities, major documentation improvements and some notable dependencies updates.
- [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
.
KTX 1.9.10-b2
A maintenance release with notable dependencies updates and two bug fixes in ktx-actors
and ktx-box2d
.
- [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.
KTX 1.9.10-b1
The first stable release to support LibGDX 1.9.10 and feature ktx-json
- a new KTX module with utilities for LibGDX JSON serialization API.
- [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.
Known issues:
- [BUG] (
ktx-actor
) SinceSequenceAction
extendsParallelAction
in LibGDX 1.9.10, usingparallelTo
with aSequenceAction
as the first argument leads to unexpected behaviour. - [BUG] (
ktx-box2d
) Since fixture shapes are not disposed of after fixture creation, all fixture factory methods can lead to minor memory leaks.
KTX 1.9.9-b2
Maintenance release with dependencies update and some additional utilities in ktx-style
.
- [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.
KTX 1.9.9-b1
A major KTX release with some significant changes. Most notably:
ktx-async
module was overhauled and now properly provides coroutines scope consistent the stable coroutines API.AssetStorage
andktx-freetype-async
were temporarily removed until they are refactored to the newktx-async
API.ImmutableVector2
was added as an immutable alternative to the officialVector2
.
- [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 dispatchers 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 corouting 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
.
Known issues:
- [REMOVAL] (
ktx-async
)AssetStorage
was removed until refactoring to the newktx-async
API. - [REMOVAL] (
ktx-freetype-async
) Sincektx-freetype-async
depends on theAssetStorage
, this module was disabled before this release.