Release v0.3: adapt Android layout to wide screens

This commit is contained in:
enne2
2026-09-07 18:34:13 +02:00
parent ea5b2aebbf
commit d0991a0edf
6 changed files with 26 additions and 16 deletions
+2 -2
View File
@@ -75,8 +75,8 @@ architectures/arm64-v8a=true
architectures/armeabi-v7a=true
architectures/x86=false
architectures/x86_64=false
version/code=1
version/name="0.1"
version/code=2
version/name="0.3"
package/unique_name="net.enne2.autgame"
package/name="JuggleBoard"
package/signed=true
@@ -1,7 +1,6 @@
extends Node2D
## Fondale P2B: plancia illustrata, pannello laterale e cinque corsie.
const VIEW := Vector2(1280, 720)
const P2B_BACKGROUND := preload("res://games/juggleboard/assets/p2b/board_background.png")
@@ -11,6 +10,6 @@ func _ready() -> void:
func _draw() -> void:
# L'illustrazione 2B contiene pannello, plancia vuota e alloggiamenti;
# gli elementi dinamici sono aggiunti sopra dal controller e dall'HUD.
draw_texture_rect(P2B_BACKGROUND, Rect2(Vector2.ZERO, VIEW), false)
# L'illustrazione P2B occupa il viewport realmente disponibile: con
# stretch=expand i display 20:9 non ricevono bande laterali.
draw_texture_rect(P2B_BACKGROUND, get_viewport_rect(), false)
+6 -2
View File
@@ -64,10 +64,14 @@ func _unhandled_input(event: InputEvent) -> void:
func _build_balls() -> void:
var names := JuggleBoardConfig.COLORS.keys()
var width_scale := JuggleBoardConfig.horizontal_scale(get_viewport().get_visible_rect().size.x)
for index in range(names.size()):
var color_name: String = names[index]
var home := Vector2(JuggleBoardConfig.HOME_X, JuggleBoardConfig.LANE_TOP + index * JuggleBoardConfig.LANE_GAP)
var left := Vector2(JuggleBoardConfig.LEFT_X, JuggleBoardConfig.LANE_TOP + index * JuggleBoardConfig.LANE_GAP)
var lane_y := JuggleBoardConfig.LANE_TOP + index * JuggleBoardConfig.LANE_GAP
# Il fondale si espande in orizzontale: alloggiamenti e biglie seguono
# la stessa scala X, mentre dimensione e coordinate Y restano invariate.
var home := Vector2(JuggleBoardConfig.HOME_X * width_scale, lane_y)
var left := Vector2(JuggleBoardConfig.LEFT_X * width_scale, lane_y)
var ball: Area2D = BALL_SCRIPT.new()
add_child(ball)
ball.setup(color_name, JuggleBoardConfig.COLORS[color_name], home, left, JuggleBoardConfig.BALL_RADIUS)
@@ -23,6 +23,10 @@ const COLORS := {
"viola": Color("9b7ede"),
}
static func horizontal_scale(viewport_width: float) -> float:
return viewport_width / VIEW.x
const BALL_NOTES := {
"rosso": 261.63,
"blu": 293.66,
+7 -6
View File
@@ -26,25 +26,26 @@ func _ready() -> void:
func _build() -> void:
var ink := Color("#251b17")
var x_scale := JuggleBoardConfig.horizontal_scale(get_viewport().get_visible_rect().size.x)
# Node2D ha pivot locale (0, 0); target_dot disegna l'asset simmetricamente
# intorno a quel pivot, quindi si usa il centro misurato della cornice P2B.
target_dot = TARGET_SCRIPT.new()
target_dot.position = JuggleBoardConfig.TARGET_CENTER
target_dot.position = Vector2(JuggleBoardConfig.TARGET_CENTER.x * x_scale, JuggleBoardConfig.TARGET_CENTER.y)
add_child(target_dot)
back_button = _make_back_button()
add_child(back_button)
score_label = _make_label("", Vector2(112, 520), Vector2(220, 45), 25, ink)
score_label = _make_label("", Vector2(112 * x_scale, 520), Vector2(220 * x_scale, 45), 25, ink)
score_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
score_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
combo_label = _make_label("", Vector2(112, 606), Vector2(220, 45), 24, ink)
combo_label = _make_label("", Vector2(112 * x_scale, 606), Vector2(220 * x_scale, 45), 24, ink)
combo_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
combo_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
hearts = HEARTS_SCRIPT.new()
hearts.position = Vector2(84, 655)
hearts.position = Vector2(84 * x_scale, 655)
hearts.visible = false
add_child(hearts)
@@ -53,7 +54,7 @@ func _build() -> void:
help_label = _make_label("", Vector2.ZERO, Vector2.ZERO, 1, ink)
help_label.visible = false
milestone_label = _make_label("", Vector2(350, 20), Vector2(820, 80), 46, Color("#9e5420"))
milestone_label = _make_label("", Vector2(350 * x_scale, 20), Vector2(820 * x_scale, 80), 46, Color("#9e5420"))
milestone_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
milestone_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
milestone_label.visible = false
@@ -61,7 +62,7 @@ func _build() -> void:
flash = ColorRect.new()
flash.color = Color(1, 0.95, 0.72)
flash.position = Vector2.ZERO
flash.size = JuggleBoardConfig.VIEW
flash.size = get_viewport().get_visible_rect().size
flash.mouse_filter = Control.MOUSE_FILTER_IGNORE
flash.modulate.a = 0.0
flash.visible = false
+4 -2
View File
@@ -21,9 +21,11 @@ Settings="*res://shared/settings/settings.gd"
window/size/viewport_width=1280
window/size/viewport_height=720
window/size/resizable=false
# Edge 60 e altri telefoni moderni sono più larghi di 16:9 in landscape.
# expand usa tutto il display senza deformare né introdurre pillarbox.
window/size/resizable=true
window/stretch/mode="canvas_items"
window/stretch/aspect="keep"
window/stretch/aspect="expand"
window/handheld/orientation=4
[input_devices]