Improve UI scaling and fishing commerce
This commit is contained in:
parent
2de96dd7bb
commit
6b8c3eb2f7
29 changed files with 1515 additions and 817 deletions
|
|
@ -1,6 +1,15 @@
|
|||
class_name UIReferencePresentation
|
||||
extends RefCounted
|
||||
|
||||
# All functional UI is authored in this coordinate system and receives one
|
||||
# centered, uniform transform at presentation time. Texture source dimensions
|
||||
# describe sampling quality and aspect ratio; a canonical Control rect owns
|
||||
# every texture's on-screen layout size.
|
||||
#
|
||||
# Edge-docked overlays use the same canonical units and uniform scale, but may
|
||||
# use the extra logical canvas outside the centered stage on non-16:9 windows.
|
||||
# This keeps deliberate window-edge attachment without letting individual
|
||||
# controls calculate monitor- or DPI-specific geometry.
|
||||
const REFERENCE_SIZE: Vector2 = Vector2(1280.0, 720.0)
|
||||
|
||||
|
||||
|
|
@ -18,6 +27,14 @@ static func get_offset(display_size: Vector2) -> Vector2:
|
|||
) * 0.5
|
||||
|
||||
|
||||
static func get_visible_reference_size(display_size: Vector2) -> Vector2:
|
||||
return display_size / get_scale(display_size)
|
||||
|
||||
|
||||
static func get_stage_position(display_size: Vector2) -> Vector2:
|
||||
return (get_visible_reference_size(display_size) - REFERENCE_SIZE) * 0.5
|
||||
|
||||
|
||||
static func get_rect(display_size: Vector2) -> Rect2:
|
||||
var presentation_scale: float = get_scale(display_size)
|
||||
return Rect2(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue