Skip to main content

FlixelSubState

View source

class

org.flixelgdx.FlixelSubState

public abstract class FlixelSubState extends FlixelState

A FlixelSubState can be opened inside a FlixelState. By default, it stops the parent state from updating, making it convenient for pause screens or menus.

The parent state's FlixelState.persistentUpdate and FlixelState.persistentDraw flags control whether it continues to update and draw while this substate is active.

Substates can be nested: a substate can open another substate on top of itself.

Constructors

FlixelSubState()

public FlixelSubState()

Creates a new substate with a clear background.


FlixelSubState(Color)

public FlixelSubState(Color bgColor)

Creates a new substate with the given background color.

Parameters:

NameDescription
bgColorThe background color for this substate.

Fields

openCallback

public Runnable openCallback

Called when this substate is opened or resumed.


closeCallback

public Runnable closeCallback

Called when this substate is closed.


Methods

syncBackgroundToCameras()

protected void syncBackgroundToCameras()

Re-applies this substate's background to all cameras (needed if the constructor ran before FlixelGame.create).


close()

public void close()

Closes this substate by telling the parent state to remove it.


toString()

public String toString()