godot-steering-ai-framework/project/demos/pursue_vs_seek/GUI.gd
Francois Belair 0e95c24c7f Add GDQuest theme to improved Pursue demo
Changed text boxes to sliders to improve usability. This also involved
adding some simple graphics, since the _draw method is not
anti-aliased and doesn't look great.
2020-01-13 16:15:44 -05:00

39 lines
1.4 KiB
GDScript

extends PanelContainer
signal linear_speed_changed(value)
signal linear_accel_changed(value)
signal angular_speed_changed(value)
signal angular_accel_changed(value)
signal decel_radius_changed(value)
signal predict_time_changed(value)
onready var linear_speed: = $GUI/Controls/LinSpeedBox/MaxLinSpeed
onready var lin_speed_label: = $GUI/Controls/LinSpeedBox/Label
onready var linear_accel: = $GUI/Controls/LinAccelBox/MaxLinAccel
onready var lin_accel_label: = $GUI/Controls/LinAccelBox/Label
onready var predict_time: = $GUI/Controls/PredictTime/PredictTime
onready var predict_time_label: = $GUI/Controls/PredictTime/Label
func _ready() -> void:
linear_speed.connect("value_changed", self, "_on_Slider_linear_speed_changed")
linear_accel.connect("value_changed", self, "_on_Slider_linear_accel_changed")
predict_time.connect("value_changed", self, "_on_Slider_predict_time_changed")
func _on_Slider_linear_speed_changed(value: float) -> void:
lin_speed_label.text = "Max linear speed (" + str(value) + ")"
emit_signal("linear_speed_changed", value)
func _on_Slider_linear_accel_changed(value: float) -> void:
lin_accel_label.text = "Max linear accel (" + str(value) + ")"
emit_signal("linear_accel_changed", value)
func _on_Slider_predict_time_changed(value: float) -> void:
predict_time_label.text = "Predict time (" + str(value) + " sec)"
emit_signal("predict_time_changed", value)