summaryrefslogtreecommitdiff
path: root/demos/plugins/custom_node
diff options
context:
space:
mode:
Diffstat (limited to 'demos/plugins/custom_node')
-rw-r--r--demos/plugins/custom_node/heart.gd12
-rw-r--r--demos/plugins/custom_node/heart.pngbin0 -> 12584 bytes
-rw-r--r--demos/plugins/custom_node/heart_icon.pngbin0 -> 809 bytes
-rw-r--r--demos/plugins/custom_node/heart_plugin.gd18
-rw-r--r--demos/plugins/custom_node/plugin.cfg14
5 files changed, 44 insertions, 0 deletions
diff --git a/demos/plugins/custom_node/heart.gd b/demos/plugins/custom_node/heart.gd
new file mode 100644
index 0000000000..d53c92d800
--- /dev/null
+++ b/demos/plugins/custom_node/heart.gd
@@ -0,0 +1,12 @@
+tool
+extends Node2D
+
+
+var heart = preload("res://addons/custom_node/heart.png")
+
+func _draw():
+ draw_texture(heart,-heart.get_size()/2)
+
+func _get_item_rect():
+ #override
+ return Rect2(-heart.get_size()/2,heart.get_size())
diff --git a/demos/plugins/custom_node/heart.png b/demos/plugins/custom_node/heart.png
new file mode 100644
index 0000000000..1dfd14a456
--- /dev/null
+++ b/demos/plugins/custom_node/heart.png
Binary files differ
diff --git a/demos/plugins/custom_node/heart_icon.png b/demos/plugins/custom_node/heart_icon.png
new file mode 100644
index 0000000000..2eb819aa24
--- /dev/null
+++ b/demos/plugins/custom_node/heart_icon.png
Binary files differ
diff --git a/demos/plugins/custom_node/heart_plugin.gd b/demos/plugins/custom_node/heart_plugin.gd
new file mode 100644
index 0000000000..01a6177c9b
--- /dev/null
+++ b/demos/plugins/custom_node/heart_plugin.gd
@@ -0,0 +1,18 @@
+tool
+extends EditorPlugin
+
+
+func _enter_tree():
+ # When this plugin node enters tree, add the custom type
+
+ add_custom_type("Heart","Node2D",preload("res://addons/custom_node/heart.gd"),preload("res://addons/custom_node/heart_icon.png"))
+
+func _exit_tree():
+ # When the plugin node exits the tree, remove the custom type
+
+ remove_custom_type("Heart")
+
+
+
+
+ \ No newline at end of file
diff --git a/demos/plugins/custom_node/plugin.cfg b/demos/plugins/custom_node/plugin.cfg
new file mode 100644
index 0000000000..ebb4b56499
--- /dev/null
+++ b/demos/plugins/custom_node/plugin.cfg
@@ -0,0 +1,14 @@
+[plugin]
+
+name="Heart"
+description="Adds a new Heart node in 2D"
+author="Juan Linietsky"
+version="1.0"
+script="heart_plugin.gd"
+
+
+
+
+
+
+