Refactor gameplay menus into owned scenes
This commit is contained in:
parent
46196a1adb
commit
a17fe88197
50 changed files with 3449 additions and 3619 deletions
27
ui/menus/MenuLayout.gd
Normal file
27
ui/menus/MenuLayout.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
extends RefCounted
|
||||
|
||||
const HEADER_GAP: float = 16.0
|
||||
const BOTTOM_MARGIN: float = 28.0
|
||||
|
||||
|
||||
static func grid_band(header_bottom: float, panel_height: float) -> Vector2:
|
||||
var half: float = panel_height * 0.5
|
||||
if half <= 0.0:
|
||||
half = 640.0
|
||||
return Vector2(header_bottom + HEADER_GAP - half, half - BOTTOM_MARGIN)
|
||||
|
||||
|
||||
static func grid_row_top(row: int, rows: int, row_height: float, band: Vector2,
|
||||
natural_pitch: float) -> float:
|
||||
var pitch: float = natural_pitch
|
||||
if rows > 1:
|
||||
pitch = minf(pitch, (band.y - band.x - row_height) / float(rows - 1))
|
||||
return band.x + maxf(pitch, row_height) * float(row)
|
||||
|
||||
|
||||
static func place_entry(node: Control, cx: float, top: float, half: float,
|
||||
height: float) -> void:
|
||||
node.offset_left = cx - half
|
||||
node.offset_right = cx + half
|
||||
node.offset_top = top
|
||||
node.offset_bottom = top + height
|
||||
Loading…
Reference in a new issue