first attempt at converting to Godot 4

This commit is contained in:
Jaap Marsman 2023-03-03 20:14:13 +08:00
parent 49cb0230e3
commit b11d28d574
14 changed files with 462 additions and 788 deletions

2
.gitignore vendored
View File

@ -8,6 +8,8 @@
export.cfg export.cfg
export_presets.cfg export_presets.cfg
*.import *.import
.godot/
godot/.godot/
# Imported translations (automatically generated from CSV files) # Imported translations (automatically generated from CSV files)
*.translation *.translation

View File

@ -1,8 +1,8 @@
extends CanvasLayer extends CanvasLayer
onready var gi = $"/root/GlobalInts" @onready var gi = $"/root/GlobalInts"
onready var global_ints = gi @onready var global_ints = gi
onready var main_window = $"../../AppWindow" @onready var main_window = $"../../AppWindow"
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.

View File

@ -1,7 +1,7 @@
extends Panel extends Panel
onready var global_ints = $"/root/GlobalInts" @onready var global_ints = $"/root/GlobalInts"
func _on_OkButton_pressed(): func _on_OkButton_pressed():

View File

@ -1,7 +1,7 @@
extends CanvasLayer extends CanvasLayer
onready var global_ints = $"/root/GlobalInts" @onready var global_ints = $"/root/GlobalInts"
var time_lefts : int var time_lefts : int

View File

@ -1,7 +1,7 @@
extends ProgressBar extends ProgressBar
onready var global_ints = $"/root/GlobalInts" @onready var global_ints = $"/root/GlobalInts"
func _ready(): func _ready():

View File

@ -1,7 +1,7 @@
extends CanvasLayer extends CanvasLayer
onready var global_ints = $"/root/GlobalInts" @onready var global_ints = $"/root/GlobalInts"
var js_callback = JavaScript.create_callback(self, "load_handler"); var js_callback = JavaScript.create_callback(self, "load_handler");
var js_interface; var js_interface;

View File

@ -1,7 +1,7 @@
extends ProgressBar extends ProgressBar
onready var global_ints = $"/root/GlobalInts" @onready var global_ints = $"/root/GlobalInts"
var time_lefts : int var time_lefts : int

View File

@ -48,7 +48,7 @@ func load_image():
js_interface.upload(js_callback); js_interface.upload(js_callback);
yield(self, "read_completed") await self.read_completed
var imageType = js_interface.fileType; var imageType = js_interface.fileType;
var imageData = JavaScript.eval("_HTML5FileExchange.result", true) # interface doesn't work as expected for some reason var imageData = JavaScript.eval("_HTML5FileExchange.result", true) # interface doesn't work as expected for some reason

View File

@ -1,4 +1,4 @@
tool @tool
extends EditorPlugin extends EditorPlugin

View File

@ -1,7 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2] [gd_resource type="Environment" load_steps=2 format=3 uid="uid://jbihewyaxy2u"]
[sub_resource type="ProceduralSky" id=1] [sub_resource type="Sky" id="1"]
[resource] [resource]
background_mode = 2 background_mode = 2
background_sky = SubResource( 1 ) sky = SubResource("1")

View File

@ -10,9 +10,9 @@ var update_text_url = "https://raw.githubusercontent.com/hobbesjaap/time-samplin
var update_text : String var update_text : String
onready var date_time_display = $"%CurrentTime" @onready var date_time_display = $"%CurrentTime"
onready var global_ints = $"/root/GlobalInts" @onready var global_ints = $"/root/GlobalInts"
onready var minute_label = $"StartScreen/InstructionPanel/MinuteBox/MinuteLabel" @onready var minute_label = $"StartScreen/InstructionPanel/MinuteBox/MinuteLabel"
func check_for_updates(): func check_for_updates():
@ -26,7 +26,9 @@ func check_for_updates():
func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body): func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
var json = JSON.parse(body.get_string_from_utf8()) var test_json_conv = JSON.new()
test_json_conv.parse(body.get_string_from_utf8())
var json = test_json_conv.get_data()
global_ints.web_release_version = json.result global_ints.web_release_version = json.result
if global_ints.web_release_version > global_ints.release_version: if global_ints.web_release_version > global_ints.release_version:
print("There's an update!") print("There's an update!")
@ -37,7 +39,9 @@ func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
func _on_HTTPRequest2_request_completed(_result, _response_code, _headers, _body): 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. # 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()) var test_json_conv = JSON.new()
test_json_conv.parse(body.get_string_from_utf8())
# var json = test_json_conv.get_data()
# update_text = str(json.result) # update_text = str(json.result)
pass pass

File diff suppressed because it is too large Load Diff

View File

@ -6,15 +6,16 @@
; [section] ; section goes between [] ; [section] ; section goes between []
; param=value ; assign values to parameters ; param=value ; assign values to parameters
config_version=4 config_version=5
[application] [application]
config/name="Time Sampling Form" config/name="Time Sampling Form"
run/main_scene="res://main_screen.tscn" run/main_scene="res://main_screen.tscn"
config/features=PackedStringArray("4.0")
run/low_processor_mode=true run/low_processor_mode=true
boot_splash/image="res://Assets/icons/main_icon.png"
boot_splash/bg_color=Color(0.952941, 0.933333, 0.847059, 1) boot_splash/bg_color=Color(0.952941, 0.933333, 0.847059, 1)
boot_splash/image="res://Assets/icons/main_icon.png"
config/icon="res://Assets/icons/main_icon.png" config/icon="res://Assets/icons/main_icon.png"
config/macos_native_icon="res://Assets/icons/main_icon.icns" config/macos_native_icon="res://Assets/icons/main_icon.icns"
config/windows_native_icon="res://Assets/icons/icon.ico" config/windows_native_icon="res://Assets/icons/icon.ico"
@ -26,14 +27,13 @@ HTML5File="*res://addons/HTML5FileExchange/HTML5FileExchange.gd"
[display] [display]
window/size/width=1280 window/size/viewport_width=1280
window/size/height=720 window/size/viewport_height=720
window/stretch/mode="2d" window/stretch/mode="2d"
window/stretch/aspect="keep"
[editor_plugins] [editor_plugins]
enabled=PoolStringArray( "res://addons/HTML5FileExchange/plugin.cfg" ) enabled=PackedStringArray("res://addons/HTML5FileExchange/plugin.cfg")
[gui] [gui]
@ -45,7 +45,7 @@ common/enable_pause_aware_picking=true
[rendering] [rendering]
environment/defaults/default_environment="res://default_env.tres"
quality/intended_usage/framebuffer_allocation=0 quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=0 quality/intended_usage/framebuffer_allocation.mobile=0
2d/snapping/use_gpu_pixel_snap=true 2d/snapping/use_gpu_pixel_snap=true
environment/default_environment="res://default_env.tres"

View File

@ -1,56 +1,80 @@
[gd_resource type="Theme" load_steps=16 format=2] [gd_resource type="Theme" load_steps=16 format=3 uid="uid://cft2814mm2aav"]
[ext_resource path="res://Assets/fonts/noto_sans_display_bold.ttf" type="DynamicFontData" id=1] [ext_resource type="FontFile" uid="uid://pimhoja8acya" path="res://Assets/fonts/noto_sans_display_bold.ttf" id="1"]
[ext_resource path="res://Assets/fonts/noto_sans_display.ttf" type="DynamicFontData" id=2] [ext_resource type="FontFile" uid="uid://c21retrvbsple" path="res://Assets/fonts/noto_sans_display.ttf" id="2"]
[sub_resource type="DynamicFont" id=1] [sub_resource type="FontFile" id="1"]
size = 24 fallbacks = Array[Font]([ExtResource("1")])
font_data = ExtResource( 1 ) face_index = null
embolden = null
transform = null
cache/0/16/0/ascent = 0.0
cache/0/16/0/descent = 0.0
cache/0/16/0/underline_position = 0.0
cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
[sub_resource type="StyleBoxFlat" id=4] [sub_resource type="StyleBoxFlat" id="4"]
bg_color = Color(0.207843, 0.219608, 0.317647, 1) bg_color = Color(0.207843, 0.219608, 0.317647, 1)
corner_radius_top_left = 10 corner_radius_top_left = 10
corner_radius_top_right = 10 corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="StyleBoxFlat" id=5] [sub_resource type="StyleBoxFlat" id="5"]
bg_color = Color(0.862745, 0.435294, 0.329412, 1) bg_color = Color(0.862745, 0.435294, 0.329412, 1)
corner_radius_top_left = 10 corner_radius_top_left = 10
corner_radius_top_right = 10 corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="StyleBoxFlat" id=6] [sub_resource type="StyleBoxFlat" id="6"]
bg_color = Color(0.941176, 0.772549, 0.517647, 1) bg_color = Color(0.941176, 0.772549, 0.517647, 1)
corner_radius_top_left = 10 corner_radius_top_left = 10
corner_radius_top_right = 10 corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="StyleBoxFlat" id=2] [sub_resource type="StyleBoxFlat" id="2"]
bg_color = Color(0.862745, 0.435294, 0.329412, 1) bg_color = Color(0.862745, 0.435294, 0.329412, 1)
corner_radius_top_left = 10 corner_radius_top_left = 10
corner_radius_top_right = 10 corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="StyleBoxFlat" id=7] [sub_resource type="StyleBoxFlat" id="7"]
bg_color = Color(0.941176, 0.772549, 0.517647, 1) bg_color = Color(0.941176, 0.772549, 0.517647, 1)
corner_radius_top_left = 10 corner_radius_top_left = 10
corner_radius_top_right = 10 corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="DynamicFont" id=3] [sub_resource type="FontFile" id="3"]
size = 24 fallbacks = Array[Font]([ExtResource("2")])
font_data = ExtResource( 2 ) face_index = null
embolden = null
transform = null
cache/0/16/0/ascent = 0.0
cache/0/16/0/descent = 0.0
cache/0/16/0/underline_position = 0.0
cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
[sub_resource type="DynamicFont" id=8] [sub_resource type="FontFile" id="8"]
size = 24 fallbacks = Array[Font]([ExtResource("2")])
font_data = ExtResource( 2 ) face_index = null
embolden = null
transform = null
cache/0/16/0/ascent = 0.0
cache/0/16/0/descent = 0.0
cache/0/16/0/underline_position = 0.0
cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
[sub_resource type="StyleBoxFlat" id=9] [sub_resource type="StyleBoxFlat" id="9"]
content_margin_left = 15.0 content_margin_left = 15.0
content_margin_right = 5.0 content_margin_right = 5.0
bg_color = Color(0.207843, 0.219608, 0.317647, 1) bg_color = Color(0.207843, 0.219608, 0.317647, 1)
@ -59,7 +83,7 @@ corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="StyleBoxFlat" id=11] [sub_resource type="StyleBoxFlat" id="11"]
bg_color = Color(0.952941, 0.933333, 0.847059, 1) bg_color = Color(0.952941, 0.933333, 0.847059, 1)
border_width_left = 2 border_width_left = 2
border_width_top = 2 border_width_top = 2
@ -71,16 +95,16 @@ corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="StyleBoxEmpty" id=12] [sub_resource type="StyleBoxEmpty" id="12"]
[sub_resource type="StyleBoxFlat" id=13] [sub_resource type="StyleBoxFlat" id="13"]
bg_color = Color(0.862745, 0.435294, 0.329412, 1) bg_color = Color(0.862745, 0.435294, 0.329412, 1)
corner_radius_top_left = 5 corner_radius_top_left = 5
corner_radius_top_right = 5 corner_radius_top_right = 5
corner_radius_bottom_right = 5 corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id=14] [sub_resource type="StyleBoxFlat" id="14"]
bg_color = Color(0.941176, 0.772549, 0.517647, 1) bg_color = Color(0.941176, 0.772549, 0.517647, 1)
corner_radius_top_left = 5 corner_radius_top_left = 5
corner_radius_top_right = 5 corner_radius_top_right = 5
@ -88,17 +112,17 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
[resource] [resource]
Button/fonts/font = SubResource( 1 ) Button/fonts/font = SubResource("1")
Button/styles/disabled = SubResource( 4 ) Button/styles/disabled = SubResource("4")
Button/styles/focus = SubResource( 5 ) Button/styles/focus = SubResource("5")
Button/styles/hover = SubResource( 6 ) Button/styles/hover = SubResource("6")
Button/styles/normal = SubResource( 2 ) Button/styles/normal = SubResource("2")
Button/styles/pressed = SubResource( 7 ) Button/styles/pressed = SubResource("7")
Label/colors/font_color = Color(0, 0, 0, 1) Label/colors/font_color = Color(0, 0, 0, 1)
Label/fonts/font = SubResource( 3 ) Label/fonts/font = SubResource("3")
LineEdit/fonts/font = SubResource( 8 ) LineEdit/fonts/font = SubResource("8")
LineEdit/styles/normal = SubResource( 9 ) LineEdit/styles/normal = SubResource("9")
Panel/styles/panel = SubResource( 11 ) Panel/styles/panel = SubResource("11")
PanelContainer/styles/panel = SubResource( 12 ) PanelContainer/styles/panel = SubResource("12")
ProgressBar/styles/bg = SubResource( 13 ) ProgressBar/styles/bg = SubResource("13")
ProgressBar/styles/fg = SubResource( 14 ) ProgressBar/styles/fg = SubResource("14")