Skip to main content

ScreenLayout

Kindclass
Packagebackend
Full namebackend.ScreenLayout
Sourcesource/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​

NameTypeStaticDefaultNotes
BASE_WIDTHIntyes1280—
BASE_HEIGHTIntyes720—

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.

ParameterTypeDefault
deviceWidthInt—
deviceHeightInt—
widescreenBool—

View source

contentLeft​

static inline function contentLeft(viewportWidth:Int):Float

Left edge of the centered, mod-compatible 1280-pixel gameplay/UI area.

ParameterTypeDefault
viewportWidthInt—

View source

laneStart​

static inline function laneStart(index:Int, lanes:Int, viewportWidth:Int):Int

Contiguous touch lanes covering all pixels, including rounding remainders.

ParameterTypeDefault
indexInt—
lanesInt—
viewportWidthInt—

View source

hitboxExtraHeight​

static inline function hitboxExtraHeight(height:Int, enabled:Bool):Int

Reserve a positive extra-control strip without creating a zero-height lane.

ParameterTypeDefault
heightInt—
enabledBool—

View source

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.

ParameterTypeDefault
positionFloat—
oldSizeInt—
newSizeInt—
extentFloat—

View source