Class SwitchingLayout

  • All Implemented Interfaces:
    kotlin.Cloneable

    
    public final class SwitchingLayout
    extends Component
                        

    A layout that is completely empty, but acts as a "handler", which moves layouts in and out of its position.

    • Constructor Detail

      • SwitchingLayout

        SwitchingLayout(SwitchingLayoutProperties properties, Vec2<Unit> at, Vec2<Unit> size, Boolean makesScrolling)
        Parameters:
        size - the visible size of this layout.
        makesScrolling - if true, any layout that is switched into this will be able to scroll and not resized, otherwise, the layout will be resized to this size.
    • Method Detail

      • preRender

         Unit preRender(Long deltaTimeNanos)

        pre-render functions, such as applying transforms. In this method, you should set needsRedraw to true if you have something to redraw for the next frame.

        Parameters:
        deltaTimeNanos - the time in nanoseconds since the last frame.
      • render

         Unit render()

        draw script for this drawable.

      • recolor

        @Deprecated(message = "SwitchingLayouts cannot be drawn, animated, or colored") Unit recolor(Color toColor, Animation.Type animation, Long durationNanos, Function1<Component, Unit> onFinish)

        Changes the color of the component to the specified color. Supports animation and callback function on finish.

        If the color is a Color.Gradient, this component's color will be changed to a gradient between the current color and the specified color.

        If the color is a Color.Chroma, this component's color will be changed to a chroma color, keeping its current hue for consistency. Note: This will look wierd if the current color is a gradient, and the brightness, saturation and alpha are NOT animated, so will change instantly.

        Parameters:
        toColor - The color to change the component to.
        animation - The type of animation to use.
        durationNanos - The duration of the animation in nanoseconds.
        onFinish - The callback function to execute when the color change animation finishes.
        Since:

        0.19.1

      • reset

         Unit reset()

        Use this function to reset your drawable's PolyText if it is using one.

      • calculateSize

         Vec2<Unit> calculateSize()

        Implement this function to return the size of this drawable, if no size is specified during construction.

        This should be so that if the drawable can determine its own size (for example, it is an image), then the size parameter in the constructor can be omitted using:

        size: Vec2<org.polyfrost.polyui.unit.Unit>? = null; and this method needs to be implemented!

        Otherwise, the size parameter in the constructor must be specified.