ScreenLayout
namespace Griff.Runtime;
public static class ScreenLayoutPuts what’s pinned to the screen (ScreenAnchor) at its point on the main camera’s view: the game each frame (on the window’s shape), and the editor after each edit (on a 16:9 screen), so the Scene view shows a HUD where the game will. With the camera’s HudSize set, it’s drawn HudScale times its size, so it keeps its size on the screen as the camera zooms.
Methods
Section titled “Methods”LayOutAll
Section titled “LayOutAll”public static void LayOutAll(Scene scene, float aspect)Puts everything anchored in scene where the game shows it on its main camera’s view, on a screen aspect times as wide as it’s high. Parents go before children; an entity’s first anchor places it.
OffsetFor
Section titled “OffsetFor”public static Vector2 OffsetFor(ScreenAnchor anchor, Vector3 position, Entity? camera, float aspect)The Offset that puts anchor’s entity at position, a position in its parent’s space, on the view camera shows at aspect: for dragging it in the editor.
ViewOf
Section titled “ViewOf”public static ValueTuple<Vector2, Vector2, float> ViewOf(Entity? camera, float aspect)What camera (the main camera, or none) shows on a screen aspect times as wide as it’s high, to lay out what’s anchored to it: its middle (shake included), how far it reaches out to its edges, and how many times its own size the HUD is drawn (see HudScale).