From 51ffd4f81b0e0fc8862b884e376754dfceb2980c Mon Sep 17 00:00:00 2001 From: Jaap Marsman Date: Sun, 30 Mar 2025 13:40:30 +0800 Subject: [PATCH] Updated to Godot 4.4 - Creating workable 0.15 version --- godot/EditScreen.gd.uid | 1 + godot/NameChangePanel.gd.uid | 1 + godot/ObservationWindow.gd.uid | 1 + godot/ProgressBar.gd.uid | 1 + godot/Results.gd.uid | 1 + godot/TimerBar.gd.uid | 1 + godot/global_ints.gd | 2 ++ godot/global_ints.gd.uid | 1 + godot/main_screen.gd | 21 ++++++++++++++------- godot/main_screen.gd.uid | 1 + godot/main_screen.tscn | 14 +++++++------- godot/project.godot | 3 +-- 12 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 godot/EditScreen.gd.uid create mode 100644 godot/NameChangePanel.gd.uid create mode 100644 godot/ObservationWindow.gd.uid create mode 100644 godot/ProgressBar.gd.uid create mode 100644 godot/Results.gd.uid create mode 100644 godot/TimerBar.gd.uid create mode 100644 godot/global_ints.gd.uid create mode 100644 godot/main_screen.gd.uid diff --git a/godot/EditScreen.gd.uid b/godot/EditScreen.gd.uid new file mode 100644 index 0000000..999629b --- /dev/null +++ b/godot/EditScreen.gd.uid @@ -0,0 +1 @@ +uid://psov4nxn77wr diff --git a/godot/NameChangePanel.gd.uid b/godot/NameChangePanel.gd.uid new file mode 100644 index 0000000..11081fd --- /dev/null +++ b/godot/NameChangePanel.gd.uid @@ -0,0 +1 @@ +uid://b4r3eb67qd13n diff --git a/godot/ObservationWindow.gd.uid b/godot/ObservationWindow.gd.uid new file mode 100644 index 0000000..5d6bf11 --- /dev/null +++ b/godot/ObservationWindow.gd.uid @@ -0,0 +1 @@ +uid://hff4wu52flpd diff --git a/godot/ProgressBar.gd.uid b/godot/ProgressBar.gd.uid new file mode 100644 index 0000000..d3ba9f6 --- /dev/null +++ b/godot/ProgressBar.gd.uid @@ -0,0 +1 @@ +uid://t1pvqg6e78j diff --git a/godot/Results.gd.uid b/godot/Results.gd.uid new file mode 100644 index 0000000..66c1c07 --- /dev/null +++ b/godot/Results.gd.uid @@ -0,0 +1 @@ +uid://dhhlom5skgqeq diff --git a/godot/TimerBar.gd.uid b/godot/TimerBar.gd.uid new file mode 100644 index 0000000..ad545bf --- /dev/null +++ b/godot/TimerBar.gd.uid @@ -0,0 +1 @@ +uid://dflvmgvxwqrrf diff --git a/godot/global_ints.gd b/godot/global_ints.gd index 6a7599e..e9bb87c 100644 --- a/godot/global_ints.gd +++ b/godot/global_ints.gd @@ -3,6 +3,8 @@ extends Node var date var ddmmyyyy +var update_text : String + var web_release_version : float var release_version = 0.15 diff --git a/godot/global_ints.gd.uid b/godot/global_ints.gd.uid new file mode 100644 index 0000000..e3d7160 --- /dev/null +++ b/godot/global_ints.gd.uid @@ -0,0 +1 @@ +uid://d05vnomx2cg07 diff --git a/godot/main_screen.gd b/godot/main_screen.gd index dc3e26b..83d3c93 100644 --- a/godot/main_screen.gd +++ b/godot/main_screen.gd @@ -9,7 +9,7 @@ var date var csv_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/version_info.csv" var update_text_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/updater/update_text.md" var update_text : String - +var text_buffer : String @onready var date_time_display = $"%CurrentTime" @onready var global_ints = $"/root/GlobalInts" @@ -24,11 +24,13 @@ var update_text : String # window.position = Vector2i(-8, 0) # window.size = Vector2i(screen_size.x - 66, screen_size.y - 1) + func check_for_updates(): + var os_list : Array = ["Linux", "Windows", "macOS", "OSX"] var os_check : String os_check = OS.get_name() print(os_check) - if os_check == "Linux" and "Windows" and "OSX": + if os_list.has(os_check): print("We're on desktop. So let's check for updates!") $"%HTTPRequest".request(csv_url) $"%HTTPRequest2".request(update_text_url) @@ -44,13 +46,15 @@ func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body): $"%UpdatePanel".visible = true $"%UpdateText".text = str(update_text) $"%UpdateIntro".text = str("You are currently using version ",global_ints.release_version,". The latest version available is ",global_ints.web_release_version,".") + if global_ints.web_release_version <= global_ints.release_version: + print("No update available!") -func _on_HTTPRequest2_request_completed(_result, _response_code, _headers, _body): -# Need to find a way to load .txt file contents from a URL into a label. This to show what the update changes are. -# var json = JSON.parse(body.get_string_from_utf8()) -# update_text = str(json.result) - pass +func _on_HTTPRequest2_request_completed(_result, _response_code, _headers, body): + var test_json_conv = JSON.new() + test_json_conv.parse(body.get_string_from_utf8()) + var json = test_json_conv.get_data() + global_ints.update_text = json func refresh_descriptors(): @@ -85,6 +89,7 @@ func refresh_descriptors(): $"%5Explanation".text = global_ints.five_explanation $"%5ExplanationE".text = $"%5Explanation".text + func set_manual_url(): if TranslationServer.get_locale() != "nl": print("We're not Dutch") @@ -93,6 +98,7 @@ func set_manual_url(): print("We're Dutch") global_ints.manual_url = "https://www.lerenleukermaken.nl/" + func _ready(): DisplayServer.window_set_min_size(Vector2i(1280, 720)) minute_label.text = str(global_ints.observation_minutes) @@ -114,6 +120,7 @@ func _ready(): check_for_updates() + func _process(_delta): check_time_var += 1 diff --git a/godot/main_screen.gd.uid b/godot/main_screen.gd.uid new file mode 100644 index 0000000..52ef4d5 --- /dev/null +++ b/godot/main_screen.gd.uid @@ -0,0 +1 @@ +uid://rbmcgn3hetrs diff --git a/godot/main_screen.tscn b/godot/main_screen.tscn index 1411f41..5a15917 100644 --- a/godot/main_screen.tscn +++ b/godot/main_screen.tscn @@ -1,15 +1,15 @@ [gd_scene load_steps=25 format=3 uid="uid://b1pk005at7x26"] [ext_resource type="Theme" uid="uid://bki1nuccpiu3o" path="res://wb_theme.tres" id="1"] -[ext_resource type="Script" path="res://main_screen.gd" id="2"] -[ext_resource type="Script" path="res://NameChangePanel.gd" id="4"] +[ext_resource type="Script" uid="uid://rbmcgn3hetrs" path="res://main_screen.gd" id="2"] +[ext_resource type="Script" uid="uid://b4r3eb67qd13n" path="res://NameChangePanel.gd" id="4"] [ext_resource type="FontFile" uid="uid://df4eo3bryf8la" path="res://Assets/fonts/noto_sans_display.ttf" id="5"] [ext_resource type="FontFile" uid="uid://darkh8o8rieli" path="res://Assets/fonts/noto_sans_display_bold.ttf" id="6"] -[ext_resource type="Script" path="res://ObservationWindow.gd" id="7"] -[ext_resource type="Script" path="res://EditScreen.gd" id="8"] -[ext_resource type="Script" path="res://Results.gd" id="9"] -[ext_resource type="Script" path="res://TimerBar.gd" id="10"] -[ext_resource type="Script" path="res://ProgressBar.gd" id="11"] +[ext_resource type="Script" uid="uid://hff4wu52flpd" path="res://ObservationWindow.gd" id="7"] +[ext_resource type="Script" uid="uid://psov4nxn77wr" path="res://EditScreen.gd" id="8"] +[ext_resource type="Script" uid="uid://dhhlom5skgqeq" path="res://Results.gd" id="9"] +[ext_resource type="Script" uid="uid://dflvmgvxwqrrf" path="res://TimerBar.gd" id="10"] +[ext_resource type="Script" uid="uid://t1pvqg6e78j" path="res://ProgressBar.gd" id="11"] [ext_resource type="Texture2D" uid="uid://yf4ormoh8hes" path="res://Assets/icons/main_icon.png" id="12"] [ext_resource type="Texture2D" uid="uid://lafpc8rl5lg0" path="res://Assets/icons/noun-input-field-104354.svg" id="12_vtqql"] diff --git a/godot/project.godot b/godot/project.godot index 0efabe4..bd932f3 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -15,7 +15,7 @@ config/name_localized={ "nl": "Tijdsteekproef Formulier" } run/main_scene="res://main_screen.tscn" -config/features=PackedStringArray("4.3") +config/features=PackedStringArray("4.4") run/low_processor_mode=true boot_splash/bg_color=Color(0.952941, 0.933333, 0.847059, 1) boot_splash/image="res://Assets/icons/main_icon.png" @@ -31,7 +31,6 @@ GlobalInts="*res://global_ints.gd" window/size/viewport_width=1280 window/size/viewport_height=720 -window/size/borderless=true window/stretch/mode="canvas_items" window/stretch/aspect="expand"