aboutsummaryrefslogtreecommitdiff
path: root/main.gd
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-06-23 11:03:00 +0000
committerdam <dam@gudinoff>2022-06-23 11:03:00 +0000
commita386c7cc16f7c2f374908424f4703a66e339bee9 (patch)
tree06da2bb0f15dd37aca8163557a35e1e4b175e121 /main.gd
parent44d634db3f42ae60b42a1a20892d11faabc3c1b0 (diff)
downloadsurgery-log-a386c7cc16f7c2f374908424f4703a66e339bee9.tar.zst
surgery-log-a386c7cc16f7c2f374908424f4703a66e339bee9.zip
Implemented day and night themes.
Diffstat (limited to 'main.gd')
-rw-r--r--main.gd8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.gd b/main.gd
index 5d17d68..09e1963 100644
--- a/main.gd
+++ b/main.gd
@@ -6,6 +6,7 @@ var themes := [
preload("res://themes/day.tres") as Theme,
preload("res://themes/night.tres") as Theme
]
+var os_name := OS.get_name()
onready var settings := Settings.new()
onready var popup := get_node("/root/main/popup") as ModalPopup
@@ -22,7 +23,7 @@ func _init():
Physics2DServer.set_active(false)
PhysicsServer.set_active(false)
- if OS.get_name() == "Android":
+ if os_name == "Android":
var permissions := Array(OS.get_granted_permissions())
if permissions.has("android.permission.READ_EXTERNAL_STORAGE") == false \
or permissions.has("android.permission.WRITE_EXTERNAL_STORAGE") == false:
@@ -30,6 +31,9 @@ func _init():
func _ready():
+ if os_name != "Android" && os_name != "iOS":
+ get_tree().set_screen_stretch (SceneTree.STRETCH_MODE_DISABLED, SceneTree.STRETCH_ASPECT_IGNORE, Vector2.ONE, 0.75)
+
Input.set_use_accumulated_input(false)
apply_theme(settings.get_value("theme_index", 0))
keyboard_height_offset = OS.get_virtual_keyboard_height()
@@ -82,7 +86,7 @@ func toggle_theme():
func apply_theme(theme_idx: int) -> void:
- self.theme = themes[theme_idx]
+ self.theme = themes[theme_idx%themes.size()] # Avoids out-of-array index.
VisualServer.set_default_clear_color(get_color("background", "Misc"))