summaryrefslogtreecommitdiff
path: root/demos/viewport/screen_capture
diff options
context:
space:
mode:
Diffstat (limited to 'demos/viewport/screen_capture')
-rw-r--r--demos/viewport/screen_capture/screen_capture.gd23
-rw-r--r--demos/viewport/screen_capture/screen_capture.scnbin1977 -> 3482 bytes
2 files changed, 6 insertions, 17 deletions
diff --git a/demos/viewport/screen_capture/screen_capture.gd b/demos/viewport/screen_capture/screen_capture.gd
index 69f16fa498..9867d95452 100644
--- a/demos/viewport/screen_capture/screen_capture.gd
+++ b/demos/viewport/screen_capture/screen_capture.gd
@@ -1,27 +1,16 @@
extends Control
-# member variables here, example:
-# var a=2
-# var b="textvar"
-
-func _ready():
- # Initialization here
- pass
-
-
-
func _on_button_pressed():
get_viewport().queue_screen_capture()
- #let two frames pass to make sure the screen was aptured
- yield(get_tree(),"idle_frame")
- yield(get_tree(),"idle_frame")
- #retrieve the captured image
+ # Let two frames pass to make sure the screen was captured
+ yield(get_tree(), "idle_frame")
+ yield(get_tree(), "idle_frame")
+ # Retrieve the captured image
var img = get_viewport().get_screen_capture()
- #create a texture for it
+ # Create a texture for it
var tex = ImageTexture.new()
tex.create_from_image(img)
- #set it to the capture node
+ # Set it to the capture node
get_node("capture").set_texture(tex)
- pass # replace with function body
diff --git a/demos/viewport/screen_capture/screen_capture.scn b/demos/viewport/screen_capture/screen_capture.scn
index d204e3b67e..ee847fbe62 100644
--- a/demos/viewport/screen_capture/screen_capture.scn
+++ b/demos/viewport/screen_capture/screen_capture.scn
Binary files differ