Skip to reading
The GUI Designer

5. Understand X, Y, size and anchors

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView illustrations

An element's X and Y are offsets from its chosen Anchor inside its own GUI. Width and Height are its saved size in design pixels. They do not change when you zoom the editor view.

Source table from 5. Understand X, Y, size and anchors, page 11
Anchor exampleSettings for a 1280 by 720 GUIResult
top-leftWidth 180, Height 48; X 20, Y 18The element begins 20 pixels from the left and 18 from the top.
top-rightWidth 180, Height 48; X -20, Y 18Its right edge stays 20 pixels inside the GUI's right edge.
centerWidth 180, Height 48; X 0, Y 0The element is centered in the GUI.
bottom-rightWidth 180, Height 48; X -20, Y -20It sits 20 pixels inside the bottom and right edges.

1. Select Menu Button in the HUD and open General.

2. Choose top-right for Anchor.

3. Set X to -20, Y to 18, Width to 180 and Height to 48.

4. Check the result on the canvas. Negative offsets here move the element inward from the right or bottom.

Figure 6. The anchored menu button uses an inward X offset. A large positive X with top-right would push it outside the GUI.

Choose the anchor, then enter the offsets for that anchor. These are attachment points, not an automatic stretching layout. Test long text and different window sizes rather than assuming an anchored label will grow to fit.

Page 11 of 57Permalink
Go to page