ScreenLayout
| Kind | class |
| Package | backend |
| Full name | backend.ScreenLayout |
| Source | source/backend/ScreenLayout.hx |
Pure layout math for the 1280x720 game. Keeping it separate from Flixel makes the aspect-ratio and touch-boundary rules testable without a renderer.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
BASE_WIDTH | Int | yes | 1280 | — |
BASE_HEIGHT | Int | yes | 720 | — |
Public methods
viewportWidth
static function viewportWidth(deviceWidth:Int, deviceHeight:Int, widescreen:Bool):Int
The logical width at a fixed 720-pixel height; narrow screens letterbox.
| Parameter | Type | Default |
|---|---|---|
deviceWidth | Int | — |
deviceHeight | Int | — |
widescreen | Bool | — |
contentLeft
static inline function contentLeft(viewportWidth:Int):Float
Left edge of the centered, mod-compatible 1280-pixel gameplay/UI area.
| Parameter | Type | Default |
|---|---|---|
viewportWidth | Int | — |
laneStart
static inline function laneStart(index:Int, lanes:Int, viewportWidth:Int):Int
Contiguous touch lanes covering all pixels, including rounding remainders.
| Parameter | Type | Default |
|---|---|---|
index | Int | — |
lanes | Int | — |
viewportWidth | Int | — |
hitboxExtraHeight
static inline function hitboxExtraHeight(height:Int, enabled:Bool):Int
Reserve a positive extra-control strip without creating a zero-height lane.
| Parameter | Type | Default |
|---|---|---|
height | Int | — |
enabled | Bool | — |
anchoredPosition
static inline function anchoredPosition(position:Float, oldSize:Int, newSize:Int, extent:Float):Float
Preserve a button's distance from its nearest edge on a resize.
| Parameter | Type | Default |
|---|---|---|
position | Float | — |
oldSize | Int | — |
newSize | Int | — |
extent | Float | — |