diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-03-22 12:52:47 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-03-22 12:52:47 -0300 |
commit | 1e4841dc522585904d0b1564ddbda5fe913e890e (patch) | |
tree | bddbecce0c4592a2572d95072647b4d46a29027d | |
parent | 78694d85425b35d2c6c0e0a4b0ef3e57375553c6 (diff) |
drag & drop demo (GUI)
-rw-r--r-- | demos/gui/drag_and_drop/drag_and_drop.scn | bin | 0 -> 2596 bytes | |||
-rw-r--r-- | demos/gui/drag_and_drop/drag_drop_script.gd | 27 | ||||
-rw-r--r-- | demos/gui/drag_and_drop/engine.cfg | 4 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 1 |
4 files changed, 32 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 Binary files differnew file mode 100644 index 0000000000..f2122a459e --- /dev/null +++ b/demos/gui/drag_and_drop/drag_and_drop.scn 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 & Drop (GUI)" +main_scene="res://drag_and_drop.scn" diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 193649c815..d944b804a5 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -352,6 +352,7 @@ void ColorPickerButton::set_color(const Color& p_color){ picker->set_color(p_color); + update(); } Color ColorPickerButton::get_color() const{ |