mirror of
https://github.com/tonytins/dressupzack
synced 2025-05-05 13:34:48 -04:00
Resize default window size times 3 on Retina displays
This commit is contained in:
parent
39bcdcb78c
commit
a4a7c62e79
3 changed files with 26 additions and 11 deletions
|
@ -123,7 +123,7 @@ script = ExtResource("1_k1mtq")
|
|||
position = Vector2(-33.7592, 99.4079)
|
||||
scale = Vector2(0.927713, 1)
|
||||
sprite_frames = SubResource("1")
|
||||
frame_progress = 0.472335
|
||||
frame_progress = 0.0205252
|
||||
|
||||
[node name="Body" type="Sprite2D" parent="."]
|
||||
position = Vector2(12, 81)
|
||||
|
@ -132,9 +132,9 @@ texture = ExtResource("5_i8wm6")
|
|||
[node name="Eyes" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(28.6857, -15.7785)
|
||||
sprite_frames = SubResource("2")
|
||||
frame_progress = 0.389606
|
||||
frame_progress = 0.937796
|
||||
|
||||
[node name="Mouth" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(49.1195, -14.3155)
|
||||
sprite_frames = SubResource("3")
|
||||
frame_progress = 0.509661
|
||||
frame_progress = 0.0578512
|
||||
|
|
|
@ -20,9 +20,18 @@ func save_config(config_file = "user://config.cfg"):
|
|||
# Create new ConfigFile object.
|
||||
var config = ConfigFile.new()
|
||||
|
||||
# Store some values.
|
||||
config.set_value("window", "height", 1024)
|
||||
config.set_value("window", "width", 768)
|
||||
var window_size = "display/window/size/";
|
||||
var default_width = ProjectSettings.get_setting(window_size + "viewport_width")
|
||||
var default_height = ProjectSettings.get_setting(window_size + "viewport_height")
|
||||
|
||||
# If Retina display, set a higher resolution
|
||||
var screen_scale = DisplayServer.screen_get_scale();
|
||||
if screen_scale == 2:
|
||||
config.set_value("window", "width", default_width * 3)
|
||||
config.set_value("window", "height", default_height * 3)
|
||||
else:
|
||||
config.set_value("window", "width", default_width)
|
||||
config.set_value("window", "height", default_height)
|
||||
|
||||
# Save it to a file (overwrite if already exists)
|
||||
if !FileAccess.file_exists(config_file):
|
||||
|
|
|
@ -16,25 +16,31 @@ var save_file = Config.save_file()
|
|||
|
||||
func _ready():
|
||||
|
||||
# If config files don't exist, create them
|
||||
if !FileAccess.file_exists(config_file):
|
||||
Config.save_config(config_file)
|
||||
|
||||
if !FileAccess.file_exists(save_file):
|
||||
Config.save_game(save_file)
|
||||
|
||||
# Load last saved game
|
||||
if FileAccess.file_exists(save_file):
|
||||
var clothes_section = "clothes"
|
||||
tops.frame = Config.load_config(clothes_section, "tops", save_file)
|
||||
bottoms.frame = Config.load_config(clothes_section, "bottoms", save_file)
|
||||
full_body.frame = Config.load_config(clothes_section, "full_body", save_file)
|
||||
|
||||
# Load window size
|
||||
if FileAccess.file_exists(config_file):
|
||||
var window_section = "window"
|
||||
var window_height = Config.load_config(window_section, "height", config_file)
|
||||
var window_width = Config.load_config(window_section, "width", config_file)
|
||||
var viewport = get_viewport();
|
||||
|
||||
# Set window size
|
||||
DisplayServer.window_set_size(Vector2i(window_width, window_height))
|
||||
|
||||
|
||||
if window_height && window_width != null:
|
||||
DisplayServer.window_set_size(Vector2i(window_height, window_width))
|
||||
func game_save():
|
||||
Config.save_game(tops.frame, bottoms.frame, full_body.frame, save_file, true)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue