Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Turbobadger Layout Cheat Sheet

JimMarlowe edited this page Mar 16, 2017 · 1 revision

Turbobadger Layout Cheat Sheet

Turbobadger is the product used for user interfaces in the Atomic Game Engine. This cheat sheet attempts to clear up some of the mysteries of its most basic component, the Layout.

Tokens in gui.tb.txt files for TBLayout

Please note, there are no tokens which represent the default setting, if you want the default setting, you must remove the item in question. For real.

  • "size" = "available", "gravity". If neither is specified, then the default is LAYOUT_SIZE_PREFERRED
  • "position"= "left" || "top", "right" || "bottom", "gravity". If none are specified, then the default is LAYOUT_POSITION_CENTER
  • "overflow" = "scroll". If not specified the default is LAYOUT_OVERFLOW_CLIP
  • "distribution" = "available", "gravity". If neither is specified, then the default is LAYOUT_DISTRIBUTION_PREFERRED
  • "distribution-position" = "left" || "top", "right" || "bottom". If none are specified, then the default is LAYOUT_DISTRIBUTION_POSITION_CENTER

Source code defaults for UILayout

  • size = UI_LAYOUT_SIZE_GRAVITY; (Note, this is different than the default from the layout file.)
  • position = UI_LAYOUT_POSITION_CENTER;
  • overflow = UI_LAYOUT_OVERFLOW_CLIP;
  • distribution = UI_LAYOUT_DISTRIBUTION_PREFERRED;
  • distribution-position = UI_LAYOUT_DISTRIBUTION_POSITION_CENTER;

Layout Setting Descriptions (from tb_layout.h)

LAYOUT_SIZE

Specifies which height widgets in a AXIS_X layout should have, or which width widgets in a AXIS_Y layout should have. No matter what, it will still prioritize minimum and maximum for each widget

  • LAYOUT_SIZE_GRAVITY - Sizes depend on the gravity for each widget. (If the widget pulls towards both directions, it should grow to all available space)
  • LAYOUT_SIZE_PREFERRED - Size will be the preferred so each widget may be sized differently.
  • LAYOUT_SIZE_AVAILABLE - Size should grow to all available space

LAYOUT_POSITION

Specifies which y position widgets in a AXIS_X layout should have, or which x position widgets in a AXIS_Y layout should have.

  • LAYOUT_POSITION_CENTER - Position is centered
  • LAYOUT_POSITION_LEFT_TOP - Position is to the left for AXIS_Y layout and top for AXIS_X layout.
  • LAYOUT_POSITION_RIGHT_BOTTOM - Position is to the right for AXIS_Y layout and bottom for AXIS_X layout.
  • LAYOUT_POSITION_GRAVITY - Position depend on the gravity for each widget. (If the widget pulls towards both directions, it will be centered)

LAYOUT_OVERFLOW

Specifies what happens when there is not enough room for the layout, even when all the children have been shrunk to their minimum size.

  • LAYOUT_OVERFLOW_CLIP - clip widget contents
  • LAYOUT_OVERFLOW_SCROLL - start scrolling the container

LAYOUT_DISTRIBUTION

Specifies which width widgets in a AXIS_X layout should have, or which height widgets in a AXIS_Y layout should have.

  • LAYOUT_DISTRIBUTION_PREFERRED - Size will be the preferred so each widget may be sized differently.
  • LAYOUT_DISTRIBUTION_AVAILABLE - Size should grow to all available space
  • LAYOUT_DISTRIBUTION_GRAVITY - Sizes depend on the gravity for each widget. (If the widget pulls towards both directions, it should grow to all available space)

LAYOUT_DISTRIBUTION_POSITION

Specifies how widgets should be moved horizontally in a AXIS_X layout (or vertically in a AXIS_Y layout) if there is extra space available.

  • LAYOUT_DISTRIBUTION_POSITION_CENTER - move towards center
  • LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP - move towards top left corner
  • LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM - move towards bottom right corner
Clone this wiki locally