summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaSa1002 <johawitt@outlook.de>2020-11-10 10:12:49 +0100
committerHaSa1002 <johawitt@outlook.de>2020-11-10 10:24:17 +0100
commit9dad1c4943934a584d02ee830542349042281980 (patch)
treec65bfbf40642097864da082f1ae12579b1a988e9
parente1a9ec4e19ec1b1f128ae58c4627864827fae1ba (diff)
[Docs] Add C# example for EditorPlugin::forward_canvas_draw_over_viewport
Follow up to #43356
-rw-r--r--doc/classes/EditorPlugin.xml25
1 files changed, 23 insertions, 2 deletions
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 70d2c6b0a9..a069bdd836 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -211,7 +211,8 @@
</argument>
<description>
Called by the engine when the 2D editor's viewport is updated. Use the [code]overlay[/code] [Control] for drawing. You can update the viewport manually by calling [method update_overlays].
- [codeblock]
+ [codeblocks]
+ [gdscript]
func forward_canvas_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64)
@@ -220,7 +221,27 @@
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
- [/codeblock]
+ return true
+ return false
+ [/gdscript]
+ [csharp]
+ public override void ForwardCanvasDrawOverViewport(Godot.Control overlay)
+ {
+ // Draw a circle at cursor position.
+ overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White);
+ }
+
+ public override bool ForwardCanvasGuiInput(InputEvent @event)
+ {
+ if (@event is InputEventMouseMotion)
+ {
+ // Redraw viewport when cursor is moved.
+ UpdateOverlays();
+ return true;
+ }
+ return false;
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="forward_canvas_force_draw_over_viewport" qualifiers="virtual">