Initial Android commit
This commit is contained in:
commit
1e2b80c13d
8521 changed files with 231475 additions and 0 deletions
55
scripts/SettingsScene.gd
Normal file
55
scripts/SettingsScene.gd
Normal file
|
@ -0,0 +1,55 @@
|
|||
extends Node2D
|
||||
|
||||
func _ready():
|
||||
SetBackground();
|
||||
|
||||
$Temp / Settings.setType(0);
|
||||
var _temp = $Temp / Settings.connect("BackFromSettings", self, "backFromSettings")
|
||||
_temp = $Temp / Settings.connect("ResolutionChanged", self, "resolutionChanged")
|
||||
|
||||
func SetBackground():
|
||||
var windowSize = SettingsSingleton.GetCurrectScreenResolutionVector2()
|
||||
|
||||
$Blur.set_polygon(PoolVector2Array([
|
||||
Vector2(0, 0),
|
||||
Vector2(0, windowSize.y),
|
||||
Vector2(windowSize.x, windowSize.y),
|
||||
Vector2(windowSize.x, 0)
|
||||
]))
|
||||
|
||||
var backgroundsSize = Vector2(3840, 2160);
|
||||
var scaleX = 1 / float(backgroundsSize.x / windowSize.x);
|
||||
var scaleY = 1 / float(backgroundsSize.y / windowSize.y);
|
||||
$House.scale = Vector2(scaleX, scaleY);
|
||||
|
||||
var cloudH = 2160;
|
||||
|
||||
var cloudScale = windowSize.y * 0.53 / cloudH;
|
||||
|
||||
$Cloud1.scale = Vector2(cloudScale, cloudScale);
|
||||
$Cloud3.scale = Vector2(cloudScale, cloudScale);
|
||||
|
||||
func backFromSettings():
|
||||
if not SceneLoader.is_connected("on_scene_loaded", self, "MenuLoaded"):
|
||||
var _temp = SceneLoader.connect("on_scene_loaded", self, "MenuLoaded");
|
||||
SceneLoader.load_scene("res://scenes/MainMenu.tscn")
|
||||
|
||||
func MenuLoaded(obj):
|
||||
if obj.path != "res://scenes/MainMenu.tscn":
|
||||
return
|
||||
if obj.instance != null:
|
||||
get_tree().root.add_child(obj.instance);
|
||||
|
||||
for i in get_tree().root.get_children():
|
||||
if i.name == "SettingsScene":
|
||||
get_tree().root.remove_child(i);
|
||||
break;
|
||||
|
||||
SceneLoader.disconnect("on_scene_loaded", self, "MenuLoaded");
|
||||
|
||||
func resolutionChanged():
|
||||
SetBackground();
|
||||
|
||||
func _input(ev):
|
||||
if ev is InputEventKey and ev.scancode == KEY_ESCAPE:
|
||||
backFromSettings();
|
Loading…
Add table
Add a link
Reference in a new issue