From 2d7902c31ccac287c1f618fdf983eda42c4faa11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?= <52170489+GerardGascon@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:54:35 +0200 Subject: [PATCH] feat: base scene working --- base.tscn | 7 +++++-- scripts/window.gd | 17 +++++++++++++++++ scripts/window.gd.uid | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 scripts/window.gd create mode 100644 scripts/window.gd.uid diff --git a/base.tscn b/base.tscn index 1e79217..60a3d75 100644 --- a/base.tscn +++ b/base.tscn @@ -1,9 +1,12 @@ -[gd_scene load_steps=2 format=3 uid="uid://ctytpqaed0yqx"] +[gd_scene load_steps=3 format=3 uid="uid://ctytpqaed0yqx"] +[ext_resource type="Script" uid="uid://3kyt3shje5r1" path="res://scripts/window.gd" id="1_3vi8l"] [ext_resource type="Texture2D" uid="uid://fdqnc2qrrvn1" path="res://icon.svg" id="1_rpg24"] [node name="Base" type="Node2D"] +script = ExtResource("1_3vi8l") [node name="Icon" type="Sprite2D" parent="."] -position = Vector2(450, 303) +position = Vector2(576, 324) +scale = Vector2(9, 5.0625) texture = ExtResource("1_rpg24") diff --git a/scripts/window.gd b/scripts/window.gd new file mode 100644 index 0000000..8734ef8 --- /dev/null +++ b/scripts/window.gd @@ -0,0 +1,17 @@ +extends Node + +func _ready(): + await get_tree().process_frame + move_window_to_bottom_right() + +func move_window_to_bottom_right(): + var display_index = DisplayServer.window_get_current_screen() + + var work_area_position = DisplayServer.screen_get_usable_rect(display_index).position + var work_area_size = DisplayServer.screen_get_usable_rect(display_index).size + + var window_size = DisplayServer.window_get_size() + + var new_position = work_area_position + Vector2i(work_area_size.x - window_size.x, work_area_size.y - window_size.y) + + DisplayServer.window_set_position(new_position) diff --git a/scripts/window.gd.uid b/scripts/window.gd.uid new file mode 100644 index 0000000..f67b0c4 --- /dev/null +++ b/scripts/window.gd.uid @@ -0,0 +1 @@ +uid://3kyt3shje5r1