HTML5-File-Exchange-for-Godot/Sample.gd

21 lines
470 B
GDScript3
Raw Normal View History

extends TextureRect
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _on_UploadButton_pressed():
HTML5File.load_image()
2023-09-10 03:45:00 +00:00
var image = await HTML5File.load_completed
var tex = ImageTexture.new()
2023-09-10 03:45:00 +00:00
tex.create_from_image(image) #,0
texture = tex;
func _on_DownloadButton_pressed():
2023-09-10 03:45:00 +00:00
var image : Image
image = get_viewport().get_texture().get_image()
HTML5File.save_image(image, "image.png")