summaryrefslogtreecommitdiff
path: root/demos/misc
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2015-12-09 08:38:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2015-12-09 08:38:23 +0100
commit8639cecf4cedd56452b47503be19c44b304cd02f (patch)
treee2a795da15e40c7d9d5b82e33378f8dbf0eaf67a /demos/misc
parentefbb834936fdc9da9789ad37c9cc61e0b90cda95 (diff)
Improve code formatting and update to 2.0
The scripts were streamlined using more or less the following conventions: - space after a comma in lists of arguments - space around weak operators (+, -), no space around strong operators (*, /) - space after a comment start (#) - removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now) - function blocks separate by two newlines The scene files were resaved with the (current) 2.0 format, and some scenes that were in XML format were converted to SCN, to be consistent across all demos.
Diffstat (limited to 'demos/misc')
-rw-r--r--demos/misc/autoload/global.gd20
-rw-r--r--demos/misc/autoload/scene_a.gd3
-rw-r--r--demos/misc/autoload/scene_a.scnbin1459 -> 1660 bytes
-rw-r--r--demos/misc/autoload/scene_b.gd3
-rw-r--r--demos/misc/autoload/scene_b.scnbin1448 -> 1639 bytes
-rw-r--r--demos/misc/instancing/ball.scnbin1563 -> 1885 bytes
-rw-r--r--demos/misc/instancing/container.scnbin2312 -> 3137 bytes
-rw-r--r--demos/misc/joysticks/joysticks.gd31
-rw-r--r--demos/misc/joysticks/joysticks.scnbin3809 -> 4016 bytes
-rw-r--r--demos/misc/pause/spinpause.gd2
-rw-r--r--demos/misc/pause/spinpause.scnbin3331 -> 5399 bytes
-rw-r--r--demos/misc/regex/regex.gd6
-rw-r--r--demos/misc/regex/regex.scnbin1793 -> 1775 bytes
-rw-r--r--demos/misc/scene_changer/scene_a.gd3
-rw-r--r--demos/misc/scene_changer/scene_a.scnbin1459 -> 1660 bytes
-rw-r--r--demos/misc/scene_changer/scene_b.gd3
-rw-r--r--demos/misc/scene_changer/scene_b.scnbin1448 -> 1639 bytes
-rw-r--r--demos/misc/threads/thread.gd26
-rw-r--r--demos/misc/threads/thread.scnbin1638 -> 1586 bytes
-rw-r--r--demos/misc/tween/engine.cfg2
-rw-r--r--demos/misc/tween/main.gd53
-rw-r--r--demos/misc/tween/main.scnbin0 -> 5216 bytes
-rw-r--r--demos/misc/tween/main.xml367
-rw-r--r--demos/misc/udp_chat/chat.gd45
-rw-r--r--demos/misc/udp_chat/chat.scnbin3198 -> 3359 bytes
-rw-r--r--demos/misc/window_management/control.gd85
-rw-r--r--demos/misc/window_management/observer/observer.gd29
-rw-r--r--demos/misc/window_management/observer/observer.scnbin1786 -> 3824 bytes
-rw-r--r--demos/misc/window_management/window_management.scnbin5132 -> 4384 bytes
29 files changed, 153 insertions, 525 deletions
diff --git a/demos/misc/autoload/global.gd b/demos/misc/autoload/global.gd
index d1bd45461f..126cbc0ab7 100644
--- a/demos/misc/autoload/global.gd
+++ b/demos/misc/autoload/global.gd
@@ -1,35 +1,33 @@
extends Node
-
+# member variables
var current_scene = null
func goto_scene(path):
-
# This function will usually be called from a signal callback,
# or some other function from the running scene.
# Deleting the current scene at this point might be
# a bad idea, because it may be inside of a callback or function of it.
# The worst case will be a crash or unexpected behavior.
-
+
# The way around this is deferring the load to a later time, when
# it is ensured that no code from the current scene is running:
-
+
call_deferred("_deferred_goto_scene",path)
func _deferred_goto_scene(path):
-
# Immediately free the current scene,
- # there is no risk here.
+ # there is no risk here.
current_scene.free()
-
+
# Load new scene
var s = ResourceLoader.load(path)
-
+
# Instance the new scene
current_scene = s.instance()
-
+
# Add it to the active scene, as child of root
get_tree().get_root().add_child(current_scene)
@@ -38,6 +36,6 @@ func _ready():
# Get the current scene, the first time.
# it is always the last child of root,
# after the autoloaded nodes.
-
+
var root = get_tree().get_root()
- current_scene = root.get_child( root.get_child_count() -1 )
+ current_scene = root.get_child(root.get_child_count() - 1)
diff --git a/demos/misc/autoload/scene_a.gd b/demos/misc/autoload/scene_a.gd
index 21a6a84eb9..b95ce7dc6e 100644
--- a/demos/misc/autoload/scene_a.gd
+++ b/demos/misc/autoload/scene_a.gd
@@ -5,13 +5,12 @@ extends Panel
# var a=2
# var b="textvar"
+
func _ready():
# Initalization here
pass
-
-
func _on_goto_scene_pressed():
get_node("/root/global").goto_scene("res://scene_b.scn")
pass # replace with function body
diff --git a/demos/misc/autoload/scene_a.scn b/demos/misc/autoload/scene_a.scn
index 61727a57ba..eff314e29d 100644
--- a/demos/misc/autoload/scene_a.scn
+++ b/demos/misc/autoload/scene_a.scn
Binary files differ
diff --git a/demos/misc/autoload/scene_b.gd b/demos/misc/autoload/scene_b.gd
index 4a88fddda9..599058848b 100644
--- a/demos/misc/autoload/scene_b.gd
+++ b/demos/misc/autoload/scene_b.gd
@@ -5,13 +5,12 @@ extends Panel
# var a=2
# var b="textvar"
+
func _ready():
# Initalization here
pass
-
-
func _on_goto_scene_pressed():
get_node("/root/global").goto_scene("res://scene_a.scn")
pass # replace with function body
diff --git a/demos/misc/autoload/scene_b.scn b/demos/misc/autoload/scene_b.scn
index ae09eeff88..4cdb03e90e 100644
--- a/demos/misc/autoload/scene_b.scn
+++ b/demos/misc/autoload/scene_b.scn
Binary files differ
diff --git a/demos/misc/instancing/ball.scn b/demos/misc/instancing/ball.scn
index 81c222a306..4d6367885e 100644
--- a/demos/misc/instancing/ball.scn
+++ b/demos/misc/instancing/ball.scn
Binary files differ
diff --git a/demos/misc/instancing/container.scn b/demos/misc/instancing/container.scn
index 9a365ac494..0f65daa2ca 100644
--- a/demos/misc/instancing/container.scn
+++ b/demos/misc/instancing/container.scn
Binary files differ
diff --git a/demos/misc/joysticks/joysticks.gd b/demos/misc/joysticks/joysticks.gd
index d359e993e6..dc9166e49e 100644
--- a/demos/misc/joysticks/joysticks.gd
+++ b/demos/misc/joysticks/joysticks.gd
@@ -8,33 +8,36 @@ extends Node2D
#
# Licensed under the MIT license
+# member variables
var joy_num
var cur_joy
var axis_value
var btn_state
-func _ready():
- set_process_input(true)
-func _input(ev):
+func _input(event):
# get the joystick device number from the spinbox
joy_num = get_node("joy_num").get_value()
-
+
# display the name of the joystick if we haven't already
if joy_num != cur_joy:
cur_joy = joy_num
- get_node("joy_name").set_text( Input.get_joy_name(joy_num) )
-
+ get_node("joy_name").set_text(Input.get_joy_name(joy_num))
+
# loop through the axes and show their current values
- for axis in range(0,8):
- axis_value = Input.get_joy_axis(joy_num,axis)
- get_node("axis_prog"+str(axis)).set_value(100*axis_value)
- get_node("axis_val"+str(axis)).set_text(str(axis_value))
-
+ for axis in range(0, 8):
+ axis_value = Input.get_joy_axis(joy_num, axis)
+ get_node("axis_prog" + str(axis)).set_value(100*axis_value)
+ get_node("axis_val" + str(axis)).set_text(str(axis_value))
+
# loop through the buttons and highlight the ones that are pressed
- for btn in range(0,17):
+ for btn in range(0, 17):
btn_state = 1
if (Input.is_joy_button_pressed(joy_num, btn)):
- get_node("btn"+str(btn)).add_color_override("font_color",Color(1,1,1,1))
+ get_node("btn" + str(btn)).add_color_override("font_color", Color(1, 1, 1, 1))
else:
- get_node("btn"+str(btn)).add_color_override("font_color",Color(0.2,0.1,0.3,1))
+ get_node("btn" + str(btn)).add_color_override("font_color", Color(0.2, 0.1, 0.3, 1))
+
+
+func _ready():
+ set_process_input(true)
diff --git a/demos/misc/joysticks/joysticks.scn b/demos/misc/joysticks/joysticks.scn
index 5dbd7f49bf..b78bccbf33 100644
--- a/demos/misc/joysticks/joysticks.scn
+++ b/demos/misc/joysticks/joysticks.scn
Binary files differ
diff --git a/demos/misc/pause/spinpause.gd b/demos/misc/pause/spinpause.gd
index 1b8f8388f0..ea5617c06f 100644
--- a/demos/misc/pause/spinpause.gd
+++ b/demos/misc/pause/spinpause.gd
@@ -11,5 +11,3 @@ func _on_pause_pressed():
func _on_unpause_pressed():
get_node("pause_popup").hide()
get_tree().set_pause(false)
-
-
diff --git a/demos/misc/pause/spinpause.scn b/demos/misc/pause/spinpause.scn
index a3835c4374..2cbe85ec9a 100644
--- a/demos/misc/pause/spinpause.scn
+++ b/demos/misc/pause/spinpause.scn
Binary files differ
diff --git a/demos/misc/regex/regex.gd b/demos/misc/regex/regex.gd
index 409b4cab05..4921f4ff2e 100644
--- a/demos/misc/regex/regex.gd
+++ b/demos/misc/regex/regex.gd
@@ -1,11 +1,15 @@
+
extends VBoxContainer
+# member variables
var regex = RegEx.new()
+
func update_expression(text):
regex.compile(text)
update_text()
+
func update_text():
var text = get_node("Text").get_text()
var list = get_node("List")
@@ -18,7 +22,7 @@ func update_text():
label.set_text(res)
list.add_child(label)
+
func _ready():
get_node("Text").set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
update_expression(get_node("Expression").get_text())
-
diff --git a/demos/misc/regex/regex.scn b/demos/misc/regex/regex.scn
index 1f46521d0d..debd55504f 100644
--- a/demos/misc/regex/regex.scn
+++ b/demos/misc/regex/regex.scn
Binary files differ
diff --git a/demos/misc/scene_changer/scene_a.gd b/demos/misc/scene_changer/scene_a.gd
index 956878b0f7..e27c48cf11 100644
--- a/demos/misc/scene_changer/scene_a.gd
+++ b/demos/misc/scene_changer/scene_a.gd
@@ -5,13 +5,12 @@ extends Panel
# var a=2
# var b="textvar"
+
func _ready():
# Initalization here
pass
-
-
func _on_goto_scene_pressed():
get_tree().change_scene("res://scene_b.scn")
pass # replace with function body
diff --git a/demos/misc/scene_changer/scene_a.scn b/demos/misc/scene_changer/scene_a.scn
index 61727a57ba..9a4b6434be 100644
--- a/demos/misc/scene_changer/scene_a.scn
+++ b/demos/misc/scene_changer/scene_a.scn
Binary files differ
diff --git a/demos/misc/scene_changer/scene_b.gd b/demos/misc/scene_changer/scene_b.gd
index 4f94d6bb8f..b785ada45c 100644
--- a/demos/misc/scene_changer/scene_b.gd
+++ b/demos/misc/scene_changer/scene_b.gd
@@ -5,13 +5,12 @@ extends Panel
# var a=2
# var b="textvar"
+
func _ready():
# Initalization here
pass
-
-
func _on_goto_scene_pressed():
get_tree().change_scene("res://scene_a.scn")
pass # replace with function body
diff --git a/demos/misc/scene_changer/scene_b.scn b/demos/misc/scene_changer/scene_b.scn
index ae09eeff88..4cdb03e90e 100644
--- a/demos/misc/scene_changer/scene_b.scn
+++ b/demos/misc/scene_changer/scene_b.scn
Binary files differ
diff --git a/demos/misc/threads/thread.gd b/demos/misc/threads/thread.gd
index 7d8aabd1b7..fbfd68af2b 100644
--- a/demos/misc/threads/thread.gd
+++ b/demos/misc/threads/thread.gd
@@ -1,31 +1,31 @@
extends Node2D
-# member variables here, example:
-# var a=2
-# var b="textvar"
-
+# member variables
var thread = Thread.new()
-#this function runs in a thread!
-#threads always take one userdata argument
+
+# this function runs in a thread!
+# threads always take one userdata argument
func _bg_load(path):
print("THREAD FUNC!")
- #load the resource
+ # load the resource
var tex = ResourceLoader.load(path)
- #call _bg_load_done on main thread
+ # call _bg_load_done on main thread
call_deferred("_bg_load_done")
- return tex #return it
+ return tex # return it
+
func _bg_load_done():
- #wait for the thread to complete, get the returned value
+ # wait for the thread to complete, get the returned value
var tex = thread.wait_to_finish()
- #set to the sprite
+ # set to the sprite
get_node("sprite").set_texture(tex)
+
func _on_load_pressed():
if (thread.is_active()):
- #already working
+ # already working
return
print("START THREAD!")
- thread.start(self,"_bg_load","res://mona.png")
+ thread.start(self, "_bg_load", "res://mona.png")
diff --git a/demos/misc/threads/thread.scn b/demos/misc/threads/thread.scn
index 349127529a..eea93615c7 100644
--- a/demos/misc/threads/thread.scn
+++ b/demos/misc/threads/thread.scn
Binary files differ
diff --git a/demos/misc/tween/engine.cfg b/demos/misc/tween/engine.cfg
index 3d3d639964..1d87303015 100644
--- a/demos/misc/tween/engine.cfg
+++ b/demos/misc/tween/engine.cfg
@@ -1,7 +1,7 @@
[application]
name="Tween Demo"
-main_scene="res://main.xml"
+main_scene="res://main.scn"
icon="res://icon.png"
target_fps=60
diff --git a/demos/misc/tween/main.gd b/demos/misc/tween/main.gd
index a0106a7682..4d37c18ba9 100644
--- a/demos/misc/tween/main.gd
+++ b/demos/misc/tween/main.gd
@@ -1,10 +1,7 @@
extends Control
-# member variables here, example:
-# var a=2
-# var b="textvar"
-
+# member variables
var trans = ["linear", "sine", "quint", "quart", "quad", "expo", "elastic", "cubic", "circ", "bounce", "back"]
var eases = ["in", "out", "in_out", "out_in"]
var modes = ["move", "color", "scale", "rotate", "callback", "follow", "repeat", "pause"]
@@ -14,6 +11,7 @@ var state = {
eases = Tween.EASE_IN,
}
+
func _ready():
for index in range(trans.size()):
var name = trans[index]
@@ -39,9 +37,7 @@ func _ready():
get_node("modes/repeat").set_pressed(true)
reset_tween()
-
- # Initalization here
- pass
+
func on_trans_changed(name, index):
for index in range(trans.size()):
@@ -53,7 +49,8 @@ func on_trans_changed(name, index):
state.trans = index
reset_tween()
-
+
+
func on_eases_changed(name, index):
for index in range(eases.size()):
var pressed = eases[index] == name
@@ -64,7 +61,8 @@ func on_eases_changed(name, index):
state.eases = index
reset_tween()
-
+
+
func on_modes_changed(name):
var tween = get_node("tween")
if name == "pause":
@@ -76,10 +74,12 @@ func on_modes_changed(name):
get_node("timeline").set_ignore_mouse(true)
else:
reset_tween()
-
+
+
func on_color_changed(color):
reset_tween()
-
+
+
func reset_tween():
var tween = get_node("tween")
var pos = tween.tell()
@@ -92,20 +92,20 @@ func reset_tween():
var size = get_node("tween/area").get_size()
if get_node("modes/move").is_pressed():
- tween.interpolate_method(sprite, "set_pos", Vector2(0,0), Vector2(size.width, size.height), 2, state.trans, state.eases)
- tween.interpolate_property(sprite, "transform/pos", Vector2(size.width,size.height), Vector2(0, 0), 2, state.trans, state.eases, 2)
+ tween.interpolate_method(sprite, "set_pos", Vector2(0, 0), Vector2(size.width, size.height), 2, state.trans, state.eases)
+ tween.interpolate_property(sprite, "transform/pos", Vector2(size.width, size.height), Vector2(0, 0), 2, state.trans, state.eases, 2)
if get_node("modes/color").is_pressed():
tween.interpolate_method(sprite, "set_modulate", get_node("color/color_from").get_color(), get_node("color/color_to").get_color(), 2, state.trans, state.eases)
tween.interpolate_property(sprite, "modulate", get_node("color/color_to").get_color(), get_node("color/color_from").get_color(), 2, state.trans, state.eases, 2)
else:
- sprite.set_modulate(Color(1, 1, 1, 1))
+ sprite.set_modulate(Color(1,1,1,1))
if get_node("modes/scale").is_pressed():
- tween.interpolate_method(sprite, "set_scale", Vector2(0.5,0.5), Vector2(1.5, 1.5), 2, state.trans, state.eases)
- tween.interpolate_property(sprite, "transform/scale", Vector2(1.5,1.5), Vector2(0.5, 0.5), 2, state.trans, state.eases, 2)
+ tween.interpolate_method(sprite, "set_scale", Vector2(0.5, 0.5), Vector2(1.5, 1.5), 2, state.trans, state.eases)
+ tween.interpolate_property(sprite, "transform/scale", Vector2(1.5, 1.5), Vector2(0.5, 0.5), 2, state.trans, state.eases, 2)
else:
- sprite.set_scale(Vector2(1, 1))
+ sprite.set_scale(Vector2(1,1))
if get_node("modes/rotate").is_pressed():
tween.interpolate_method(sprite, "_set_rotd", 0, 360, 2, state.trans, state.eases)
@@ -139,26 +139,27 @@ func reset_tween():
else:
tween.resume_all()
get_node("timeline").set_ignore_mouse(true)
-
-func _on_tween_step( object, key, elapsed, value ):
- var timeline = get_node("timeline")
+func _on_tween_step(object, key, elapsed, value):
+ var timeline = get_node("timeline")
+
var tween = get_node("tween")
var runtime = tween.get_runtime()
-
- var ratio = 100 * (elapsed / runtime)
- timeline.set_value(ratio)
+ var ratio = 100*(elapsed/runtime)
+ timeline.set_value(ratio)
+
-func _on_timeline_value_changed( value ):
+func _on_timeline_value_changed(value):
if !get_node("modes/pause").is_pressed():
return
var tween = get_node("tween")
var runtime = tween.get_runtime()
- tween.seek(runtime * value / 100)
-
+ tween.seek(runtime*value/100)
+
+
func on_callback(arg):
var label = get_node("tween/area/label")
label.add_text("on_callback -> " + arg + "\n")
diff --git a/demos/misc/tween/main.scn b/demos/misc/tween/main.scn
new file mode 100644
index 0000000000..3f25bfd75c
--- /dev/null
+++ b/demos/misc/tween/main.scn
Binary files differ
diff --git a/demos/misc/tween/main.xml b/demos/misc/tween/main.xml
deleted file mode 100644
index 6580ba04da..0000000000
--- a/demos/misc/tween/main.xml
+++ /dev/null
@@ -1,367 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<resource_file type="PackedScene" subresource_count="3" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
- <ext_resource path="res://icon.png" type="Texture"></ext_resource>
- <ext_resource path="res://main.gd" type="Script"></ext_resource>
- <main_resource>
- <dictionary name="_bundled" shared="false">
- <string> "names" </string>
- <string_array len="115">
- <string> "main" </string>
- <string> "Control" </string>
- <string> "_import_path" </string>
- <string> "visibility/visible" </string>
- <string> "visibility/opacity" </string>
- <string> "visibility/self_opacity" </string>
- <string> "visibility/behind_parent" </string>
- <string> "margin/right" </string>
- <string> "margin/bottom" </string>
- <string> "transform/rot" </string>
- <string> "transform/scale" </string>
- <string> "focus_neighbour/left" </string>
- <string> "focus_neighbour/top" </string>
- <string> "focus_neighbour/right" </string>
- <string> "focus_neighbour/bottom" </string>
- <string> "focus/ignore_mouse" </string>
- <string> "focus/stop_mouse" </string>
- <string> "size_flags/horizontal" </string>
- <string> "size_flags/vertical" </string>
- <string> "size_flags/stretch_ratio" </string>
- <string> "script/script" </string>
- <string> "__meta__" </string>
- <string> "trans" </string>
- <string> "VBoxContainer" </string>
- <string> "margin/left" </string>
- <string> "margin/top" </string>
- <string> "linear" </string>
- <string> "Button" </string>
- <string> "disabled" </string>
- <string> "pressed" </string>
- <string> "toggle_mode" </string>
- <string> "click_on_press" </string>
- <string> "text" </string>
- <string> "icon" </string>
- <string> "flat" </string>
- <string> "clip_text" </string>
- <string> "align" </string>
- <string> "sine" </string>
- <string> "quint" </string>
- <string> "quart" </string>
- <string> "quad" </string>
- <string> "expo" </string>
- <string> "elastic" </string>
- <string> "cubic" </string>
- <string> "circ" </string>
- <string> "bounce" </string>
- <string> "back" </string>
- <string> "eases" </string>
- <string> "in" </string>
- <string> "out" </string>
- <string> "in_out" </string>
- <string> "out_in" </string>
- <string> "modes" </string>
- <string> "move" </string>
- <string> "color" </string>
- <string> "scale" </string>
- <string> "rotate" </string>
- <string> "callback" </string>
- <string> "follow" </string>
- <string> "repeat" </string>
- <string> "pause" </string>
- <string> "label_1" </string>
- <string> "Label" </string>
- <string> "range/min" </string>
- <string> "range/max" </string>
- <string> "range/step" </string>
- <string> "range/page" </string>
- <string> "range/value" </string>
- <string> "range/exp_edit" </string>
- <string> "rounded_values" </string>
- <string> "valign" </string>
- <string> "autowrap" </string>
- <string> "uppercase" </string>
- <string> "percent_visible" </string>
- <string> "color_from" </string>
- <string> "ColorPicker" </string>
- <string> "label_2" </string>
- <string> "color_to" </string>
- <string> "tween" </string>
- <string> "Tween" </string>
- <string> "playback/process_mode" </string>
- <string> "playback/active" </string>
- <string> "playback/repeat" </string>
- <string> "playback/speed" </string>
- <string> "area" </string>
- <string> "Panel" </string>
- <string> "label" </string>
- <string> "RichTextLabel" </string>
- <string> "scroll_active" </string>
- <string> "scroll_follow" </string>
- <string> "tab_size" </string>
- <string> "selection_enabled" </string>
- <string> "sprite" </string>
- <string> "Sprite" </string>
- <string> "transform/pos" </string>
- <string> "texture" </string>
- <string> "centered" </string>
- <string> "offset" </string>
- <string> "flip_h" </string>
- <string> "flip_v" </string>
- <string> "vframes" </string>
- <string> "hframes" </string>
- <string> "frame" </string>
- <string> "modulate" </string>
- <string> "region" </string>
- <string> "region_rect" </string>
- <string> "follow_2" </string>
- <string> "timeline" </string>
- <string> "HSlider" </string>
- <string> "tick_count" </string>
- <string> "ticks_on_borders" </string>
- <string> "_on_tween_step" </string>
- <string> "tween_step" </string>
- <string> "_on_timeline_value_changed" </string>
- <string> "value_changed" </string>
- </string_array>
- <string> "version" </string>
- <int> 1 </int>
- <string> "conn_count" </string>
- <int> 2 </int>
- <string> "node_count" </string>
- <int> 39 </int>
- <string> "variants" </string>
- <array len="104" shared="false">
- <node_path> "" </node_path>
- <bool> True </bool>
- <real> 1 </real>
- <bool> False </bool>
- <real> 800 </real>
- <real> 600 </real>
- <real> 0 </real>
- <vector2> 1, 1 </vector2>
- <int> 2 </int>
- <resource resource_type="Script" path="res://main.gd"> </resource>
- <dictionary shared="false">
- <string> "__editor_plugin_states__" </string>
- <dictionary shared="false">
- <string> "Script" </string>
- <dictionary shared="false">
- <string> "current" </string>
- <int> 0 </int>
- <string> "sources" </string>
- <array len="1" shared="false">
- <string> "res://main.gd" </string>
- </array>
- </dictionary>
- <string> "2D" </string>
- <dictionary shared="false">
- <string> "pixel_snap" </string>
- <bool> False </bool>
- <string> "zoom" </string>
- <real> 1.360374 </real>
- <string> "use_snap" </string>
- <bool> True </bool>
- <string> "ofs" </string>
- <vector2> -215.073, -20.8125 </vector2>
- <string> "snap" </string>
- <int> 8 </int>
- </dictionary>
- <string> "3D" </string>
- <dictionary shared="false">
- <string> "zfar" </string>
- <real> 500 </real>
- <string> "fov" </string>
- <real> 45 </real>
- <string> "viewports" </string>
- <array len="4" shared="false">
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- </dictionary>
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- </dictionary>
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- </dictionary>
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- </dictionary>
- </array>
- <string> "viewport_mode" </string>
- <int> 1 </int>
- <string> "default_light" </string>
- <bool> True </bool>
- <string> "show_grid" </string>
- <bool> True </bool>
- <string> "show_origin" </string>
- <bool> True </bool>
- <string> "znear" </string>
- <real> 0.1 </real>
- </dictionary>
- </dictionary>
- <string> "__editor_run_settings__" </string>
- <dictionary shared="false">
- <string> "custom_args" </string>
- <string> "-l $scene" </string>
- <string> "run_mode" </string>
- <int> 0 </int>
- </dictionary>
- <string> "__editor_plugin_screen__" </string>
- <string> "Script" </string>
- </dictionary>
- <real> 56 </real>
- <real> 256 </real>
- <real> 129 </real>
- <real> 582 </real>
- <dictionary shared="false">
- <string> "_editor_collapsed" </string>
- <bool> True </bool>
- </dictionary>
- <real> 73 </real>
- <real> 26 </real>
- <string> "linear" </string>
- <resource name=""></resource> <int> 1 </int>
- <real> 30 </real>
- <string> "sine" </string>
- <real> 60 </real>
- <real> 86 </real>
- <string> "quint" </string>
- <real> 90 </real>
- <real> 116 </real>
- <string> "quart" </string>
- <real> 120 </real>
- <real> 146 </real>
- <string> "quad" </string>
- <real> 150 </real>
- <real> 176 </real>
- <string> "expo" </string>
- <real> 180 </real>
- <real> 206 </real>
- <string> "elastic" </string>
- <real> 210 </real>
- <real> 236 </real>
- <string> "cubic" </string>
- <real> 240 </real>
- <real> 266 </real>
- <string> "circ" </string>
- <real> 270 </real>
- <real> 296 </real>
- <string> "bounce" </string>
- <real> 300 </real>
- <real> 326 </real>
- <string> "back" </string>
- <real> 152 </real>
- <real> 215 </real>
- <real> 372 </real>
- <dictionary shared="false">
- <string> "_editor_collapsed" </string>
- <bool> True </bool>
- </dictionary>
- <real> 63 </real>
- <string> "in" </string>
- <string> "out" </string>
- <string> "in_out" </string>
- <string> "out_in" </string>
- <real> 317 </real>
- <real> 492 </real>
- <dictionary shared="false">
- <string> "_editor_collapsed" </string>
- <bool> True </bool>
- </dictionary>
- <real> 77 </real>
- <string> "move" </string>
- <string> "color" </string>
- <string> "scale" </string>
- <string> "rotate" </string>
- <string> "callback" </string>
- <string> "follow" </string>
- <string> "repeat" </string>
- <string> "pause" </string>
- <real> 384 </real>
- <real> 760 </real>
- <real> 592 </real>
- <dictionary shared="false">
- <string> "_editor_collapsed" </string>
- <bool> True </bool>
- </dictionary>
- <real> 376 </real>
- <real> 19 </real>
- <string> "Color From:" </string>
- <int> 0 </int>
- <real> -1 </real>
- <real> 23 </real>
- <real> 174 </real>
- <real> 178 </real>
- <real> 197 </real>
- <string> "Color To:" </string>
- <real> 201 </real>
- <real> 352 </real>
- <real> 32 </real>
- <real> 768 </real>
- <real> 216 </real>
- <real> 24 </real>
- <real> 552 </real>
- <real> 160 </real>
- <string> "" </string>
- <int> 4 </int>
- <vector2> 0, 0 </vector2>
- <resource resource_type="Texture" path="res://icon.png"> </resource>
- <color> 1, 1, 1, 1 </color>
- <rect2> 0, 0, 0, 0 </rect2>
- <vector2> 0, 184 </vector2>
- <vector2> 736, 0 </vector2>
- <real> 40 </real>
- <real> 224 </real>
- <real> 100 </real>
- </array>
- <string> "nodes" </string>
- <int_array len="2229"> -1, -1, 1, 0, -1, 20, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 20, 9, 21, 10, 0, 0, 0, 23, 22, -1, 21, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 11, 25, 12, 7, 13, 8, 14, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 3, 17, 8, 18, 8, 19, 2, 21, 15, 0, 1, 0, 27, 26, -1, 27, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 16, 8, 17, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 18, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 37, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 21, 7, 16, 8, 11, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 22, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 38, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 23, 7, 16, 8, 24, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 25, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 39, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 26, 7, 16, 8, 27, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 28, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 40, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 29, 7, 16, 8, 30, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 31, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 41, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 32, 7, 16, 8, 33, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 34, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 42, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 35, 7, 16, 8, 36, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 37, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 43, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 38, 7, 16, 8, 39, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 40, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 44, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 41, 7, 16, 8, 42, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 43, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 45, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 44, 7, 16, 8, 45, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 46, 33, 19, 34, 3, 35, 3, 36, 20, 0, 1, 0, 27, 46, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 47, 7, 16, 8, 48, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 49, 33, 19, 34, 3, 35, 3, 36, 20, 0, 0, 0, 23, 47, -1, 21, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 50, 25, 12, 7, 51, 8, 52, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 3, 17, 8, 18, 8, 19, 2, 21, 53, 0, 13, 0, 27, 48, -1, 27, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 54, 8, 17, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 55, 33, 19, 34, 3, 35, 3, 36, 20, 0, 13, 0, 27, 49, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 21, 7, 54, 8, 11, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 56, 33, 19, 34, 3, 35, 3, 36, 20, 0, 13, 0, 27, 50, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 23, 7, 54, 8, 24, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 57, 33, 19, 34, 3, 35, 3, 36, 20, 0, 13, 0, 27, 51, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 26, 7, 54, 8, 27, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 58, 33, 19, 34, 3, 35, 3, 36, 20, 0, 0, 0, 23, 52, -1, 21, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 41, 25, 12, 7, 59, 8, 60, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 3, 17, 8, 18, 8, 19, 2, 21, 61, 0, 18, 0, 27, 53, -1, 27, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 62, 8, 17, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 63, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 54, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 21, 7, 62, 8, 11, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 64, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 55, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 23, 7, 62, 8, 24, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 65, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 56, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 26, 7, 62, 8, 27, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 66, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 57, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 29, 7, 62, 8, 30, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 67, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 58, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 32, 7, 62, 8, 33, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 68, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 59, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 35, 7, 62, 8, 36, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 69, 33, 19, 34, 3, 35, 3, 36, 20, 0, 18, 0, 27, 60, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 38, 7, 62, 8, 39, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 28, 3, 29, 3, 30, 1, 31, 3, 32, 70, 33, 19, 34, 3, 35, 3, 36, 20, 0, 0, 0, 23, 54, -1, 21, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 71, 25, 41, 7, 72, 8, 73, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 3, 17, 8, 18, 8, 19, 2, 21, 74, 0, 27, 0, 62, 61, -1, 30, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 75, 8, 76, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 1, 16, 1, 17, 8, 19, 2, 63, 6, 64, 2, 65, 2, 66, 2, 67, 6, 68, 3, 69, 3, 32, 77, 36, 78, 70, 78, 71, 3, 72, 3, 73, 79, 0, 27, 0, 75, 74, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 80, 7, 75, 8, 81, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 3, 17, 8, 18, 8, 19, 2, 0, 27, 0, 62, 76, -1, 31, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 82, 7, 75, 8, 83, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 1, 16, 1, 17, 8, 19, 2, 63, 6, 64, 2, 65, 2, 66, 2, 67, 6, 68, 3, 69, 3, 32, 84, 36, 78, 70, 78, 71, 3, 72, 3, 73, 79, 0, 27, 0, 75, 77, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 25, 85, 7, 75, 8, 86, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 3, 17, 8, 18, 8, 19, 2, 0, 0, 0, 79, 78, -1, 5, 2, 0, 80, 20, 81, 1, 82, 1, 83, 2, 0, 32, 0, 85, 84, -1, 20, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 87, 25, 87, 7, 88, 8, 89, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 18, 8, 19, 2, 0, 33, 0, 87, 86, -1, 24, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 33, 25, 90, 7, 91, 8, 92, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 19, 2, 32, 93, 88, 1, 89, 1, 90, 94, 91, 3, 0, 33, 0, 93, 92, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 94, 95, 9, 6, 10, 7, 95, 96, 96, 1, 97, 95, 98, 3, 99, 3, 100, 20, 101, 20, 102, 78, 103, 97, 104, 3, 105, 98, 0, 33, 0, 93, 58, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 94, 99, 9, 6, 10, 7, 95, 96, 96, 1, 97, 95, 98, 3, 99, 3, 100, 20, 101, 20, 102, 78, 103, 97, 104, 3, 105, 98, 0, 33, 0, 93, 106, -1, 19, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 94, 100, 9, 6, 10, 7, 95, 96, 96, 1, 97, 95, 98, 3, 99, 3, 100, 20, 101, 20, 102, 78, 103, 97, 104, 3, 105, 98, 0, 0, 0, 108, 107, -1, 28, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 24, 101, 25, 102, 7, 72, 8, 41, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 3, 16, 1, 17, 8, 19, 2, 63, 6, 64, 103, 65, 2, 66, 6, 67, 2, 68, 3, 69, 3, 109, 78, 110, 3, 0 </int_array>
- <string> "conns" </string>
- <int_array len="12"> 32, 0, 112, 111, 2, 0, 38, 0, 114, 113, 2, 0 </int_array>
- </dictionary>
-
- </main_resource>
-</resource_file>
diff --git a/demos/misc/udp_chat/chat.gd b/demos/misc/udp_chat/chat.gd
index 3270eebbfe..a2d52bf126 100644
--- a/demos/misc/udp_chat/chat.gd
+++ b/demos/misc/udp_chat/chat.gd
@@ -1,72 +1,67 @@
extends Panel
-# Really simple UDP chat client, not intended as a chat example!!
+# 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):
+func _process(delta):
if (not udp.is_listening()):
return
-
- while(udp.get_available_packet_count()>0):
+
+ while(udp.get_available_packet_count() > 0):
var packet = udp.get_var()
- if (typeof(packet)==TYPE_STRING):
+ 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").add_text("(" + host + ":" + str(port) + ":) " + packet)
get_node("chat/text").newline()
-
-
+
func _ready():
# Initalization here
- get_node("chat").add_style_override("panel",get_stylebox("bg","Tree"))
+ 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 ):
+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.")
+ 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.")
+ 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.")
+ 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_line_text_entered( text ):
- _on_entry_button_pressed();
func _on_entry_button_pressed():
var msg = get_node("entry_line").get_text()
- if (msg==""):
+ if (msg == ""):
return
- send_message(get_node("user_name").get_text()+"> "+msg)
+ 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
index efa4b799a0..fe38e9da72 100644
--- a/demos/misc/udp_chat/chat.scn
+++ b/demos/misc/udp_chat/chat.scn
Binary files differ
diff --git a/demos/misc/window_management/control.gd b/demos/misc/window_management/control.gd
index 1609dda699..881dbdc798 100644
--- a/demos/misc/window_management/control.gd
+++ b/demos/misc/window_management/control.gd
@@ -1,17 +1,18 @@
extends Control
+# member variables
var mousepos
-func _fixed_process(delta):
+func _fixed_process(delta):
var modetext = "Mode:\n"
if(OS.is_window_fullscreen()):
modetext += "Fullscreen\n"
else:
modetext += "Windowed\n"
-
+
if(!OS.is_window_resizable()):
modetext += "FixedSize\n"
@@ -29,119 +30,119 @@ func _fixed_process(delta):
get_node("Label_Mode").set_text(modetext)
- get_node("Label_Position").set_text( str("Position:\n", OS.get_window_position() ) )
+ get_node("Label_Position").set_text(str("Position:\n", OS.get_window_position()))
- get_node("Label_Size").set_text(str("Size:\n", OS.get_window_size() ) )
+ get_node("Label_Size").set_text(str("Size:\n", OS.get_window_size()))
- get_node("Label_MousePosition").set_text(str("Mouse Position:\n", mousepos ) )
+ get_node("Label_MousePosition").set_text(str("Mouse Position:\n", mousepos))
- get_node("Label_Screen_Count").set_text( str("Screen_Count:\n", OS.get_screen_count() ) )
+ get_node("Label_Screen_Count").set_text(str("Screen_Count:\n", OS.get_screen_count()))
- get_node("Label_Screen_Current").set_text( str("Screen:\n", OS.get_current_screen() ) )
+ get_node("Label_Screen_Current").set_text(str("Screen:\n", OS.get_current_screen()))
- get_node("Label_Screen0_Resolution").set_text( str("Screen0 Resolution:\n", OS.get_screen_size() ) )
+ get_node("Label_Screen0_Resolution").set_text(str("Screen0 Resolution:\n", OS.get_screen_size()))
- get_node("Label_Screen0_Position").set_text(str("Screen0 Position:\n",OS.get_screen_position() ) )
+ get_node("Label_Screen0_Position").set_text(str("Screen0 Position:\n", OS.get_screen_position()))
if(OS.get_screen_count() > 1):
get_node("Button_Screen0").show()
get_node("Button_Screen1").show()
get_node("Label_Screen1_Resolution").show()
get_node("Label_Screen1_Position").show()
- get_node("Label_Screen1_Resolution").set_text( str("Screen1 Resolution:\n", OS.get_screen_size(1) ) )
- get_node("Label_Screen1_Position").set_text( str("Screen1 Position:\n", OS.get_screen_position(1) ) )
+ get_node("Label_Screen1_Resolution").set_text(str("Screen1 Resolution:\n", OS.get_screen_size(1)))
+ get_node("Label_Screen1_Position").set_text(str("Screen1 Position:\n", OS.get_screen_position(1)))
else:
get_node("Button_Screen0").hide()
get_node("Button_Screen1").hide()
get_node("Label_Screen1_Resolution").hide()
get_node("Label_Screen1_Position").hide()
-
- get_node("Button_Fullscreen").set_pressed( OS.is_window_fullscreen() )
- get_node("Button_FixedSize").set_pressed( !OS.is_window_resizable() )
- get_node("Button_Minimized").set_pressed( OS.is_window_minimized() )
- get_node("Button_Maximized").set_pressed( OS.is_window_maximized() )
- get_node("Button_Mouse_Grab").set_pressed( Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED )
+
+ get_node("Button_Fullscreen").set_pressed(OS.is_window_fullscreen())
+ get_node("Button_FixedSize").set_pressed(!OS.is_window_resizable())
+ get_node("Button_Minimized").set_pressed(OS.is_window_minimized())
+ get_node("Button_Maximized").set_pressed(OS.is_window_maximized())
+ get_node("Button_Mouse_Grab").set_pressed(Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED)
func check_wm_api():
var s = ""
- if( !OS.has_method("get_screen_count") ):
+ if(!OS.has_method("get_screen_count")):
s += " - get_screen_count()\n"
- if( !OS.has_method("get_current_screen") ):
+ if(!OS.has_method("get_current_screen")):
s += " - get_current_screen()\n"
- if( !OS.has_method("set_current_screen") ):
+ if(!OS.has_method("set_current_screen")):
s += " - set_current_screen()\n"
- if( !OS.has_method("get_screen_position") ):
+ if(!OS.has_method("get_screen_position")):
s += " - get_screen_position()\n"
- if( !OS.has_method("get_screen_size") ):
+ if(!OS.has_method("get_screen_size")):
s += " - get_screen_size()\n"
- if( !OS.has_method("get_window_position") ):
+ if(!OS.has_method("get_window_position")):
s += " - get_window_position()\n"
- if( !OS.has_method("set_window_position") ):
+ if(!OS.has_method("set_window_position")):
s += " - set_window_position()\n"
- if( !OS.has_method("get_window_size") ):
+ if(!OS.has_method("get_window_size")):
s += " - get_window_size()\n"
- if( !OS.has_method("set_window_size") ):
+ if(!OS.has_method("set_window_size")):
s += " - set_window_size()\n"
- if( !OS.has_method("set_window_fullscreen") ):
+ if(!OS.has_method("set_window_fullscreen")):
s += " - set_window_fullscreen()\n"
- if( !OS.has_method("is_window_fullscreen") ):
+ if(!OS.has_method("is_window_fullscreen")):
s += " - is_window_fullscreen()\n"
- if( !OS.has_method("set_window_resizable") ):
+ if(!OS.has_method("set_window_resizable")):
s += " - set_window_resizable()\n"
- if( !OS.has_method("is_window_resizable") ):
+ if(!OS.has_method("is_window_resizable")):
s += " - is_window_resizable()\n"
- if( !OS.has_method("set_window_minimized") ):
+ if(!OS.has_method("set_window_minimized")):
s += " - set_window_minimized()\n"
- if( !OS.has_method("is_window_minimized") ):
+ if(!OS.has_method("is_window_minimized")):
s += " - is_window_minimized()\n"
- if( !OS.has_method("set_window_maximized") ):
+ if(!OS.has_method("set_window_maximized")):
s += " - set_window_maximized()\n"
- if( !OS.has_method("is_window_maximized") ):
+ if(!OS.has_method("is_window_maximized")):
s += " - is_window_maximized()\n"
- if( s.length() == 0 ):
+ if(s.length() == 0):
return true
else:
var text = get_node("ImplementationDialog/Text").get_text()
- get_node("ImplementationDialog/Text").set_text( text + s )
+ get_node("ImplementationDialog/Text").set_text(text + s)
get_node("ImplementationDialog").show()
return false
func _ready():
- if( check_wm_api() ):
+ if(check_wm_api()):
set_fixed_process(true)
set_process_input(true)
-func _input(ev):
- if (ev.type==InputEvent.MOUSE_MOTION):
- mousepos = ev.pos
+func _input(event):
+ if (event.type == InputEvent.MOUSE_MOTION):
+ mousepos = event.pos
func _on_Button_MoveTo_pressed():
- OS.set_window_position( Vector2(100,100) )
+ OS.set_window_position(Vector2(100, 100))
func _on_Button_Resize_pressed():
- OS.set_window_size( Vector2(1024,768) )
+ OS.set_window_size(Vector2(1024, 768))
func _on_Button_Screen0_pressed():
diff --git a/demos/misc/window_management/observer/observer.gd b/demos/misc/window_management/observer/observer.gd
index d27912a670..c1878bca43 100644
--- a/demos/misc/window_management/observer/observer.gd
+++ b/demos/misc/window_management/observer/observer.gd
@@ -1,16 +1,17 @@
extends Spatial
+# member variables
var r_pos = Vector2()
var state
-const STATE_MENU=0
-const STATE_GRAB=1
+const STATE_MENU = 0
+const STATE_GRAB = 1
+
func direction(vector):
- var v = get_node("Camera").get_global_transform().basis * vector
+ var v = get_node("Camera").get_global_transform().basis*vector
v = v.normalized()
-
return v
@@ -22,7 +23,6 @@ func impulse(event, action):
func _fixed_process(delta):
-
if(state != STATE_GRAB):
return
@@ -34,31 +34,31 @@ func _fixed_process(delta):
var org = get_translation()
if (Input.is_action_pressed("move_forward")):
- dir += direction(Vector3(0,0,-1))
+ dir += direction(Vector3(0, 0, -1))
if (Input.is_action_pressed("move_backwards")):
- dir += direction(Vector3(0,0,1))
+ dir += direction(Vector3(0, 0, 1))
if (Input.is_action_pressed("move_left")):
- dir += direction(Vector3(-1,0,0))
+ dir += direction(Vector3(-1, 0, 0))
if (Input.is_action_pressed("move_right")):
- dir += direction(Vector3(1,0,0))
+ dir += direction(Vector3(1, 0, 0))
dir = dir.normalized()
- move(dir * 10 * delta)
- var d = delta * 0.1
+ move(dir*10*delta)
+ var d = delta*0.1
- var yaw = get_transform().rotated(Vector3(0,1,0), d * r_pos.x)
+ var yaw = get_transform().rotated(Vector3(0, 1, 0), d*r_pos.x)
set_transform(yaw)
var cam = get_node("Camera")
- var pitch = cam.get_transform().rotated(Vector3(1,0,0), d * r_pos.y)
+ var pitch = cam.get_transform().rotated(Vector3(1, 0, 0), d*r_pos.y)
cam.set_transform(pitch)
r_pos.x = 0.0
r_pos.y = 0.0
-func _input( event ):
+func _input(event):
if(event.type == InputEvent.MOUSE_MOTION):
r_pos = event.relative_pos
@@ -76,4 +76,3 @@ func _ready():
set_process_input(true)
state = STATE_MENU
-
diff --git a/demos/misc/window_management/observer/observer.scn b/demos/misc/window_management/observer/observer.scn
index da29ad62b8..813d7d4587 100644
--- a/demos/misc/window_management/observer/observer.scn
+++ b/demos/misc/window_management/observer/observer.scn
Binary files differ
diff --git a/demos/misc/window_management/window_management.scn b/demos/misc/window_management/window_management.scn
index 8db43b6638..35662871f1 100644
--- a/demos/misc/window_management/window_management.scn
+++ b/demos/misc/window_management/window_management.scn
Binary files differ