ext_texture_format and first_frame_drawn for swapchaing copying

This commit is contained in:
Nordup 2024-07-13 06:14:03 +04:00
parent 644a8bb969
commit 78ad658f06
7 changed files with 151 additions and 49 deletions

View file

@ -17,15 +17,37 @@ func _execute_function(command: Command) -> Variant:
Debug.logclr("Recieved command: " + command.name + ". Args: " + str(command.args), Color.SANDY_BROWN)
match command.name:
"send_filehandle":
if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return ""
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
command_events.send_filehandle_emit(command.args[0])
"ext_texture_format":
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
command_events.ext_texture_format_emit(command.args[0])
"first_frame_drawn":
if wrong_args_count(command, 0): return ERR_INVALID_PARAMETER
command_events.first_frame_drawn_emit()
"set_mouse_mode":
if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return ""
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
command_events.set_mouse_mode_emit(command.args[0])
"open_gate":
if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return ""
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
var url = Url.join(gate_events.current_gate_url, command.args[0])
gate_events.open_gate_emit(url)
_:
Debug.logerr("Command %s not implemented" % [command.name])
return ""
return ERR_METHOD_NOT_FOUND
return OK
func wrong_args_count(command: Command, right_count: int) -> bool:
var count = command.args.size()
if count != right_count:
Debug.logerr("Command %s args count should be %d but it's %d" % [command.name, right_count, count])
return true
return false