From b8b70fbe82eb63d58f7c1722b006d00c68d4439e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= <41945903+qarmin@users.noreply.github.com> Date: Sun, 13 Dec 2020 21:08:29 +0100 Subject: [PATCH] Use more compatible time counting format (#10) --- Autoload/Autoload.gd | 6 +++--- Start.gd | 4 ++-- Text/Text.tscn | 43 ++++--------------------------------------- 3 files changed, 9 insertions(+), 44 deletions(-) diff --git a/Autoload/Autoload.gd b/Autoload/Autoload.gd index d18b76d..bc8c8a0 100644 --- a/Autoload/Autoload.gd +++ b/Autoload/Autoload.gd @@ -8,7 +8,7 @@ var last_time : int const PRINT_TIME_EVERY_MILISECONDS : int = 5000 var time_to_print_next_time : int = PRINT_TIME_EVERY_MILISECONDS -var time_to_show: int = 30 * 1000 # How long test works in miliseconds +var time_to_show: int = 15 * 1000 # How long test works in miliseconds var time_for_each_step : int = -1 @@ -32,7 +32,7 @@ const all_in_one : Array = [ ] func _init(): - start_time = OS.get_system_time_msecs() + start_time = OS.get_ticks_msec() # In case when user doesn't provide time time_for_each_step = time_to_show / (alone_steps.size() + 1) @@ -47,7 +47,7 @@ func _init(): func _process(delta: float) -> void: - var current_run_time : int = OS.get_system_time_msecs() - start_time + var current_run_time : int = OS.get_ticks_msec() - start_time if current_run_time > time_to_print_next_time: print("Test is running now " + str(int(time_to_print_next_time / 1000)) + " seconds") diff --git a/Start.gd b/Start.gd index de2be62..d8be7b6 100644 --- a/Start.gd +++ b/Start.gd @@ -15,8 +15,8 @@ func _ready(): func _process(_delta): - if time_to_switch - OS.get_system_time_msecs() <= 0: - time_to_switch = Autoload.time_for_each_step + OS.get_system_time_msecs() + if time_to_switch - OS.get_ticks_msec() <= 0: + time_to_switch = Autoload.time_for_each_step + OS.get_ticks_msec() if current_scene < Autoload.alone_steps.size() - 1: current_scene += 1 diff --git a/Text/Text.tscn b/Text/Text.tscn index 04a001c..65e2c6f 100644 --- a/Text/Text.tscn +++ b/Text/Text.tscn @@ -12,49 +12,14 @@ __meta__ = { } [node name="Label" parent="." instance=ExtResource( 2 )] -margin_top = 142.0 -margin_right = 280.0 -margin_bottom = 156.0 - -[node name="Label2" parent="." instance=ExtResource( 2 )] -margin_left = 284.0 -margin_top = 142.0 -margin_right = 367.0 -margin_bottom = 156.0 - -[node name="Label3" parent="." instance=ExtResource( 2 )] -margin_left = 371.0 -margin_top = 142.0 -margin_right = 454.0 -margin_bottom = 156.0 +margin_top = 293.0 +margin_bottom = 307.0 [node name="RichTextLabel" parent="." instance=ExtResource( 1 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 458.0 -margin_right = 738.0 -margin_bottom = 298.0 -bbcode_text = "Roman -" -text = "Roman -" - -[node name="RichTextLabel2" parent="." instance=ExtResource( 1 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 742.0 -margin_right = 1022.0 -margin_bottom = 298.0 -bbcode_text = "Roman -" -text = "Roman -" - -[node name="RichTextLabel3" parent="." instance=ExtResource( 1 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 302.0 -margin_right = 280.0 +margin_left = 87.0 +margin_right = 321.0 margin_bottom = 600.0 bbcode_text = "Roman "