diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-03 10:30:38 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-03 10:30:38 -0300 |
commit | c7d45ec085086ab86192a7890b9622320d57b89d (patch) | |
tree | 0a764a6a2b7bded960a652c81a4b5a6815dd3c31 /demos/misc/udp_chat | |
parent | f9af57f3bdb16e015ee10b979fe18cf2195077f9 (diff) |
Removed demos
they go to their own project now
Diffstat (limited to 'demos/misc/udp_chat')
-rw-r--r-- | demos/misc/udp_chat/chat.gd | 66 | ||||
-rw-r--r-- | demos/misc/udp_chat/chat.scn | bin | 3359 -> 0 bytes | |||
-rw-r--r-- | demos/misc/udp_chat/engine.cfg | 5 | ||||
-rw-r--r-- | demos/misc/udp_chat/icon.png | bin | 2388 -> 0 bytes |
4 files changed, 0 insertions, 71 deletions
diff --git a/demos/misc/udp_chat/chat.gd b/demos/misc/udp_chat/chat.gd deleted file mode 100644 index b60afa9ded..0000000000 --- a/demos/misc/udp_chat/chat.gd +++ /dev/null @@ -1,66 +0,0 @@ - -extends Panel - -# Really simple UDP chat client, not intended as a comprehensive chat implementation. -# (UDP can lose packets and you won't normally find out, so don't do a chat this way) -# This is just a demo that shows how to use the UDP class. - -# Member variables -var udp = PacketPeerUDP.new() - - -func _process(delta): - if (not udp.is_listening()): - return - - while(udp.get_available_packet_count() > 0): - var packet = udp.get_var() - if (typeof(packet) == TYPE_STRING): - var host = udp.get_packet_ip() - var port = udp.get_packet_port() - get_node("chat/text").add_text("(" + host + ":" + str(port) + ":) " + packet) - get_node("chat/text").newline() - - -func _ready(): - get_node("chat").add_style_override("panel", get_stylebox("bg", "Tree")) - set_process(true) - - -func send_message(text): - if (udp.is_listening()): - udp.put_var(text) - - -func _on_connect_toggled(pressed): - if (pressed): - var err = udp.listen(get_node("listen_port").get_val()) - if (err != OK): - get_node("status").set_text("Error:\nCan't listen.") - get_node("connect").set_pressed(false) - else: - get_node("status").set_text("Connected.") - get_node("connect").set_text("Disconnect") - err = udp.set_send_address(get_node("remote_host").get_text(),get_node("remote_port").get_val()) - if (err != OK): - get_node("status").set_text("Error:\nCan't resolve.") - get_node("connect").set_pressed(false) - else: - send_message("* " + get_node("user_name").get_text() + " entered chat.") - else: - udp.close() - get_node("status").set_text("Disconnected.") - get_node("connect").set_text("Connect") - - -func _on_entry_line_text_entered(text): - _on_entry_button_pressed() - - -func _on_entry_button_pressed(): - var msg = get_node("entry_line").get_text() - if (msg == ""): - return - send_message(get_node("user_name").get_text() + "> " + msg) - - get_node("entry_line").set_text("") diff --git a/demos/misc/udp_chat/chat.scn b/demos/misc/udp_chat/chat.scn Binary files differdeleted file mode 100644 index fe38e9da72..0000000000 --- a/demos/misc/udp_chat/chat.scn +++ /dev/null diff --git a/demos/misc/udp_chat/engine.cfg b/demos/misc/udp_chat/engine.cfg deleted file mode 100644 index 584841ea83..0000000000 --- a/demos/misc/udp_chat/engine.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] - -name="UDP Chat" -main_scene="res://chat.scn" -icon="res://icon.png" diff --git a/demos/misc/udp_chat/icon.png b/demos/misc/udp_chat/icon.png Binary files differdeleted file mode 100644 index db6e21cce1..0000000000 --- a/demos/misc/udp_chat/icon.png +++ /dev/null |