godot-steering-ai-framework/project/demos/pursue_vs_seek/GUI.gd

31 lines
869 B
GDScript3
Raw Normal View History

2019-12-21 21:20:06 +01:00
extends MarginContainer
signal linear_speed_changed(value)
signal linear_accel_changed(value)
onready var linear_speed: = $Controls/LinSpeed/LineEdit
onready var linear_accel: = $Controls/LinAccel/LineEdit
func _ready() -> void:
linear_speed.connect("text_changed", self, "_on_LineText_linear_speed_changed")
linear_accel.connect("text_changed", self, "_on_LineText_linear_accel_changed")
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
linear_speed.release_focus()
linear_accel.release_focus()
func _on_LineText_linear_speed_changed(new_text: String) -> void:
if new_text.is_valid_integer():
emit_signal("linear_speed_changed", int(float(new_text)))
func _on_LineText_linear_accel_changed(new_text: String) -> void:
if new_text.is_valid_integer():
emit_signal("linear_accel_changed", int(float(new_text)))