gd: filehandle

This commit is contained in:
Nordup 2023-05-28 01:55:26 +03:00
parent d7d374c2f3
commit 5ed6c09f68
3 changed files with 10 additions and 10 deletions

View file

@ -1,12 +1,12 @@
extends Resource extends Resource
class_name CommandEvents class_name CommandEvents
signal send_fd signal send_filehandle
signal set_mouse_mode(mode: int) signal set_mouse_mode(mode: int)
func send_fd_emit() -> void: func send_filehandle_emit() -> void:
send_fd.emit() send_filehandle.emit()
func set_mouse_mode_emit(mode: int) -> void: func set_mouse_mode_emit(mode: int) -> void:

View file

@ -16,8 +16,8 @@ func _physics_process(_delta: float) -> void:
func _execute_function(command: Command) -> Variant: func _execute_function(command: Command) -> Variant:
print("Recieved command: " + command.name) print("Recieved command: " + command.name)
match command.name: match command.name:
"send_fd": "send_filehandle":
command_events.send_fd_emit() command_events.send_filehandle_emit()
"set_mouse_mode": "set_mouse_mode":
if command.args.size() != 1: push_error("Arg count should be 1"); return "" if command.args.size() != 1: push_error("Arg count should be 1"); return ""
command_events.set_mouse_mode_emit(command.args[0]) command_events.set_mouse_mode_emit(command.args[0])

View file

@ -16,7 +16,7 @@ var texture_rid: RID
func _ready() -> void: func _ready() -> void:
gate_events.gate_entered.connect(create_external_texture) gate_events.gate_entered.connect(create_external_texture)
command_events.send_fd.connect(send_fd) command_events.send_filehandle.connect(send_filehandle)
initialize() initialize()
@ -47,14 +47,14 @@ func create_external_texture() -> void:
ext_texure = ExternalTexture.new() ext_texure = ExternalTexture.new()
var err = ext_texure.create(t_format, t_view, [image.get_data()]) var err = ext_texure.create(t_format, t_view, [image.get_data()])
if err: Debug.logerr("Cannot create external texture"); return if err: Debug.logerr("Cannot create external texture"); return
else: Debug.logclr("External texture created " + str(ext_texure.get_fd()), Color.AQUAMARINE) else: Debug.logclr("External texture created", Color.AQUAMARINE)
func send_fd() -> void: func send_filehandle() -> void:
print("Sending fd...") print("Sending send_filehandle...")
var sent = false var sent = false
while not sent: while not sent:
sent = ext_texure.send_fd(fd_path) sent = ext_texure.send_filehandle(fd_path)
await get_tree().create_timer(0.1).timeout await get_tree().create_timer(0.1).timeout
print("fd was sent") print("fd was sent")