From 678a588bc587c4811523ef0df7ce2b6630a2f12e Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 10 May 2026 04:13:28 -0700 Subject: [PATCH] =?UTF-8?q?feat(@projects/@magic-civilization):=20?= =?UTF-8?q?=E2=9C=A8=20add=20zoom=20mode=20support=20for=20demo=20camera?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/game/engine/scenes/tests/full_game_demo_proof.gd | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/engine/scenes/tests/full_game_demo_proof.gd b/src/game/engine/scenes/tests/full_game_demo_proof.gd index c78bada6..10f2d3c3 100644 --- a/src/game/engine/scenes/tests/full_game_demo_proof.gd +++ b/src/game/engine/scenes/tests/full_game_demo_proof.gd @@ -125,12 +125,21 @@ func _ready() -> void: max_p = max_p.max(p) var bbox: Vector2 = max_p - min_p var center: Vector2 = (min_p + max_p) * 0.5 - # Fit the longer axis into the viewport with 5% padding. + # `DEMO_ZOOM_MODE` env: "fit" (whole map, default) or "capital" (zoomed + # to player-1's start hex so unit + city sprites are clearly visible). + var mode: String = OS.get_environment("DEMO_ZOOM_MODE") + if mode == "" : + mode = "fit" var pad: float = 1.10 var fit_x: float = (bbox.x * pad) / float(VIEWPORT_SIZE.x) var fit_y: float = (bbox.y * pad) / float(VIEWPORT_SIZE.y) var world_per_screen: float = max(fit_x, fit_y) var zoom_factor: float = 1.0 / max(world_per_screen, 0.001) + if mode == "capital" and game_map.start_positions.size() > 0: + var p1_axial: Vector2i = game_map.start_positions[0] + center = HexUtilsScript.axial_to_pixel(p1_axial) + # 9-tile wide window around the capital. + zoom_factor = float(VIEWPORT_SIZE.x) / (9.0 * 384.0) var cam: Camera2D = Camera2D.new() cam.name = "DemoCamera" cam.position = center