diff options
Diffstat (limited to 'demos/misc')
50 files changed, 0 insertions, 905 deletions
diff --git a/demos/misc/autoload/engine.cfg b/demos/misc/autoload/engine.cfg deleted file mode 100644 index c6ad023013..0000000000 --- a/demos/misc/autoload/engine.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[application] - -name="Autoload (Singletons)" -main_scene="res://scene_a.scn" - -[autoload] - -global="res://global.gd" diff --git a/demos/misc/autoload/global.gd b/demos/misc/autoload/global.gd deleted file mode 100644 index 735995e806..0000000000 --- a/demos/misc/autoload/global.gd +++ /dev/null @@ -1,36 +0,0 @@ -extends Node - - -# Changing scenes is most easily done using the functions `change_scene` -# and `change_scene_to` of the SceneTree. This script demonstrates how to -# change scenes without those helpers. - - -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. - get_tree().get_current_scene().free() - - # Load new scene - var packed_scene = ResourceLoader.load(path) - - # Instance the new scene - var instanced_scene = packed_scene.instance() - - # Add it to the scene tree, as direct child of root - get_tree().get_root().add_child(instanced_scene) - - # Set it as the current scene, only after it has been added to the tree - get_tree().set_current_scene(instanced_scene) diff --git a/demos/misc/autoload/scene_a.gd b/demos/misc/autoload/scene_a.gd deleted file mode 100644 index 03da86d9a0..0000000000 --- a/demos/misc/autoload/scene_a.gd +++ /dev/null @@ -1,5 +0,0 @@ -extends Panel - - -func _on_goto_scene_pressed(): - get_node("/root/global").goto_scene("res://scene_b.scn") diff --git a/demos/misc/autoload/scene_a.scn b/demos/misc/autoload/scene_a.scn Binary files differdeleted file mode 100644 index eff314e29d..0000000000 --- a/demos/misc/autoload/scene_a.scn +++ /dev/null diff --git a/demos/misc/autoload/scene_b.gd b/demos/misc/autoload/scene_b.gd deleted file mode 100644 index dea8c4623f..0000000000 --- a/demos/misc/autoload/scene_b.gd +++ /dev/null @@ -1,5 +0,0 @@ -extends Panel - - -func _on_goto_scene_pressed(): - get_node("/root/global").goto_scene("res://scene_a.scn") diff --git a/demos/misc/autoload/scene_b.scn b/demos/misc/autoload/scene_b.scn Binary files differdeleted file mode 100644 index 4cdb03e90e..0000000000 --- a/demos/misc/autoload/scene_b.scn +++ /dev/null diff --git a/demos/misc/instancing/ball.scn b/demos/misc/instancing/ball.scn Binary files differdeleted file mode 100644 index 4d6367885e..0000000000 --- a/demos/misc/instancing/ball.scn +++ /dev/null diff --git a/demos/misc/instancing/bowling_ball.png b/demos/misc/instancing/bowling_ball.png Binary files differdeleted file mode 100644 index 9443cda882..0000000000 --- a/demos/misc/instancing/bowling_ball.png +++ /dev/null diff --git a/demos/misc/instancing/container.png b/demos/misc/instancing/container.png Binary files differdeleted file mode 100644 index 8e1363ae4c..0000000000 --- a/demos/misc/instancing/container.png +++ /dev/null diff --git a/demos/misc/instancing/container.scn b/demos/misc/instancing/container.scn Binary files differdeleted file mode 100644 index 0f65daa2ca..0000000000 --- a/demos/misc/instancing/container.scn +++ /dev/null diff --git a/demos/misc/instancing/engine.cfg b/demos/misc/instancing/engine.cfg deleted file mode 100644 index 76b0c97721..0000000000 --- a/demos/misc/instancing/engine.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[application] - -name="Scene Instancing Demo" -main_scene="res://container.scn" -icon="res://icon.png" - -[physics_2d] - -default_gravity=300 diff --git a/demos/misc/instancing/icon.png b/demos/misc/instancing/icon.png Binary files differdeleted file mode 100644 index 79a4283de7..0000000000 --- a/demos/misc/instancing/icon.png +++ /dev/null diff --git a/demos/misc/joysticks/diagram.png b/demos/misc/joysticks/diagram.png Binary files differdeleted file mode 100644 index 3f8ba1f973..0000000000 --- a/demos/misc/joysticks/diagram.png +++ /dev/null diff --git a/demos/misc/joysticks/engine.cfg b/demos/misc/joysticks/engine.cfg deleted file mode 100644 index 79cda1eeb4..0000000000 --- a/demos/misc/joysticks/engine.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[application] - -name="Joysticks" -main_scene="res://joysticks.scn" -icon="res://icon.png" - -[display] - -width=550 -height=300 diff --git a/demos/misc/joysticks/icon.png b/demos/misc/joysticks/icon.png Binary files differdeleted file mode 100644 index 06b0d7532d..0000000000 --- a/demos/misc/joysticks/icon.png +++ /dev/null diff --git a/demos/misc/joysticks/indicators.png b/demos/misc/joysticks/indicators.png Binary files differdeleted file mode 100644 index 90fee48498..0000000000 --- a/demos/misc/joysticks/indicators.png +++ /dev/null diff --git a/demos/misc/joysticks/joysticks.gd b/demos/misc/joysticks/joysticks.gd deleted file mode 100644 index a6b90241b2..0000000000 --- a/demos/misc/joysticks/joysticks.gd +++ /dev/null @@ -1,61 +0,0 @@ - -extends Node2D - -# Joysticks demo, written by Dana Olson <dana@shineuponthee.com> -# -# This is a demo of joystick support, and doubles as a testing application -# inspired by and similar to jstest-gtk. -# -# Licensed under the MIT license - -# Member variables -var joy_num -var cur_joy -var axis_value - -const DEADZONE = 0.2 - -func _fixed_process(delta): - # 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)) - - # Loop through the axes and show their current values - for axis in range(JOY_ANALOG_0_X, JOY_AXIS_MAX): - 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)) - # Show joystick direction indicators - if (axis <= JOY_ANALOG_1_Y): - if (abs(axis_value) < DEADZONE): - get_node("diagram/axes/" + str(axis) + "+").hide() - get_node("diagram/axes/" + str(axis) + "-").hide() - elif (axis_value > 0): - get_node("diagram/axes/" + str(axis) + "+").show() - else: - get_node("diagram/axes/" + str(axis) + "-").show() - - # Loop through the buttons and highlight the ones that are pressed - for btn in range(JOY_BUTTON_0, JOY_BUTTON_MAX): - 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("diagram/buttons/" + str(btn)).show() - else: - get_node("btn" + str(btn)).add_color_override("font_color", Color(0.2, 0.1, 0.3, 1)) - get_node("diagram/buttons/" + str(btn)).hide() - -func _ready(): - set_fixed_process(true) - Input.connect("joy_connection_changed", self, "_on_joy_connection_changed") - -#Called whenever a joystick has been connected or disconnected. -func _on_joy_connection_changed(device_id, connected): - if device_id == cur_joy: - if connected: - get_node("joy_name").set_text(Input.get_joy_name(device_id)) - else: - get_node("joy_name").set_text("") diff --git a/demos/misc/joysticks/joysticks.scn b/demos/misc/joysticks/joysticks.scn Binary files differdeleted file mode 100644 index 7fc283ca69..0000000000 --- a/demos/misc/joysticks/joysticks.scn +++ /dev/null diff --git a/demos/misc/joysticks/jsdiagram.xscn b/demos/misc/joysticks/jsdiagram.xscn deleted file mode 100644 index 537ad30278..0000000000 --- a/demos/misc/joysticks/jsdiagram.xscn +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<resource_file type="PackedScene" subresource_count="3" version="2.0" version_name="Godot Engine v2.0.alpha.custom_build"> - <ext_resource path="res://indicators.png" type="Texture" index="1"></ext_resource> - <ext_resource path="res://diagram.png" type="Texture" index="0"></ext_resource> - <main_resource> - <dictionary name="_bundled" shared="false"> - <string> "conn_count" </string> - <int> 0 </int> - <string> "conns" </string> - <int_array len="0"> </int_array> - <string> "editable_instances" </string> - <array len="0" shared="false"> - </array> - <string> "names" </string> - <string_array len="37"> - <string> "diagram" </string> - <string> "transform/pos" </string> - <string> "transform/scale" </string> - <string> "texture" </string> - <string> "__meta__" </string> - <string> "Sprite" </string> - <string> "buttons" </string> - <string> "Node2D" </string> - <string> "0" </string> - <string> "region" </string> - <string> "region_rect" </string> - <string> "1" </string> - <string> "2" </string> - <string> "3" </string> - <string> "4" </string> - <string> "5" </string> - <string> "6" </string> - <string> "flip_h" </string> - <string> "7" </string> - <string> "8" </string> - <string> "9" </string> - <string> "10" </string> - <string> "11" </string> - <string> "12" </string> - <string> "13" </string> - <string> "flip_v" </string> - <string> "14" </string> - <string> "15" </string> - <string> "axes" </string> - <string> "0-" </string> - <string> "0+" </string> - <string> "1-" </string> - <string> "1+" </string> - <string> "3-" </string> - <string> "3+" </string> - <string> "2-" </string> - <string> "2+" </string> - </string_array> - <string> "node_count" </string> - <int> 27 </int> - <string> "node_paths" </string> - <array len="0" shared="false"> - </array> - <string> "nodes" </string> - <int_array len="453"> -1, -1, 5, 0, -1, 4, 1, 0, 2, 1, 3, 2, 4, 3, 0, 0, 0, 7, 6, -1, 1, 4, 4, 0, 1, 0, 5, 8, -1, 5, 1, 5, 2, 6, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 11, -1, 5, 1, 10, 2, 6, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 12, -1, 5, 1, 11, 2, 6, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 13, -1, 5, 1, 12, 2, 6, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 14, -1, 5, 1, 13, 2, 14, 3, 7, 9, 8, 10, 15, 0, 1, 0, 5, 15, -1, 5, 1, 16, 2, 14, 3, 7, 9, 8, 10, 15, 0, 1, 0, 5, 16, -1, 6, 1, 17, 2, 18, 3, 7, 17, 8, 9, 8, 10, 19, 0, 1, 0, 5, 18, -1, 5, 1, 20, 2, 18, 3, 7, 9, 8, 10, 19, 0, 1, 0, 5, 19, -1, 5, 1, 21, 2, 6, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 20, -1, 5, 1, 22, 2, 6, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 21, -1, 5, 1, 23, 2, 24, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 22, -1, 5, 1, 25, 2, 24, 3, 7, 9, 8, 10, 9, 0, 1, 0, 5, 23, -1, 5, 1, 26, 2, 6, 3, 7, 9, 8, 10, 27, 0, 1, 0, 5, 24, -1, 6, 1, 28, 2, 6, 3, 7, 25, 8, 9, 8, 10, 27, 0, 1, 0, 5, 26, -1, 5, 1, 29, 2, 6, 3, 7, 9, 8, 10, 30, 0, 1, 0, 5, 27, -1, 6, 1, 31, 2, 6, 3, 7, 17, 8, 9, 8, 10, 30, 0, 0, 0, 7, 28, -1, 0, 0, 18, 0, 5, 29, -1, 5, 1, 32, 2, 6, 3, 7, 9, 8, 10, 30, 0, 18, 0, 5, 30, -1, 6, 1, 33, 2, 6, 3, 7, 17, 8, 9, 8, 10, 30, 0, 18, 0, 5, 31, -1, 5, 1, 34, 2, 6, 3, 7, 9, 8, 10, 27, 0, 18, 0, 5, 32, -1, 6, 1, 35, 2, 6, 3, 7, 25, 8, 9, 8, 10, 27, 0, 18, 0, 5, 33, -1, 5, 1, 36, 2, 6, 3, 7, 9, 8, 10, 27, 0, 18, 0, 5, 34, -1, 6, 1, 37, 2, 6, 3, 7, 25, 8, 9, 8, 10, 27, 0, 18, 0, 5, 35, -1, 5, 1, 38, 2, 6, 3, 7, 9, 8, 10, 30, 0, 18, 0, 5, 36, -1, 6, 1, 39, 2, 6, 3, 7, 17, 8, 9, 8, 10, 30, 0 </int_array> - <string> "variants" </string> - <array len="40" shared="false"> - <vector2> 368.635, 155.289 </vector2> - <vector2> 0.432859, 0.446287 </vector2> - <resource external="0"> </resource> - <dictionary shared="false"> - <string> "__editor_plugin_screen__" </string> - <string> "2D" </string> - </dictionary> - <dictionary shared="false"> - <string> "_editor_collapsed" </string> - <bool> True </bool> - </dictionary> - <vector2> 147.73, 120.925 </vector2> - <vector2> 0.9, 0.9 </vector2> - <resource external="1"> </resource> - <bool> True </bool> - <rect2> 0, 0, 45, 45 </rect2> - <vector2> 185.769, 82.4874 </vector2> - <vector2> 112.377, 82.4874 </vector2> - <vector2> 149.073, 47.3293 </vector2> - <vector2> -161.038, -158.037 </vector2> - <vector2> 5.3348, 3.35512 </vector2> - <rect2> 10, 10, 10, 10 </rect2> - <vector2> 159.362, -156.977 </vector2> - <vector2> -159.349, -221.878 </vector2> - <vector2> 1.0458, 2.16952 </vector2> - <rect2> 0, 0, 45, 22 </rect2> - <vector2> 156.677, -220.11 </vector2> - <vector2> -67.5308, 164.422 </vector2> - <vector2> 75.8825, 167.363 </vector2> - <vector2> -46.6707, 52.702 </vector2> - <vector2> 0.810497, 0.57205 </vector2> - <vector2> 56.2581, 54.4382 </vector2> - <vector2> -139.402, 46.8295 </vector2> - <rect2> 50, 0, 54, 14 </rect2> - <vector2> -139.838, 115.789 </vector2> - <vector2> -172.262, 81.8793 </vector2> - <rect2> 50, 0, 14, 54 </rect2> - <vector2> -105.085, 81.0326 </vector2> - <vector2> -94.4295, 164.932 </vector2> - <vector2> -40.3475, 164.509 </vector2> - <vector2> -67.6802, 137.926 </vector2> - <vector2> -67.4618, 192.915 </vector2> - <vector2> 76.6557, 140.986 </vector2> - <vector2> 76.0009, 195.339 </vector2> - <vector2> 48.8152, 167.145 </vector2> - <vector2> 102.899, 167.857 </vector2> - </array> - <string> "version" </string> - <int> 2 </int> - </dictionary> - - </main_resource> -</resource_file>
\ No newline at end of file diff --git a/demos/misc/pause/engine.cfg b/demos/misc/pause/engine.cfg deleted file mode 100644 index a5cb20cc7f..0000000000 --- a/demos/misc/pause/engine.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] - -name="Pause" -main_scene="res://spinpause.scn" -icon="res://icon.png" diff --git a/demos/misc/pause/icon.png b/demos/misc/pause/icon.png Binary files differdeleted file mode 100644 index 49b3fd4053..0000000000 --- a/demos/misc/pause/icon.png +++ /dev/null diff --git a/demos/misc/pause/spinpause.gd b/demos/misc/pause/spinpause.gd deleted file mode 100644 index ea5617c06f..0000000000 --- a/demos/misc/pause/spinpause.gd +++ /dev/null @@ -1,13 +0,0 @@ - -extends Spatial - - -func _on_pause_pressed(): - get_node("pause_popup").set_exclusive(true) - get_node("pause_popup").popup() - get_tree().set_pause(true) - - -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 Binary files differdeleted file mode 100644 index 2cbe85ec9a..0000000000 --- a/demos/misc/pause/spinpause.scn +++ /dev/null diff --git a/demos/misc/regex/engine.cfg b/demos/misc/regex/engine.cfg deleted file mode 100644 index ef5483e096..0000000000 --- a/demos/misc/regex/engine.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] - -name="RegEx" -main_scene="res://regex.scn" -icon="res://icon.png" diff --git a/demos/misc/regex/icon.png b/demos/misc/regex/icon.png Binary files differdeleted file mode 100644 index 7a5232ec4b..0000000000 --- a/demos/misc/regex/icon.png +++ /dev/null diff --git a/demos/misc/regex/regex.gd b/demos/misc/regex/regex.gd deleted file mode 100644 index 98e5ca8828..0000000000 --- a/demos/misc/regex/regex.gd +++ /dev/null @@ -1,28 +0,0 @@ - -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") - for child in list.get_children(): - child.queue_free() - if regex.is_valid(): - regex.find(text) - for res in regex.get_captures(): - var label = Label.new() - 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 Binary files differdeleted file mode 100644 index debd55504f..0000000000 --- a/demos/misc/regex/regex.scn +++ /dev/null diff --git a/demos/misc/scene_changer/engine.cfg b/demos/misc/scene_changer/engine.cfg deleted file mode 100644 index 1ba1a41167..0000000000 --- a/demos/misc/scene_changer/engine.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[application] - -name="Scene Changer" -main_scene="res://scene_a.scn" diff --git a/demos/misc/scene_changer/scene_a.gd b/demos/misc/scene_changer/scene_a.gd deleted file mode 100644 index 0e80395e84..0000000000 --- a/demos/misc/scene_changer/scene_a.gd +++ /dev/null @@ -1,16 +0,0 @@ - -extends Panel - -# Member variables here, example: -# 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 Binary files differdeleted file mode 100644 index 9a4b6434be..0000000000 --- a/demos/misc/scene_changer/scene_a.scn +++ /dev/null diff --git a/demos/misc/scene_changer/scene_b.gd b/demos/misc/scene_changer/scene_b.gd deleted file mode 100644 index 9ed13cf26b..0000000000 --- a/demos/misc/scene_changer/scene_b.gd +++ /dev/null @@ -1,16 +0,0 @@ - -extends Panel - -# Member variables here, example: -# 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 Binary files differdeleted file mode 100644 index 4cdb03e90e..0000000000 --- a/demos/misc/scene_changer/scene_b.scn +++ /dev/null diff --git a/demos/misc/threads/engine.cfg b/demos/misc/threads/engine.cfg deleted file mode 100644 index 6f19936c9d..0000000000 --- a/demos/misc/threads/engine.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[application] - -name="Loading in a Thread" -main_scene="res://thread.scn" diff --git a/demos/misc/threads/mona.png b/demos/misc/threads/mona.png Binary files differdeleted file mode 100644 index 0bcda570b4..0000000000 --- a/demos/misc/threads/mona.png +++ /dev/null diff --git a/demos/misc/threads/thread.gd b/demos/misc/threads/thread.gd deleted file mode 100644 index 1ef67e403c..0000000000 --- a/demos/misc/threads/thread.gd +++ /dev/null @@ -1,31 +0,0 @@ - -extends Node2D - -# Member variables -var thread = Thread.new() - - -# This function runs in a thread! -# Threads always take one userdata argument -func _bg_load(path): - print("THREAD FUNC!") - # Load the resource - var tex = ResourceLoader.load(path) - # Call _bg_load_done on main thread - call_deferred("_bg_load_done") - return tex # return it - - -func _bg_load_done(): - # Wait for the thread to complete, get the returned value - var tex = thread.wait_to_finish() - # Set to the sprite - get_node("sprite").set_texture(tex) - - -func _on_load_pressed(): - if (thread.is_active()): - # Already working - return - print("START THREAD!") - thread.start(self, "_bg_load", "res://mona.png") diff --git a/demos/misc/threads/thread.scn b/demos/misc/threads/thread.scn Binary files differdeleted file mode 100644 index eea93615c7..0000000000 --- a/demos/misc/threads/thread.scn +++ /dev/null diff --git a/demos/misc/tween/engine.cfg b/demos/misc/tween/engine.cfg deleted file mode 100644 index 1d87303015..0000000000 --- a/demos/misc/tween/engine.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[application] - -name="Tween Demo" -main_scene="res://main.scn" -icon="res://icon.png" -target_fps=60 - -[display] - -stretch_mode="2d" -stretch_aspect="keep_width" diff --git a/demos/misc/tween/icon.png b/demos/misc/tween/icon.png Binary files differdeleted file mode 100644 index ed55c24140..0000000000 --- a/demos/misc/tween/icon.png +++ /dev/null diff --git a/demos/misc/tween/main.gd b/demos/misc/tween/main.gd deleted file mode 100644 index b899825d55..0000000000 --- a/demos/misc/tween/main.gd +++ /dev/null @@ -1,165 +0,0 @@ - -extends Control - -# 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"] - -var state = { - trans = Tween.TRANS_LINEAR, - eases = Tween.EASE_IN, -} - - -func _ready(): - for index in range(trans.size()): - var name = trans[index] - get_node("trans/" + name).connect("pressed", self, "on_trans_changed", [name, index]) - - for index in range(eases.size()): - var name = eases[index] - get_node("eases/" + name).connect("pressed", self, "on_eases_changed", [name, index]) - - for index in range(modes.size()): - var name = modes[index] - get_node("modes/" + name).connect("pressed", self, "on_modes_changed", [name]) - - get_node("color/color_from").set_color(Color(1, 0, 0, 1)) - get_node("color/color_from").connect("color_changed", self, "on_color_changed") - - get_node("color/color_to").set_color(Color(0, 1, 1, 1)) - get_node("color/color_to").connect("color_changed", self, "on_color_changed") - - get_node("trans/linear").set_pressed(true) - get_node("eases/in").set_pressed(true) - get_node("modes/move").set_pressed(true) - get_node("modes/repeat").set_pressed(true) - - reset_tween() - - -func on_trans_changed(name, index): - for index in range(trans.size()): - var pressed = trans[index] == name - var btn = get_node("trans/" + trans[index]) - - btn.set_pressed(pressed) - btn.set_ignore_mouse(pressed) - - state.trans = index - reset_tween() - - -func on_eases_changed(name, index): - for index in range(eases.size()): - var pressed = eases[index] == name - var btn = get_node("eases/" + eases[index]) - - btn.set_pressed(pressed) - btn.set_ignore_mouse(pressed) - - state.eases = index - reset_tween() - - -func on_modes_changed(name): - var tween = get_node("tween") - if name == "pause": - if get_node("modes/pause").is_pressed(): - tween.stop_all() - get_node("timeline").set_ignore_mouse(false) - else: - tween.resume_all() - 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() - tween.reset_all() - tween.remove_all() - - var sprite = get_node("tween/area/sprite") - var follow = get_node("tween/area/follow") - var follow_2 = get_node("tween/area/follow_2") - 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) - - 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)) - - 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) - else: - 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) - tween.interpolate_property(sprite, "transform/rot", 360, 0, 2, state.trans, state.eases, 2) - - if get_node("modes/callback").is_pressed(): - tween.interpolate_callback(self, 0.5, "on_callback", "0.5 second's after") - tween.interpolate_callback(self, 0.2, "on_callback", "1.2 second's after") - - if get_node("modes/follow").is_pressed(): - follow.show() - follow_2.show() - - tween.follow_method(follow, "set_pos", Vector2(0, size.height), sprite, "get_pos", 2, state.trans, state.eases) - tween.targeting_method(follow, "set_pos", sprite, "get_pos", Vector2(0, size.height), 2, state.trans, state.eases, 2) - - tween.targeting_property(follow_2, "transform/pos", sprite, "transform/pos", Vector2(size.width, 0), 2, state.trans, state.eases) - tween.follow_property(follow_2, "transform/pos", Vector2(size.width, 0), sprite, "transform/pos", 2, state.trans, state.eases, 2) - else: - follow.hide() - follow_2.hide() - - tween.set_repeat(get_node("modes/repeat").is_pressed()) - tween.start() - tween.seek(pos) - - if get_node("modes/pause").is_pressed(): - tween.stop_all() - get_node("timeline").set_ignore_mouse(false) - get_node("timeline").set_value(0) - else: - tween.resume_all() - get_node("timeline").set_ignore_mouse(true) - - -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) - - -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) - - -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 Binary files differdeleted file mode 100644 index 3f25bfd75c..0000000000 --- a/demos/misc/tween/main.scn +++ /dev/null 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 diff --git a/demos/misc/window_management/control.gd b/demos/misc/window_management/control.gd deleted file mode 100644 index c856555122..0000000000 --- a/demos/misc/window_management/control.gd +++ /dev/null @@ -1,190 +0,0 @@ - -extends Control - -# Member variables -var mousepos - - -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" - - if(OS.is_window_minimized()): - modetext += "Minimized\n" - - if(OS.is_window_maximized()): - modetext += "Maximized\n" - - if(Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED): - modetext += "MouseGrab\n" - get_node("Label_MouseGrab_KeyInfo").show() - else: - get_node("Label_MouseGrab_KeyInfo").hide() - - get_node("Label_Mode").set_text(modetext) - - 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_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_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_Position").set_text(str("Screen0 Position:\n", OS.get_screen_position())) - - get_node("Label_Screen0_DPI").set_text(str("Screen0 DPI:\n", OS.get_screen_dpi())) - - 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_DPI").set_text(str("Screen1 DPI:\n", OS.get_screen_dpi(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("Label_Screen1_DPI").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) - - -func check_wm_api(): - var s = "" - if(!OS.has_method("get_screen_count")): - s += " - get_screen_count()\n" - - if(!OS.has_method("get_current_screen")): - s += " - get_current_screen()\n" - - if(!OS.has_method("set_current_screen")): - s += " - set_current_screen()\n" - - if(!OS.has_method("get_screen_position")): - s += " - get_screen_position()\n" - - if(!OS.has_method("get_screen_size")): - s += " - get_screen_size()\n" - - if(!OS.has_method("get_window_position")): - s += " - get_window_position()\n" - - if(!OS.has_method("set_window_position")): - s += " - set_window_position()\n" - - if(!OS.has_method("get_window_size")): - s += " - get_window_size()\n" - - if(!OS.has_method("set_window_size")): - s += " - set_window_size()\n" - - if(!OS.has_method("set_window_fullscreen")): - s += " - set_window_fullscreen()\n" - - if(!OS.has_method("is_window_fullscreen")): - s += " - is_window_fullscreen()\n" - - if(!OS.has_method("set_window_resizable")): - s += " - set_window_resizable()\n" - - if(!OS.has_method("is_window_resizable")): - s += " - is_window_resizable()\n" - - if(!OS.has_method("set_window_minimized")): - s += " - set_window_minimized()\n" - - if(!OS.has_method("is_window_minimized")): - s += " - is_window_minimized()\n" - - if(!OS.has_method("set_window_maximized")): - s += " - set_window_maximized()\n" - - if(!OS.has_method("is_window_maximized")): - s += " - is_window_maximized()\n" - - 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").show() - return false - - -func _ready(): - if(check_wm_api()): - set_fixed_process(true) - set_process_input(true) - - -func _input(event): - if (event.type == InputEvent.MOUSE_MOTION): - mousepos = event.pos - - -func _on_Button_MoveTo_pressed(): - OS.set_window_position(Vector2(100, 100)) - - -func _on_Button_Resize_pressed(): - OS.set_window_size(Vector2(1024, 768)) - - -func _on_Button_Screen0_pressed(): - OS.set_current_screen(0) - - -func _on_Button_Screen1_pressed(): - OS.set_current_screen(1) - - -func _on_Button_Fullscreen_pressed(): - if(OS.is_window_fullscreen()): - OS.set_window_fullscreen(false) - else: - OS.set_window_fullscreen(true) - - -func _on_Button_FixedSize_pressed(): - if(OS.is_window_resizable()): - OS.set_window_resizable(false) - else: - OS.set_window_resizable(true) - - -func _on_Button_Minimized_pressed(): - if(OS.is_window_minimized()): - OS.set_window_minimized(false) - else: - OS.set_window_minimized(true) - - -func _on_Button_Maximized_pressed(): - if(OS.is_window_maximized()): - OS.set_window_maximized(false) - else: - OS.set_window_maximized(true) - - -func _on_Button_Mouse_Grab_pressed(): - var observer = get_node("../Observer") - observer.state = observer.STATE_GRAB diff --git a/demos/misc/window_management/engine.cfg b/demos/misc/window_management/engine.cfg deleted file mode 100644 index 911d3fd4a1..0000000000 --- a/demos/misc/window_management/engine.cfg +++ /dev/null @@ -1,19 +0,0 @@ -[application] - -name="Window Management" -main_scene="res://window_management.scn" -icon="res://icon.png" - -[display] - -fullscreen=false -resizable=true -width=800 -height=600 - -[input] - -move_forward=[key(W)] -move_backwards=[key(S)] -move_left=[key(A)] -move_right=[key(D)] diff --git a/demos/misc/window_management/icon.png b/demos/misc/window_management/icon.png Binary files differdeleted file mode 100644 index ec5c7891f9..0000000000 --- a/demos/misc/window_management/icon.png +++ /dev/null diff --git a/demos/misc/window_management/observer/observer.gd b/demos/misc/window_management/observer/observer.gd deleted file mode 100644 index f100811859..0000000000 --- a/demos/misc/window_management/observer/observer.gd +++ /dev/null @@ -1,78 +0,0 @@ - -extends Spatial - -# Member variables -var r_pos = Vector2() -var state - -const STATE_MENU = 0 -const STATE_GRAB = 1 - - -func direction(vector): - var v = get_node("Camera").get_global_transform().basis*vector - v = v.normalized() - return v - - -func impulse(event, action): - if(event.is_action(action) && event.is_pressed() && !event.is_echo()): - return true - else: - return false - - -func _fixed_process(delta): - if(state != STATE_GRAB): - return - - if(Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED): - Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) - - var dir = Vector3() - var cam = get_global_transform() - var org = get_translation() - - if (Input.is_action_pressed("move_forward")): - dir += direction(Vector3(0, 0, -1)) - if (Input.is_action_pressed("move_backwards")): - dir += direction(Vector3(0, 0, 1)) - if (Input.is_action_pressed("move_left")): - dir += direction(Vector3(-1, 0, 0)) - if (Input.is_action_pressed("move_right")): - dir += direction(Vector3(1, 0, 0)) - - dir = dir.normalized() - - move(dir*10*delta) - var d = delta*0.1 - - 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) - cam.set_transform(pitch) - - r_pos.x = 0.0 - r_pos.y = 0.0 - - -func _input(event): - if(event.type == InputEvent.MOUSE_MOTION): - r_pos = event.relative_pos - - if(impulse(event, "ui_cancel")): - if(state == STATE_GRAB): - Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) - state = STATE_MENU - else: - Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) - state = STATE_GRAB - - -func _ready(): - set_fixed_process(true) - 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 Binary files differdeleted file mode 100644 index 813d7d4587..0000000000 --- a/demos/misc/window_management/observer/observer.scn +++ /dev/null diff --git a/demos/misc/window_management/window_management.scn b/demos/misc/window_management/window_management.scn Binary files differdeleted file mode 100644 index 91174669cd..0000000000 --- a/demos/misc/window_management/window_management.scn +++ /dev/null |