diff --git a/loading/multiple_threads_loading/icon.png.import b/loading/multiple_threads_loading/icon.png.import new file mode 100644 index 00000000..96cbf462 --- /dev/null +++ b/loading/multiple_threads_loading/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/loading/multiple_threads_loading/images/.gitignore b/loading/multiple_threads_loading/images/.gitignore new file mode 100644 index 00000000..4e23f0ac --- /dev/null +++ b/loading/multiple_threads_loading/images/.gitignore @@ -0,0 +1,3 @@ +# For this folder only, let's ignore all *.import files. +# Otherwise, there would be over a thousand lines committed for no benefit. +*.import diff --git a/loading/multiple_threads_loading/preload.gd b/loading/multiple_threads_loading/preload.gd index 518ab424..dc2dd7a4 100644 --- a/loading/multiple_threads_loading/preload.gd +++ b/loading/multiple_threads_loading/preload.gd @@ -1,33 +1,33 @@ extends Node -var Queue +var queue func _ready(): - # Initialize - Queue = preload("res://resource_queue.gd").new() + # Initialize. + queue = preload("res://resource_queue.gd").new() # Call after you instance the class to start the thread. - Queue.start() + queue.start() func _process(_delta): - # Returns true if a resource is done loading and ready to be retrieved - if Queue.is_ready("res://main.tscn"): + # Returns true if a resource is done loading and ready to be retrieved. + if queue.is_ready("res://main.tscn"): set_process(false) - # Returns the fully loaded resource - var next_scene = Queue.get_resource("res://main.tscn").instance() + # Returns the fully loaded resource. + var next_scene = queue.get_resource("res://main.tscn").instance() get_node("/root").add_child(next_scene) get_node("/root").remove_child(self) queue_free() else: - # Get the progress of a resource - var progress = round(Queue.get_progress("res://main.tscn")*100) + # Get the progress of a resource. + var progress = round(queue.get_progress("res://main.tscn") * 100) get_node("ProgressBar").set_value(progress) func _on_Button_button_up(): get_node("Button").hide() set_process(true) - # Queue a resource - Queue.queue_resource("res://main.tscn", true) + # Queue a resource. + queue.queue_resource("res://main.tscn", true) diff --git a/loading/multiple_threads_loading/preload.tscn b/loading/multiple_threads_loading/preload.tscn index bd89dbb6..13a9af83 100644 --- a/loading/multiple_threads_loading/preload.tscn +++ b/loading/multiple_threads_loading/preload.tscn @@ -6,6 +6,7 @@ script/source = "extends LinkButton func _on_LinkButton_button_up(): + # warning-ignore:return_value_discarded OS.shell_open(\"http://docs.godotengine.org/en/3.2/tutorials/io/background_loading.html#using-multiple-threads\") " diff --git a/loading/multiple_threads_loading/screenshots/.gdignore b/loading/multiple_threads_loading/screenshots/.gdignore new file mode 100644 index 00000000..e69de29b