diff --git a/godot-impl/Main.gd b/godot-impl/Main.gd new file mode 100644 index 0000000..fa44d4d --- /dev/null +++ b/godot-impl/Main.gd @@ -0,0 +1,26 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready(): + $HTTPRequest.connect("request_completed", self._on_request_completed) + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + var bodySize = $HTTPRequest.get_body_size() + var downloadedBytes = $HTTPRequest.get_downloaded_bytes() + + var percent = downloadedBytes * 100 / bodySize + $Label.text = "Progress: %d %%" % percent + pass + +func download_cpp_dap(): + var url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz" + $HTTPRequest.download_file = "user://lldb.tar.xz" + $HTTPRequest.request(url) + + +func _on_request_completed(result, response_code, headers, body): +# TODO: decompress archive +# OS.execute("") + pass diff --git a/godot-impl/Main.tscn b/godot-impl/Main.tscn new file mode 100644 index 0000000..d2c0b76 --- /dev/null +++ b/godot-impl/Main.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=2 format=3 uid="uid://cirquj62osi4v"] + +[ext_resource type="Script" path="res://Main.gd" id="1_6lnje"] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( "1_6lnje" ) + +[node name="Button" type="Button" parent="."] +offset_left = 148.0 +offset_top = 70.0 +offset_right = 296.0 +offset_bottom = 162.0 +text = "Download C++ DAP (lldb)" + +[node name="HTTPRequest" type="HTTPRequest" parent="."] +use_threads = true + +[node name="Label" type="Label" parent="."] +offset_left = 359.0 +offset_top = 90.0 +offset_right = 598.0 +offset_bottom = 136.0 +text = "Progress: 0%" + +[connection signal="pressed" from="Button" to="." method="download_cpp_dap"] diff --git a/godot-impl/project.godot b/godot-impl/project.godot index 7d6483a..1852a43 100644 --- a/godot-impl/project.godot +++ b/godot-impl/project.godot @@ -11,5 +11,6 @@ config_version=5 [application] config/name="Doggo" +run/main_scene="res://Main.tscn" config/icon="res://icon.png" config/features=PackedStringArray("4.0", "Vulkan Clustered")