Loading images with noise distortion.
This commit is contained in:
19
run/main.gd
Normal file
19
run/main.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
%LoadImageButton.pressed.connect(show_image_load_dialog)
|
||||
%LoadImageDialog.file_selected.connect(load_image)
|
||||
|
||||
func show_image_load_dialog():
|
||||
%LoadImageDialog.visible = true
|
||||
|
||||
func load_image(path: String) -> bool:
|
||||
var image = Image.load_from_file(path)
|
||||
if image == null:
|
||||
return false
|
||||
|
||||
var tex = ImageTexture.create_from_image(image)
|
||||
%PreviewImage.texture = tex
|
||||
%LoadImageButton.text = path.get_file()
|
||||
return true
|
||||
Reference in New Issue
Block a user