Files
2019-10-26 17:14:35 +02:00

33 lines
954 B
GDScript

extends StaticBody
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
#set_screen(get_node(
# Retrieve the captured Image using get_data().
var img = get_viewport().get_texture().get_data()
# Flip on the y axis.
# You can also set "V Flip" to true if not on the Root Viewport.
img.flip_y()
# Convert Image to ImageTexture.
var tex = ImageTexture.new()
tex.create_from_image(img)
# Set Sprite Texture.
#$sprite.texture = tex
#set_screen(tex)
pass # Replace with function body.
func set_screen(img):
var surface = get_node('Screen')
surface.material_override = surface.material_override.duplicate()
if surface.material_override:
surface.material_override.albedo_texture = img
surface.material_override.emission_texture = img
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass