forked from LGDG/ExampleProject
Compare commits
7 Commits
6c7bb284ff
...
23f77441bc
Author | SHA1 | Date |
---|---|---|
under | 23f77441bc | |
under | 65414609bc | |
under | 64a311a253 | |
under | 845a09a62b | |
under | 359e60d108 | |
under | 0c00aaf3c1 | |
under | 8c8fc8058d |
|
@ -1,29 +1,29 @@
|
|||
extends Node
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
#InputMap.action_get_events()
|
||||
var hotkey = ProjectSettings.get_setting("input/HotKey_ToggleFullscreen")
|
||||
print(InputMap.action_get_events("character_forwards"))
|
||||
print(InputMap.action_get_events("HotKey_ToggleFullscreen"))
|
||||
#print(InputMap.action_get_events("character_forwards"))
|
||||
#print(InputMap.action_get_events("HotKey_ToggleFullscreen"))
|
||||
if hotkey == null:
|
||||
print("PLEASE GO Project->Project Settings... , Input Map, and add HotKey_ToggleFullscreen")
|
||||
InputMap.add_action("HotKey_ToggleFullscreen")
|
||||
#InputMap.action_add_event()
|
||||
print(hotkey)
|
||||
#print(hotkey)
|
||||
|
||||
var temporarl_deadzone : float = 0
|
||||
var temporal_deadzone : float = 0
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if temporal_deadzone > 0.0:
|
||||
temporal_deadzone -= delta
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
#Returns true when the user has started pressing the action event in the current frame or physics tick. It will only return true on the frame or tick that the user pressed down the button.
|
||||
#This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed.
|
||||
if Input.is_action_just_pressed("HotKey_ToggleFullscreen") and temporarl_deadzone <= 0.0:
|
||||
if event.is_action_pressed("HotKey_ToggleFullscreen") and temporal_deadzone <= 0.0:
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
else:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
temporarl_deadzone = 0.5
|
||||
if temporarl_deadzone > 0.0:
|
||||
temporarl_deadzone -= delta
|
||||
|
||||
temporal_deadzone = 0.5
|
||||
|
|
|
@ -4,6 +4,9 @@ extends Control
|
|||
@export var the_game: Control # TheGame
|
||||
var current_window: Control = the_game # current window
|
||||
|
||||
func _ready() -> void:
|
||||
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
|
||||
|
||||
func _process(_delta):
|
||||
#get_window().grab_focus()
|
||||
pass
|
||||
|
|
|
@ -0,0 +1,344 @@
|
|||
[gd_scene load_steps=19 format=3 uid="uid://bedj3x7821sbp"]
|
||||
|
||||
[ext_resource type="Script" path="res://RetroWindowsGUI/DesktopWindow.gd" id="1_1566a"]
|
||||
[ext_resource type="Theme" uid="uid://c23xui480a6b6" path="res://RetroWindowsGUI/RetroWindowsTheme.tres" id="1_clavd"]
|
||||
[ext_resource type="Script" path="res://RetroWindowsGUI/RetroWindow.gd" id="2_5apeq"]
|
||||
[ext_resource type="Texture2D" uid="uid://byysuusmylpjo" path="res://RetroWindowsGUI/Images/Window_Header_Inner.png" id="3_o2go2"]
|
||||
[ext_resource type="Texture2D" uid="uid://f572ckglau50" path="res://RetroWindowsGUI/Images/Windows_Icon_Minimize.png" id="4_p55hd"]
|
||||
[ext_resource type="Texture2D" uid="uid://bir5p8cnwtwrn" path="res://RetroWindowsGUI/Images/Windows_Icon_Maximize.png" id="5_6yn4a"]
|
||||
[ext_resource type="Texture2D" uid="uid://lfo3fn4qyl3g" path="res://RetroWindowsGUI/Images/Windows_Icon_Question.png" id="6_0uvav"]
|
||||
[ext_resource type="Texture2D" uid="uid://bluatk0bspn3x" path="res://RetroWindowsGUI/Images/Windows_Icon_Close.png" id="7_r5i4b"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxtjm7ivsy8s1" path="res://RetroWindowsGUI/Images/Windows_Inner_Frame_Inverted.png" id="8_lxvf8"]
|
||||
[ext_resource type="Script" path="res://RetroWindowsGUI/ResizeHandle.gd" id="9_b570p"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_gihe0"]
|
||||
texture = ExtResource("3_o2go2")
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_ly7j8"]
|
||||
script/source = "extends PanelContainer
|
||||
|
||||
@export var window: DesktopWindow
|
||||
var dragging: bool = false
|
||||
var begmosposi: Vector2i # beginning mouse position integer
|
||||
var begwndpos: Vector2i # beginning window position
|
||||
|
||||
# get windows mouse position integer
|
||||
func getmosposi() -> Vector2i:
|
||||
var mospos := get_global_mouse_position()
|
||||
return Vector2i(floori(mospos.x), floori(mospos.y))
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.is_released():
|
||||
dragging = false
|
||||
# snap within game window
|
||||
var rect = window.get_global_rect()
|
||||
if rect.position.x < 0:
|
||||
rect.position.x = 0
|
||||
if rect.position.y < 0:
|
||||
rect.position.y = 0
|
||||
window.position = rect.position
|
||||
elif event is InputEventMouseMotion:
|
||||
if dragging:
|
||||
window.global_position = begwndpos + getmosposi() - begmosposi
|
||||
|
||||
func _gui_input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.double_click:
|
||||
if get_global_rect().has_point(get_global_mouse_position()):
|
||||
window.toggle_maximized()
|
||||
elif event.pressed:
|
||||
if get_global_rect().has_point(get_global_mouse_position()):
|
||||
dragging = true
|
||||
begmosposi = getmosposi()
|
||||
begwndpos = window.get_global_rect().position
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_fvsxv"]
|
||||
script/source = "extends Button
|
||||
|
||||
@export var window: DesktopWindow
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_on_pressed)
|
||||
|
||||
func _on_pressed():
|
||||
window.minimize()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_orv1v"]
|
||||
script/source = "extends Button
|
||||
|
||||
@export var window: DesktopWindow
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_on_pressed)
|
||||
|
||||
func _on_pressed():
|
||||
window.toggle_maximized()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_go6nd"]
|
||||
script/source = "extends Button
|
||||
|
||||
@export var window: DesktopWindow
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_on_pressed)
|
||||
|
||||
func _on_pressed():
|
||||
window.close()
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yu144"]
|
||||
bg_color = Color(0.831373, 0.815686, 0.784314, 1)
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_eejdr"]
|
||||
content_margin_left = 2.0
|
||||
content_margin_top = 2.0
|
||||
content_margin_right = 2.0
|
||||
content_margin_bottom = 2.0
|
||||
texture = ExtResource("8_lxvf8")
|
||||
texture_margin_left = 3.0
|
||||
texture_margin_top = 3.0
|
||||
texture_margin_right = 3.0
|
||||
texture_margin_bottom = 3.0
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_sn8k8"]
|
||||
texture = ExtResource("8_lxvf8")
|
||||
texture_margin_left = 3.0
|
||||
texture_margin_top = 3.0
|
||||
texture_margin_right = 3.0
|
||||
texture_margin_bottom = 3.0
|
||||
|
||||
[node name="DesktopWindow" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 161.0
|
||||
offset_bottom = 137.0
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("1_clavd")
|
||||
script = ExtResource("1_1566a")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("2_5apeq")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 2
|
||||
|
||||
[node name="PanelContainer (Header)" type="PanelContainer" parent="PanelContainer/VBoxContainer" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(0, 25)
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderPanelContainer"
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_gihe0")
|
||||
script = SubResource("GDScript_ly7j8")
|
||||
window = NodePath("../../..")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)"]
|
||||
custom_minimum_size = Vector2(0, 26)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="MarginContainer (Title)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Title)"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Inventory"
|
||||
|
||||
[node name="MarginContainer (Minimize)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
|
||||
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Minimize)" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_fvsxv")
|
||||
window = NodePath("../../../../../..")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Minimize)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("4_p55hd")
|
||||
|
||||
[node name="MarginContainer (Maximize)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
|
||||
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Maximize)" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_orv1v")
|
||||
window = NodePath("../../../../../..")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Maximize)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("5_6yn4a")
|
||||
|
||||
[node name="MarginContainer (Help)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
|
||||
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Help)"]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Help)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("6_0uvav")
|
||||
|
||||
[node name="MarginContainer (Close)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
theme_override_constants/margin_right = 2
|
||||
|
||||
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Close)" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_go6nd")
|
||||
window = NodePath("../../../../../..")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Close)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("7_r5i4b")
|
||||
|
||||
[node name="PanelContainer (Menu Bar)" type="PanelContainer" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_yu144")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)"]
|
||||
custom_minimum_size = Vector2(0, 16)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"FlatButton"
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_pressed_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_hover_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_focus_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_disabled_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 0)
|
||||
text = "File"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_top = 0
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button/MarginContainer/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
mouse_filter = 2
|
||||
bbcode_enabled = true
|
||||
text = "[u]F[/u]ile"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="PanelContainer (Body)" type="PanelContainer" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_type_variation = &"InvertedInnerPanelContainer"
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_eejdr")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="MarginContainer (Content)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VScrollBar" type="VScrollBar" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 3
|
||||
page = 100.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 15)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="HScrollBar" type="HScrollBar" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(16, 16)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
page = 100.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(16, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PanelContainer (Status Bar)" type="PanelContainer" parent="PanelContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 16)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_sn8k8")
|
||||
|
||||
[node name="Button (Resize Handle)" type="Button" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -17.0
|
||||
offset_top = -18.0
|
||||
offset_right = -5.0
|
||||
offset_bottom = -6.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
theme_type_variation = &"ResizeButton"
|
||||
action_mode = 0
|
||||
keep_pressed_outside = true
|
||||
script = ExtResource("9_b570p")
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=28 format=3 uid="uid://bvc6sgiglgspt"]
|
||||
[gd_scene load_steps=23 format=3 uid="uid://bvc6sgiglgspt"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://c23xui480a6b6" path="res://RetroWindowsGUI/RetroWindowsTheme.tres" id="1_2cwqu"]
|
||||
[ext_resource type="Script" path="res://RetroWindowsGUI/Desktop.gd" id="2_1wlr7"]
|
||||
|
@ -10,9 +10,8 @@
|
|||
[ext_resource type="Texture2D" uid="uid://lfo3fn4qyl3g" path="res://RetroWindowsGUI/Images/Windows_Icon_Question.png" id="6_byeim"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxtjm7ivsy8s1" path="res://RetroWindowsGUI/Images/Windows_Inner_Frame_Inverted.png" id="8_75uw4"]
|
||||
[ext_resource type="PackedScene" uid="uid://dviuoownyvrke" path="res://thirdPerson.tscn" id="9_o80ae"]
|
||||
[ext_resource type="Script" path="res://RetroWindowsGUI/DesktopWindow.gd" id="11_7veoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bedj3x7821sbp" path="res://RetroWindowsGUI/DesktopWindow.tscn" id="11_m0w0q"]
|
||||
[ext_resource type="AudioStream" uid="uid://c51m7ngf7kjdq" path="res://RetroWindowsGUI/me.ogg" id="12_16brn"]
|
||||
[ext_resource type="Script" path="res://RetroWindowsGUI/ResizeHandle.gd" id="12_k07jd"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_74f3x"]
|
||||
bg_color = Color(0, 0, 0, 0.47451)
|
||||
|
@ -38,6 +37,14 @@ func getwinmosposi() -> Vector2i:
|
|||
return DisplayServer.window_get_position() + Vector2i(floori(mospos.x), floori(mospos.y))
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.is_released():
|
||||
dragging = false
|
||||
elif dragging and event is InputEventMouseMotion:
|
||||
DisplayServer.window_set_position(begwinpos + getwinmosposi() - begwinmosposi)
|
||||
|
||||
func _gui_input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.double_click:
|
||||
|
@ -51,11 +58,6 @@ func _input(event: InputEvent):
|
|||
dragging = true
|
||||
begwinmosposi = getwinmosposi()
|
||||
begwinpos = DisplayServer.window_get_position()
|
||||
elif event.is_released():
|
||||
dragging = false
|
||||
elif dragging and event is InputEventMouseMotion:
|
||||
DisplayServer.window_set_position(begwinpos + getwinmosposi() - begwinmosposi)
|
||||
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_2514r"]
|
||||
|
@ -125,81 +127,7 @@ func _on_pressed():
|
|||
invwin.visible = true
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_ly7j8"]
|
||||
script/source = "extends PanelContainer
|
||||
|
||||
@export var window: DesktopWindow
|
||||
var dragging: bool = false
|
||||
var begmosposi: Vector2i # beginning mouse position integer
|
||||
var begwndpos: Vector2i # beginning window position
|
||||
|
||||
# get windows mouse position integer
|
||||
func getmosposi() -> Vector2i:
|
||||
var mospos := get_global_mouse_position()
|
||||
return Vector2i(floori(mospos.x), floori(mospos.y))
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.double_click:
|
||||
if get_global_rect().has_point(get_global_mouse_position()):
|
||||
window.toggle_maximized()
|
||||
elif event.pressed:
|
||||
if get_global_rect().has_point(get_global_mouse_position()):
|
||||
dragging = true
|
||||
begmosposi = getmosposi()
|
||||
begwndpos = window.get_global_rect().position
|
||||
elif event.is_released():
|
||||
dragging = false
|
||||
# snap within game window
|
||||
var rect = window.get_global_rect()
|
||||
if rect.position.x < 0:
|
||||
rect.position.x = 0
|
||||
if rect.position.y < 0:
|
||||
rect.position.y = 0
|
||||
window.position = rect.position
|
||||
elif event is InputEventMouseMotion:
|
||||
if dragging:
|
||||
window.global_position = begwndpos + getmosposi() - begmosposi
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_fvsxv"]
|
||||
script/source = "extends Button
|
||||
|
||||
@export var window: DesktopWindow
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_on_pressed)
|
||||
|
||||
func _on_pressed():
|
||||
window.minimize()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_orv1v"]
|
||||
script/source = "extends Button
|
||||
|
||||
@export var window: DesktopWindow
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_on_pressed)
|
||||
|
||||
func _on_pressed():
|
||||
window.toggle_maximized()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_go6nd"]
|
||||
script/source = "extends Button
|
||||
|
||||
@export var window: DesktopWindow
|
||||
|
||||
func _ready():
|
||||
pressed.connect(_on_pressed)
|
||||
|
||||
func _on_pressed():
|
||||
window.close()
|
||||
"
|
||||
|
||||
[node name="Desktop" type="Control"]
|
||||
[node name="Desktop" type="Control" node_paths=PackedStringArray("the_game")]
|
||||
texture_filter = 1
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
@ -209,6 +137,7 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
theme = ExtResource("1_2cwqu")
|
||||
script = ExtResource("2_1wlr7")
|
||||
the_game = NodePath("VBoxContainer/MaximizedWindows/TheGame")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="BrightnessFilter" type="Panel" parent="."]
|
||||
|
@ -481,246 +410,29 @@ text = "Start"
|
|||
layout_mode = 2
|
||||
text = "The Game"
|
||||
|
||||
[node name="Button (Inventory)" type="Button" parent="VBoxContainer/TaskBar/HBoxContainer" node_paths=PackedStringArray("invwin")]
|
||||
[node name="Button (Inventory)" type="Button" parent="VBoxContainer/TaskBar/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Inventory
|
||||
"
|
||||
script = SubResource("GDScript_2vlp5")
|
||||
invwin = NodePath("../../../../Inventory")
|
||||
|
||||
[node name="Inventory" type="Control" parent="." node_paths=PackedStringArray("desktop", "maximized_windows", "taskbar")]
|
||||
layout_mode = 2
|
||||
anchors_preset = 0
|
||||
offset_left = 100.0
|
||||
offset_top = 100.0
|
||||
offset_right = 261.0
|
||||
offset_bottom = 282.0
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("11_7veoj")
|
||||
[node name="DesktopWindow" parent="." node_paths=PackedStringArray("desktop", "maximized_windows", "taskbar") instance=ExtResource("11_m0w0q")]
|
||||
offset_left = 132.0
|
||||
offset_top = 185.0
|
||||
offset_right = 293.0
|
||||
offset_bottom = 320.0
|
||||
desktop = NodePath("..")
|
||||
maximized_windows = NodePath("../VBoxContainer/MaximizedWindows")
|
||||
taskbar = NodePath("../VBoxContainer/TaskBar")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Inventory"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("2_5t0g8")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Inventory/PanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 2
|
||||
|
||||
[node name="PanelContainer (Header)" type="PanelContainer" parent="Inventory/PanelContainer/VBoxContainer" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(0, 25)
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderPanelContainer"
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_gihe0")
|
||||
script = SubResource("GDScript_ly7j8")
|
||||
window = NodePath("../../..")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)"]
|
||||
custom_minimum_size = Vector2(0, 26)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="MarginContainer (Title)" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
|
||||
[node name="Label" type="Label" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Title)"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Inventory"
|
||||
|
||||
[node name="MarginContainer (Minimize)" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
|
||||
[node name="Button" type="Button" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Minimize)" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_fvsxv")
|
||||
window = NodePath("../../../../../..")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Minimize)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("2_2k613")
|
||||
|
||||
[node name="MarginContainer (Maximize)" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
|
||||
[node name="Button" type="Button" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Maximize)" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_orv1v")
|
||||
window = NodePath("../../../../../..")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Maximize)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("3_6tl28")
|
||||
|
||||
[node name="MarginContainer (Help)" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
|
||||
[node name="Button" type="Button" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Help)"]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Help)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("6_byeim")
|
||||
|
||||
[node name="MarginContainer (Close)" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 2
|
||||
theme_override_constants/margin_top = 6
|
||||
theme_override_constants/margin_right = 2
|
||||
|
||||
[node name="Button" type="Button" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Close)" node_paths=PackedStringArray("window")]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_go6nd")
|
||||
window = NodePath("../../../../../..")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Close)"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("4_b1wjg")
|
||||
|
||||
[node name="PanelContainer (Menu Bar)" type="PanelContainer" parent="Inventory/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_yu144")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Menu Bar)"]
|
||||
custom_minimum_size = Vector2(0, 16)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Button" type="Button" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"FlatButton"
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_pressed_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_hover_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_focus_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_disabled_color = Color(0, 0, 0, 0)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 0)
|
||||
text = "File"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_top = 0
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button/MarginContainer/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
mouse_filter = 2
|
||||
bbcode_enabled = true
|
||||
text = "[u]F[/u]ile"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="PanelContainer (Body)" type="PanelContainer" parent="Inventory/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_type_variation = &"InvertedInnerPanelContainer"
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_eejdr")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="MarginContainer (Content)" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VScrollBar" type="VScrollBar" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 3
|
||||
page = 100.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 15)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="HScrollBar" type="HScrollBar" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(16, 16)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
page = 100.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Inventory/PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(16, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PanelContainer (Status Bar)" type="PanelContainer" parent="Inventory/PanelContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 16)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_sn8k8")
|
||||
|
||||
[node name="Button (Resize Handle)" type="Button" parent="Inventory"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -17.0
|
||||
offset_top = -18.0
|
||||
offset_right = -5.0
|
||||
offset_bottom = -6.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
theme_type_variation = &"ResizeButton"
|
||||
action_mode = 0
|
||||
keep_pressed_outside = true
|
||||
script = ExtResource("12_k07jd")
|
||||
[node name="DesktopWindow2" parent="." node_paths=PackedStringArray("desktop", "maximized_windows", "taskbar") instance=ExtResource("11_m0w0q")]
|
||||
offset_left = 190.0
|
||||
offset_top = 197.0
|
||||
offset_right = 351.0
|
||||
offset_bottom = 332.0
|
||||
desktop = NodePath("..")
|
||||
maximized_windows = NodePath("../VBoxContainer/MaximizedWindows")
|
||||
taskbar = NodePath("../VBoxContainer/TaskBar")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("12_16brn")
|
||||
|
|
|
@ -11,15 +11,11 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="LgdgExampleProject"
|
||||
run/main_scene="res://RetroWindowsGUI/Window.tscn"
|
||||
run/main_scene="res://thirdPerson.tscn"
|
||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
run/size/borderless=false
|
||||
|
||||
[display]
|
||||
|
||||
window/size/borderless=true
|
||||
|
||||
[input]
|
||||
|
||||
ui_accept={
|
||||
|
|
Loading…
Reference in New Issue