mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-23 14:46:32 +01:00
Todo: 3a5477b9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
883 B
GDScript
28 lines
883 B
GDScript
extends Control
|
|
## Demo: a token-coloured screen with the credit in the bottom-right corner.
|
|
## Run with `godot --path kuhy_credit/godot` (add `-- --light` for light).
|
|
|
|
const CreditData = preload("res://addons/kuhy_credit/credit_data.gd")
|
|
const CreditScene = preload("res://addons/kuhy_credit/kuhy_credit.tscn")
|
|
|
|
var credit: Control
|
|
|
|
|
|
func _ready() -> void:
|
|
var is_light := OS.get_cmdline_user_args().has("--light")
|
|
var bg := ColorRect.new()
|
|
bg.color = (CreditData.LIGHT if is_light else CreditData.DARK)["bg"]
|
|
bg.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
bg.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
add_child(bg)
|
|
credit = CreditScene.instantiate()
|
|
credit.light = is_light
|
|
add_child(credit)
|
|
_place()
|
|
resized.connect(_place)
|
|
|
|
|
|
func _place() -> void:
|
|
var margin := float(CreditData.SPACE_MD)
|
|
credit.position = size - credit.size - Vector2(margin, margin)
|