diff options
| author | dam <dam@gudinoff> | 2022-06-23 11:03:00 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-06-23 11:03:00 +0000 |
| commit | a386c7cc16f7c2f374908424f4703a66e339bee9 (patch) | |
| tree | 06da2bb0f15dd37aca8163557a35e1e4b175e121 /main.gd | |
| parent | 44d634db3f42ae60b42a1a20892d11faabc3c1b0 (diff) | |
| download | surgery-log-a386c7cc16f7c2f374908424f4703a66e339bee9.tar.zst surgery-log-a386c7cc16f7c2f374908424f4703a66e339bee9.zip | |
Implemented day and night themes.
Diffstat (limited to 'main.gd')
| -rw-r--r-- | main.gd | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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")) |
