summaryrefslogtreecommitdiff
path: root/demos/gui/drag_and_drop
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-22 12:52:47 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-22 12:52:47 -0300
commit1e4841dc522585904d0b1564ddbda5fe913e890e (patch)
treebddbecce0c4592a2572d95072647b4d46a29027d /demos/gui/drag_and_drop
parent78694d85425b35d2c6c0e0a4b0ef3e57375553c6 (diff)
drag & drop demo (GUI)
Diffstat (limited to 'demos/gui/drag_and_drop')
-rw-r--r--demos/gui/drag_and_drop/drag_and_drop.scnbin0 -> 2596 bytes
-rw-r--r--demos/gui/drag_and_drop/drag_drop_script.gd27
-rw-r--r--demos/gui/drag_and_drop/engine.cfg4
3 files changed, 31 insertions, 0 deletions
diff --git a/demos/gui/drag_and_drop/drag_and_drop.scn b/demos/gui/drag_and_drop/drag_and_drop.scn
new file mode 100644
index 0000000000..f2122a459e
--- /dev/null
+++ b/demos/gui/drag_and_drop/drag_and_drop.scn
Binary files differ
diff --git a/demos/gui/drag_and_drop/drag_drop_script.gd b/demos/gui/drag_and_drop/drag_drop_script.gd
new file mode 100644
index 0000000000..a99b963efa
--- /dev/null
+++ b/demos/gui/drag_and_drop/drag_drop_script.gd
@@ -0,0 +1,27 @@
+
+extends ColorPickerButton
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+func get_drag_data(pos):
+
+ #use another control as drag preview
+ var cpb = ColorPickerButton.new()
+ cpb.set_color( get_color() )
+ cpb.set_size(Vector2(50,50))
+ set_drag_preview(cpb)
+ #return color as drag data
+ return get_color()
+
+func can_drop_data(pos, data):
+ return typeof(data)==TYPE_COLOR
+
+func drop_data(pos, data):
+ set_color(data)
+
+func _ready():
+ # Initialization here
+ pass
+
+
diff --git a/demos/gui/drag_and_drop/engine.cfg b/demos/gui/drag_and_drop/engine.cfg
new file mode 100644
index 0000000000..448939c61d
--- /dev/null
+++ b/demos/gui/drag_and_drop/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Drag &amp; Drop (GUI)"
+main_scene="res://drag_and_drop.scn"