mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-14 06:52:05 +00:00
perf(hud): stop flight instruments redrawing when values have settled
hud_gauge, hud_attitude_indicator, and hud_heading_tape now skip queue_redraw() when the newly-lerped value hasn't moved past a small epsilon, instead of redrawing every frame forever. Angle-wrapping values (heading, attitude roll) use a new shared angle_delta_deg helper on HudInstrument so the wrap boundary doesn't read as a false jump. HUD.tscn's Instruments node now sets process_mode = 1 (PAUSABLE), overriding the inherited ALWAYS mode from the HUD root so instruments stop processing during the post-match pause freeze, while sibling ResultOverlay keeps running its win-screen tween.
This commit is contained in:
@@ -26,8 +26,14 @@ func set_value(value: float) -> void:
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var t := _smoothing_weight(delta)
|
||||
_value = lerpf(_value, _target, t)
|
||||
queue_redraw()
|
||||
var new_value := lerpf(_value, _target, t)
|
||||
# Redraw threshold scales with the gauge's own range so it stays
|
||||
# imperceptible whether this is a 0-12 altitude gauge or a 0-100 thrust
|
||||
# bar, while skipping the redraw once the lerp has visually settled.
|
||||
var changed := absf(new_value - _value) > max_value * 0.001
|
||||
_value = new_value
|
||||
if changed:
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
|
||||
Reference in New Issue
Block a user