Class TypingConfig

java.lang.Object
com.github.tommyettinger.textra.TypingConfig

public class TypingConfig extends Object
Configuration class that easily allows the user to fine tune the library's functionality.
  • Field Details

    • DEFAULT_WAIT_VALUE

      public static float DEFAULT_WAIT_VALUE
      Default time in seconds that an empty WAIT token should wait for. Default value is 0.250.
    • DEFAULT_SPEED_PER_CHAR

      public static float DEFAULT_SPEED_PER_CHAR
      Time in seconds that takes for each char to appear in the default speed. Default value is 0.05.
    • MIN_SPEED_MODIFIER

      public static float MIN_SPEED_MODIFIER
      Minimum value for the SPEED token. This value divides DEFAULT_SPEED_PER_CHAR to calculate the final speed. Keep it above zero. Default value is 0.001.
    • MAX_SPEED_MODIFIER

      public static float MAX_SPEED_MODIFIER
      Maximum value for the SPEED token. This value divides DEFAULT_SPEED_PER_CHAR to calculate the final speed. Default value is 100.
    • CHAR_LIMIT_PER_FRAME

      public static int CHAR_LIMIT_PER_FRAME
      Defines how many chars can appear per frame. Use a value less than 1 to disable this limit. Default value is -1.
    • DEFAULT_CLEAR_COLOR

      public static com.badlogic.gdx.graphics.Color DEFAULT_CLEAR_COLOR
      Default color for the CLEARCOLOR token. Can be overridden by TypingLabel.getClearColor().
    • INTERVAL_MULTIPLIERS_BY_CHAR

      public static com.badlogic.gdx.utils.IntFloatMap INTERVAL_MULTIPLIERS_BY_CHAR
      Returns 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

      public static final com.badlogic.gdx.utils.ObjectMap<String,String> GLOBAL_VARS
      Map of global variables that affect all TypingLabel instances at once.
  • Constructor Details

    • TypingConfig

      public TypingConfig()
  • Method Details

    • initializeGlobalVars

      public static void initializeGlobalVars()
      Defines several default variables with names in ALLCAPS 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

      public static void registerEffect(String startTokenName, Effect.EffectBuilder builder)
      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

      public static void unregisterEffect(String startTokenName)
      Unregisters an effect from TypingLabel.
      Parameters:
      startTokenName - Name of the token that starts the effect, such as WAVE.