Class TransformContainer<T extends com.badlogic.gdx.scenes.scene2d.Actor>

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
com.badlogic.gdx.scenes.scene2d.ui.Container<T>
com.github.tommyettinger.textra.TransformContainer<T>
Type Parameters:
T - an Actor type that you want to be transform-able
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Cullable, com.badlogic.gdx.scenes.scene2d.utils.Layout

public class TransformContainer<T extends com.badlogic.gdx.scenes.scene2d.Actor> extends com.badlogic.gdx.scenes.scene2d.ui.Container<T>
Acts exactly like a Container around a scene2d Actor, but enables transform by default rather than disabling it. This allows methods like Actor.setRotation(float) to work by default. This is meant to be used with a "Cpu" Batch for optimal performance; typically this is CpuSpriteBatch from libGDX or TextureArrayCpuPolygonSpriteBatch from this library. Note that there can still be a significant performance drop from transforming even one Group, even with a TextureArrayCpuPolygonSpriteBatch or CpuSpriteBatch.
This only exists to streamline how rotation works for widgets here. It is equivalent to a normal Container that automatically calls Group.setTransform(boolean) with true as its parameter. You can use a Container and enable transform yourself, if you want. While a class like WidgetGroup also contains one or more Actors and has transform enabled by default, it also doesn't participate in layout like a widget normally does, so it looks and acts odd.
You can also rotate individual glyphs generally without any problems; this is used by various TypingLabel Effects. Rotating whole TypingLabels or TextraLabels also works, and is much faster than using a TransformContainer (or a normal Container with transform set to true), but can look incorrect where underline or strikethrough are used. Box drawing characters also tend to slide when rotating without a Container of some sort.
  • Field Summary

    Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    POOLS
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Container

    addActor, addActorAfter, addActorAt, addActorBefore, align, background, bottom, center, clip, clip, draw, drawBackground, drawDebug, fill, fill, fill, fill, fillX, fillY, getActor, getAlign, getBackground, getClip, getFillX, getFillY, getMaxHeight, getMaxHeightValue, getMaxWidth, getMaxWidthValue, getMinHeight, getMinHeightValue, getMinWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getPrefHeight, getPrefHeightValue, getPrefWidth, getPrefWidthValue, height, height, hit, layout, left, maxHeight, maxHeight, maxSize, maxSize, maxSize, maxSize, maxWidth, maxWidth, minHeight, minHeight, minSize, minSize, minSize, minSize, minWidth, minWidth, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, prefHeight, prefHeight, prefSize, prefSize, prefSize, prefSize, prefWidth, prefWidth, removeActor, removeActor, removeActorAt, right, setActor, setBackground, setBackground, setClip, setCullingArea, setRound, size, size, size, size, top, width, width

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup

    childrenChanged, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group

    act, applyTransform, applyTransform, clear, clear, clearChildren, clearChildren, computeTransform, debugAll, drawChildren, drawDebugChildren, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, resetTransform, setDebug, setStage, setTransform, swapActor, swapActor, toString

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TransformContainer

      public TransformContainer()
    • TransformContainer

      public TransformContainer(T actor)