mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-07-09 15:05:32 +02:00
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:
parent
2acb93f8ff
commit
3378e6ff8f
7 changed files with 55 additions and 28 deletions
|
@ -23,6 +23,13 @@ const Signal = _PTYUnix.Signal
|
|||
signal data_received(data)
|
||||
signal exited(exit_code, signum)
|
||||
|
||||
enum ProcessMode {
|
||||
IDLE,
|
||||
PHYSICS,
|
||||
}
|
||||
|
||||
export(ProcessMode) var process_mode := ProcessMode.IDLE
|
||||
|
||||
export(NodePath) var terminal_path := NodePath() setget set_terminal_path
|
||||
|
||||
var _terminal: _Terminal = null setget _set_terminal
|
||||
|
@ -150,6 +157,16 @@ func get_master():
|
|||
return _pty_native.get_master()
|
||||
|
||||
|
||||
func _process(delta: float):
|
||||
if process_mode == ProcessMode.IDLE:
|
||||
_pty_native.run_process(delta)
|
||||
|
||||
|
||||
func _physics_process(delta: float):
|
||||
if process_mode == ProcessMode.PHYSICS:
|
||||
_pty_native.run_process(delta)
|
||||
|
||||
|
||||
func _on_pty_native_data_received(data):
|
||||
emit_signal("data_received", data)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue