17 lines
478 B
GDScript
17 lines
478 B
GDScript
extends BaseWidgetNode
|
|
class_name AltitudeWidgetNode
|
|
|
|
|
|
var label_node: Label
|
|
var constants: Node
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
super._ready()
|
|
label_node = get_node("Label")
|
|
label_node.text = "0 ft"
|
|
Signals.altitude_updated.connect(_on_altitude_updated)
|
|
|
|
func _on_altitude_updated(sensor_ip: String, altitude_km: float):
|
|
label_node.text = 'Altitude: ' + str(int(round(altitude_km * Constants.M2FT * 1000))) + ' ft'
|