51 lines
2.3 KiB
GDScript
51 lines
2.3 KiB
GDScript
extends Node
|
|
|
|
func settle() -> void:
|
|
for frame in 12: await get_tree().process_frame
|
|
|
|
func _ready() -> void:
|
|
GameState.start_new_run()
|
|
var game := preload("res://scenes/game/game.tscn").instantiate()
|
|
add_child(game)
|
|
game.set_physics_process(false)
|
|
game.player.set_physics_process(false)
|
|
game.player.get_node("WeaponController").set_physics_process(false)
|
|
for enemy in get_tree().get_nodes_in_group("enemies"):
|
|
enemy.set_physics_process(false)
|
|
enemy.apply_level_settings(120, 2)
|
|
enemy.max_shields = 999999
|
|
enemy.shields = 999999
|
|
var hud := game.get_node("HUD")
|
|
var cockpit = hud._cockpit
|
|
cockpit._inventory.ammunition = 999999
|
|
cockpit._inventory.irradiated_ammunition = 999999
|
|
cockpit._inventory.missile_ammunition = 999999
|
|
game.player.absorption = Vector3(20, 20, 20)
|
|
for resolution in [Vector2i(1280, 720), Vector2i(960, 540), Vector2i(800, 600)]:
|
|
get_window().size = resolution
|
|
await settle()
|
|
hud._layout_sidebar()
|
|
await settle()
|
|
var rect: Rect2 = cockpit.get_global_rect()
|
|
assert(rect.position.x >= 0 and rect.position.y >= 0)
|
|
assert(rect.end.x <= hud.get_node("HUDRoot").size.x + 1)
|
|
assert(rect.end.y <= hud.get_node("HUDRoot").size.y + 1)
|
|
var detail = cockpit._enemy_details
|
|
assert(cockpit.SCREENS[2].encloses(Rect2(detail.position, detail.size)))
|
|
var label: Label = detail._label
|
|
assert(label.get_combined_minimum_size().y <= detail.size.y)
|
|
var font := label.get_theme_font("font")
|
|
for line in label.text.split("\n"):
|
|
assert(font.get_string_size(line, HORIZONTAL_ALIGNMENT_LEFT, -1, 8).x <= detail.size.x)
|
|
for sample in ["ZWYKŁE 999999", "GAMMA 999999", "999999", "PRĘDKOŚĆ: 999999", "DPS: 999999.9"]:
|
|
var width := 100.0 if sample == "999999" else 145.0
|
|
var fitted: int = cockpit.fitted_font_size(sample, width, 19)
|
|
assert(cockpit.FONT.get_string_size(sample, HORIZONTAL_ALIGNMENT_LEFT, -1, fitted).x <= width)
|
|
await RenderingServer.frame_post_draw
|
|
var image := get_viewport().get_texture().get_image()
|
|
image.save_png("res://artifacts/cockpit_console_%dx%d.png" % [resolution.x, resolution.y])
|
|
if resolution.x == 1280:
|
|
image.get_region(Rect2i(rect.grow(4))).save_png("res://artifacts/cockpit_console_review.png")
|
|
print("COCKPIT_CONSOLE_REVIEW_OK: 1280x720, 960x540, 800x600; screen bounds, six-digit counters, boss details and full text")
|
|
get_tree().quit()
|