Package-level declarations

Types

Link copied to clipboard
open class KtxInputListener : InputListener

Extends com.badlogic.gdx.scenes.scene2d.InputListener for the sole purpose of getting guarantees on nullability. Provides no-op implementations of all methods, making them optional to implement.

Properties

Link copied to clipboard
var Actor.alpha: Float

Links to this actor's Actor.color instance. Allows to easily modify alpha color value.

var Stage.alpha: Float

Links to this Stage.root.color instance. Allows to easily modify alpha color value of stage.

Link copied to clipboard
const val MAX_ALPHA: Float = 1.0f

Max value of alpha in libGDX Color instances.

Link copied to clipboard
const val MIN_ALPHA: Float = 0.0f

Min value of alpha in libGDX Color instances.

Link copied to clipboard
var Label.txt: String

Allows to access and modify Label text with idiomatic Kotlin property syntax.

var TextButton.txt: String

Allows to access and modify TextButton text with idiomatic Kotlin property syntax.

Functions

Link copied to clipboard
infix fun Action.along(action: Action): ParallelAction

Wraps this action and the passed action with a ParallelAction, executing them both at the same time.

infix fun ParallelAction.along(action: Action): ParallelAction

Adds action to this ParallelAction, so long as this isn't a SequenceAction. If it is a SequenceAction, it creates a new ParallelAction executing both actions in parallel.

Link copied to clipboard
fun Actor.centerPosition(width: Float = this.stage.width, height: Float = this.stage.height, normalize: Boolean = true)

Modifies this actor position to be centered within the passed bounds. Uses actor's size to calculate the offsets.

Link copied to clipboard
operator fun Group.contains(actor: Actor): Boolean
operator fun Stage.contains(actor: Actor): Boolean
Link copied to clipboard
operator fun Action.div(action: Action): ParallelAction

Wraps this action and the passed action with a ParallelAction.

Link copied to clipboard
fun Actor?.isShown(): Boolean
Link copied to clipboard
fun Actor.keepWithinParent()

Checks this actor's position and size and makes sure that it is kept within its parent actor bounds (or Stage).

Link copied to clipboard
operator fun Actor.minusAssign(action: Action)

Alias for Actor.removeAction method. Allows to remove actions from the actor with -= operator.

operator fun Group.minusAssign(actor: Actor)

Alias for Group.removeActor method. Allows to remove actors from the group with -= operator.

operator fun Stage.minusAssign(action: Action)

Alias for Stage.root.removeAction method. Removes global stage actions with -= operator.

operator fun Stage.minusAssign(actor: Actor)

Removes actors from root group of the stage. Allows to remove actors from the stage with -= operator. If actor is not added directly to the stage this method might have no effect.

Link copied to clipboard
inline fun <T : Actor> T.onChange(crossinline listener: T.() -> Unit): ChangeListener

Attaches a ChangeListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onChangeEvent(crossinline listener: T.(event: ChangeListener.ChangeEvent) -> Unit): ChangeListener

Attaches a ChangeListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onClick(crossinline listener: T.() -> Unit): ClickListener

Attaches a ClickListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onClickEvent(crossinline listener: T.(event: InputEvent) -> Unit): ClickListener
inline fun <T : Actor> T.onClickEvent(crossinline listener: T.(event: InputEvent, x: Float, y: Float) -> Unit): ClickListener

Attaches a ClickListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onEnter(crossinline listener: T.() -> Unit): InputListener

Attaches a ClickListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onEnterEvent(crossinline listener: T.(event: InputEvent, x: Float, y: Float) -> Unit): ClickListener

Attaches a ClickListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onExit(crossinline listener: T.() -> Unit): InputListener

Attaches an ClickListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onExitEvent(crossinline listener: T.(event: InputEvent, x: Float, y: Float) -> Unit): ClickListener

Attaches a ClickListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKey(catchEvent: Boolean = false, crossinline listener: T.(character: Char) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyTyped type events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyboardFocus(catchEvent: Boolean = false, crossinline listener: T.(focused: Boolean) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyboard focus events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyboardFocusEvent(catchEvent: Boolean = false, crossinline listener: T.(event: FocusListener.FocusEvent) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyboard focus events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyDown(catchEvent: Boolean = false, crossinline listener: T.(keyCode: Int) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyDown type events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyDownEvent(catchEvent: Boolean = false, crossinline listener: T.(event: InputEvent, keyCode: Int) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyDown type events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyEvent(catchEvent: Boolean = false, crossinline listener: T.(event: InputEvent, character: Char) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyTyped type events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyUp(catchEvent: Boolean = false, crossinline listener: T.(keyCode: Int) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyUp type events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onKeyUpEvent(catchEvent: Boolean = false, crossinline listener: T.(event: InputEvent, keyCode: Int) -> Unit): EventListener

Attaches an EventListener optimized to listen for keyUp type events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onScrollFocus(catchEvent: Boolean = false, crossinline listener: T.(focused: Boolean) -> Unit): EventListener

Attaches an EventListener optimized to listen for scroll focus events fired for this actor.

Link copied to clipboard
inline fun <T : Actor> T.onScrollFocusEvent(catchEvent: Boolean = false, crossinline listener: T.(event: FocusListener.FocusEvent) -> Unit): EventListener

Attaches an EventListener optimized to listen for scroll focus events fired for this actor.

Link copied to clipboard
inline fun <N : Tree.Node<N, *, *>> Tree<N, *>.onSelectionChange(crossinline listener: (Selection<N>) -> Unit): ChangeListener

Attaches a ChangeListener to this Tree.

Link copied to clipboard
inline fun <T : Actor> T.onTouchDown(crossinline listener: T.() -> Unit): InputListener

Attaches an InputListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onTouchEvent(crossinline listener: T.(event: InputEvent) -> Unit): InputListener
inline fun <T : Actor> T.onTouchEvent(crossinline listener: T.(event: InputEvent, x: Float, y: Float) -> Unit): InputListener

Attaches an InputListener to this actor. Retrieve the InputEvent.type to distinguish between touchDown and touchUp events.

inline fun <T : Actor> T.onTouchEvent(crossinline listener: T.(event: InputEvent, x: Float, y: Float, pointer: Int, button: Int) -> Unit): InputListener

Attaches a InputListener to this actor. Retrieve the InputEvent.type to distinguish between touchDown and touchUp events.

inline fun <T : Actor> T.onTouchEvent(crossinline onDown: T.(event: InputEvent) -> Unit, crossinline onUp: T.(event: InputEvent) -> Unit): InputListener
inline fun <T : Actor> T.onTouchEvent(crossinline onDown: T.(event: InputEvent, x: Float, y: Float) -> Unit, crossinline onUp: T.(event: InputEvent, x: Float, y: Float) -> Unit): InputListener
inline fun <T : Actor> T.onTouchEvent(crossinline onDown: T.(event: InputEvent, x: Float, y: Float, pointer: Int, button: Int) -> Unit, crossinline onUp: T.(event: InputEvent, x: Float, y: Float, pointer: Int, button: Int) -> Unit): InputListener

Attaches an InputListener to this actor.

Link copied to clipboard
inline fun <T : Actor> T.onTouchUp(crossinline listener: T.() -> Unit): InputListener

Attaches an InputListener to this actor.

Link copied to clipboard
operator fun Action.plus(action: Action): SequenceAction

Wraps this action and the passed action in a SequenceAction.

Link copied to clipboard
operator fun Actor.plusAssign(action: Action)

Alias for Actor.addAction method. Allows to add actions to the actor with += operator.

operator fun Group.plusAssign(actor: Actor)

Alias for Group.addActor method. Allows to add actors to the group with += operator.

operator fun Stage.plusAssign(action: Action)

Alias for Stage.addAction method. Allows to add global actions to the stage with += operator.

operator fun Stage.plusAssign(actor: Actor)

Alias for Stage.addActor method. Allows to add actors to the stage with += operator.

operator fun ParallelAction.plusAssign(action: Action)

Adds another Action to this ParallelAction.

operator fun SequenceAction.plusAssign(action: Action)

Adds action to this SequenceAction.

Link copied to clipboard
fun Action.repeat(times: Int): RepeatAction

This action will be wrapped wit ha RepeatAction that repeats itself for the given amount of times.

Link copied to clipboard
fun Action.repeatForever(): RepeatAction

This action will be wrapped with a RepeatAction that repeats itself "forever" (until the action is removed or the actor is no longer updated on the stage).

Link copied to clipboard
fun Actor.setKeyboardFocus(focus: Boolean = true)

Modifies current stage keyboard focus if this actor is currently shown.

Link copied to clipboard
fun Actor.setPosition(x: Int, y: Int)

Utility method overload. Allows to set actor's position with ints rather than floats.

Link copied to clipboard
fun Actor.setScrollFocus(focus: Boolean = true)

Modifies current stage scroll focus if this actor is currently shown.

Link copied to clipboard
fun stage(batch: Batch = SpriteBatch(), viewport: Viewport = getDefaultViewport()): Stage

Allows to leverage named and default parameters to initiate a custom Stage. batch will be used to render the Stage, while viewport's camera will affect how the Stage is rendered. If any of the parameters are not given, the used default values match Stage no-arg constructor.

Link copied to clipboard
infix fun Action.then(action: Action): SequenceAction

Wraps this action and the passed action in a SequenceAction.

infix fun SequenceAction.then(action: Action): SequenceAction

Adds action to this SequenceAction.