diff --git a/Client.gd b/Client.gd index ff724fd..34edf4e 100644 --- a/Client.gd +++ b/Client.gd @@ -32,10 +32,17 @@ func _closed(was_clean = false): print_debug("Closed. Clean break? ", was_clean) func _connected(protocol = ""): - print_debug("Connected with protocol ", protocol) + print_debug("Connected with protocol: ", protocol) + _client.get_peer(1).put_packet(JSON.print( + {'type': 'test', 'message': "test packet from client"}).to_utf8()) func _on_data_received(): - pass + var json = JSON.parse(_client.get_peer(1).get_packet().get_string_from_utf8()) + var packet = json.result + if typeof(packet) != 18: + push_error("%s is not a dictionary" % [packet]) + get_tree().quit() + print_debug("Got data from server: ", packet) func _process(_delta): _client.poll() diff --git a/Client.tscn b/Client.tscn index d586707..7ddd50f 100644 --- a/Client.tscn +++ b/Client.tscn @@ -23,7 +23,7 @@ size_flags_vertical = 3 margin_right = 236.0 margin_bottom = 14.0 size_flags_horizontal = 3 -size_flags_vertical = 0 +size_flags_vertical = 1 text = "Chatbox" align = 1 diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..c08b47d --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,24 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../Exports/Chat Client.x86_64" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +binary_format/64_bits=true +binary_format/embed_pck=false +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true