mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-14 04:57:19 +01:00
31 lines
869 B
GDScript3
31 lines
869 B
GDScript3
|
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)))
|