Package com.github.tommyettinger.textra
Class TypingConfig
java.lang.Object
com.github.tommyettinger.textra.TypingConfig
Configuration class that easily allows the user to fine tune the library's functionality.
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Defines how many chars can appear per frame.static com.badlogic.gdx.graphics.Color
Default color for theCLEARCOLOR
token.static float
Time in seconds that takes for each char to appear in the default speed.static float
Default time in seconds that an emptyWAIT
token should wait for.Map of global variables that affect allTypingLabel
instances at once.static com.badlogic.gdx.utils.IntFloatMap
Returns a map of characters and their respective interval multipliers, of which the interval to the next char should be multiplied for.static float
Maximum value for theSPEED
token.static float
Minimum value for theSPEED
token. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Defines several default variables with names inALLCAPS
with no separators, all of them creating effects with complex parameters or combining multiple effects.static void
registerEffect
(String startTokenName, Effect.EffectBuilder builder) Registers a new effect to TypingLabel.static void
unregisterEffect
(String startTokenName) Unregisters an effect from TypingLabel.
-
Field Details
-
DEFAULT_WAIT_VALUE
public static float DEFAULT_WAIT_VALUEDefault time in seconds that an emptyWAIT
token should wait for. Default value is0.250
. -
DEFAULT_SPEED_PER_CHAR
public static float DEFAULT_SPEED_PER_CHARTime in seconds that takes for each char to appear in the default speed. Default value is0.05
. -
MIN_SPEED_MODIFIER
public static float MIN_SPEED_MODIFIERMinimum value for theSPEED
token. This value dividesDEFAULT_SPEED_PER_CHAR
to calculate the final speed. Keep it above zero. Default value is0.001
. -
MAX_SPEED_MODIFIER
public static float MAX_SPEED_MODIFIERMaximum value for theSPEED
token. This value dividesDEFAULT_SPEED_PER_CHAR
to calculate the final speed. Default value is100
. -
CHAR_LIMIT_PER_FRAME
public static int CHAR_LIMIT_PER_FRAMEDefines how many chars can appear per frame. Use a value less than1
to disable this limit. Default value is-1
. -
DEFAULT_CLEAR_COLOR
public static com.badlogic.gdx.graphics.Color DEFAULT_CLEAR_COLORDefault color for theCLEARCOLOR
token. Can be overridden byTypingLabel.getClearColor()
. -
INTERVAL_MULTIPLIERS_BY_CHAR
public static com.badlogic.gdx.utils.IntFloatMap INTERVAL_MULTIPLIERS_BY_CHARReturns a map of characters and their respective interval multipliers, of which the interval to the next char should be multiplied for. The keys are technically primitive ints, but only a char is used for each key. -
GLOBAL_VARS
Map of global variables that affect allTypingLabel
instances at once.
-
-
Constructor Details
-
TypingConfig
public TypingConfig()
-
-
Method Details
-
initializeGlobalVars
public static void initializeGlobalVars()Defines several default variables with names inALLCAPS
with no separators, all of them creating effects with complex parameters or combining multiple effects. The variables this defines:{VAR=FIRE}
changes the following text to have fiery changing colors. You can end it with{VAR=ENDFIRE}
.{VAR=SPUTTERINGFIRE}
changes the following text to have fiery changing colors and resize like popping flames. You can end it with{VAR=ENDSPUTTERINGFIRE}
.{VAR=BLIZZARD}
changes the following text to waver in the wind and use icy colors, white to light blue. You can end it with{VAR=ENDBLIZZARD}
.{VAR=SHIVERINGBLIZZARD}
changes the following text to waver in the wind and use icy colors, white to light blue, plus it will randomly make glyphs "shiver" as if cold. You can end it with{VAR=ENDSHIVERINGBLIZZARD}
.{VAR=ELECTRIFY}
changes the following text to be a dull gray purple color and randomly makes glyphs turn light yellow and vibrate around. You can end it with{VAR=ENDELECTRIFY}
.{VAR=ZOMBIE}
changes the following text to be "dark olive sage" (a dull gray-green color), makes glyphs rotate left and right slowly and randomly, makes glyphs drop down and get back up randomly, and when they first appear, has the glyphs emerge from the baseline (as if clawing out of a grave). You can end it with{VAR=ENDZOMBIE}
.
-
registerEffect
Registers a new effect to TypingLabel.- Parameters:
startTokenName
- Name of the token that starts the effect, such as WAVE.builder
- Typically a lambda or method reference that creates an Effect.
-
unregisterEffect
Unregisters an effect from TypingLabel.- Parameters:
startTokenName
- Name of the token that starts the effect, such as WAVE.
-