Package gaiasky.util

Class TipsGenerator

java.lang.Object
gaiasky.util.TipsGenerator

public class TipsGenerator extends Object

Generates sytle-aware tips from a series of strings in the i18n bundle files. Each tip is a sequence of strings, or groups, separated by '|'. For example, 'first part|second part|third part' is a tip with three groups, processed separately. Each group optionally defines the label style to use by prefixing '%%', followed by the style name. For instance, '%%mono-big here is a text' would print 'here is a text' using the label style 'mono-big'.

Additionally, styles can be followed by an action ID, which is converted to the keyboard mappings. For instance, '%%mono-big action.close' would print 'Esc' in the 'mono-big' label style. The key mappings are separated by '+' and given each a style separately.

Additionally, groups can also define images stored in the default skin as drawables. To include an image, use the prefix '$$', followed by the identifier of the image to include. For example, use '$$gamepad-a' to include an image of the A gamepad button. Images need to live in their own group. The rest of the content of the group is ignored.

An example of a full tip would be:

  • "You can use|%%key-big Enter|or|$$gamepad-start|to perform an action."
  • Constructor Details

    • TipsGenerator

      public TipsGenerator(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
  • Method Details

    • newTip

      public void newTip(com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup tip)