aboutsummaryrefslogtreecommitdiff
path: root/main.gd
diff options
context:
space:
mode:
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"))