Add process_mode property to PTY

Adds process_mode property to PTY which can be set to IDLE or PHYSICS.
Determines whether the PTY will be updated in the `_process()` or
`_physics_process()` step. Defaults to PHYSICS.
This commit is contained in:
Leroy Hopson 2022-08-06 15:47:17 +12:00
parent 2acb93f8ff
commit 3378e6ff8f
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
7 changed files with 55 additions and 28 deletions

View file

@ -4,7 +4,6 @@ extends "../../terminal.gd"
signal exited(exit_code, signum)
var editor_settings: EditorSettings
var timer := Timer.new()
onready var pty = $PTY
@ -51,20 +50,6 @@ func _ready():
)
_native_terminal._update_theme()
# In editor _process is not called continuously unless the "Update Continuously"
# editor setting is enabled. This setting is disabled by default and uses 100%
# of one core when enabled, so best to leave it off and use a timer instead.
add_child(timer)
timer.wait_time = 0.025
timer.connect("timeout", self, "_poll")
timer.start()
func _poll():
if pty and pty.has_method("get_master"):
pty.get_master().poll()
update()
func _input(event):
if has_focus() and event is InputEventKey and event.is_pressed():