Attempted to figure how to adjust notification label size. Nah.

This commit is contained in:
Henry Faber 2026-06-25 01:26:49 +01:00
parent dd4652b732
commit 4f90c82b8f
4 changed files with 15 additions and 19 deletions

View file

@ -11,7 +11,8 @@ icon = NodePath("HBoxContainer/Icon")
label = NodePath("HBoxContainer/Label")
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=228546504]
layout_mode = 0
layout_mode = 1
theme_override_constants/separator = 4
[node name="Icon" type="TextureRect" parent="HBoxContainer" unique_id=3]
custom_minimum_size = Vector2(16, 16)

View file

@ -1,15 +0,0 @@
extends Label
var last_time = 0
var frame_count = 0
var fps = 0
func _process(delta):
frame_count += 1
last_time += delta
if last_time >= 1.0: # Update every second
fps = frame_count
text = " " + str(fps) + " FPS"
last_time = 0
frame_count = 0

View file

@ -1 +0,0 @@
uid://eblemtukrey6

View file

@ -13,7 +13,19 @@ var _connector_line: Line2D = null
var _connector_visible: bool = false
func _ready() -> void:
# Start fully transparent so the initial (0,0) position is invisible.
# This runs during add_child() before any rendering occurs.
modulate.a = 0.0
# 4px horizontal padding inside the background box
_container.add_theme_constant_override("margin_left", 4)
_container.add_theme_constant_override("margin_right", 4)
func show_notification(weapon_name: String, player_node: Node2D, player_sprite_size: Vector2, origin_offset: float) -> void:
modulate.a = 0.0
label.add_theme_font_size_override("font_size", 8)
label.text = weapon_name
@ -40,9 +52,8 @@ func show_notification(weapon_name: String, player_node: Node2D, player_sprite_s
_update_position()
var target_pos = position
# Start 10px above destination, fully transparent
# Start 10px above destination (already transparent from line 17)
position.y = target_pos.y - 10.0
modulate.a = 0.0
# Create connector line immediately so it fades in with the notification
_connector_line = Line2D.new()