home scene

This commit is contained in:
Nordup 2024-11-21 05:20:31 +04:00
parent 5fe170dfc6
commit cce0bedbb1
21 changed files with 559 additions and 131 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

View file

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d34gqxl8s8vne"
path.s3tc="res://.godot/imported/icon.png-a7092b8839b5f5cb0339bb8ff99972fb.s3tc.ctex"
path.etc2="res://.godot/imported/icon.png-a7092b8839b5f5cb0339bb8ff99972fb.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}
[deps]
source_file="res://addons/max_size_container/icon.png"
dest_files=["res://.godot/imported/icon.png-a7092b8839b5f5cb0339bb8ff99972fb.s3tc.ctex", "res://.godot/imported/icon.png-a7092b8839b5f5cb0339bb8ff99972fb.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,301 @@
# Made by Matthieu Huvé
# Ported for Godot 4 Beta 10 by Benedikt Wicklein
# Updated for Godot 4.x by Brom Bresenham (tested on Godot 4.2-dev2)
## Limits the size of its single child node to arbitrary dimensions.
@tool
@icon("res://addons/max_size_container/icon.png")
class_name MaxSizeContainer
extends MarginContainer
# Enums
enum MODE
{
PIXEL_SIZE, ## Limits the child to a specific pixel size.
ASPECT_FIT, ## Constrains the child to a specific aspect ratio. [member limit] is used as a ratio; (4,3) is equivalent to (8,6).
ASPECT_OR_WIDER, ## [member limit] specifies the narrowest allowed aspect ratio.
ASPECT_OR_TALLER ## [member limit] specifies the shortest allowed aspect ratio.
}
enum {LEFT, RIGHT, TOP, BOTTOM}
enum VERTICAL_ALIGN
{
TOP, ## Align with the top side of this MaxSizeContainer.
CENTER, ## Center vertically within this MaxSizeContainer.
BOTTOM ## Align with the bottom side of this MaxSizeContainer.
}
enum HORIZONTAL_ALIGN
{
LEFT, ## Align with the left side of this MaxSizeContainer.
CENTER, ## Center horizontally within this MaxSizeContainer.
RIGHT ## Align with the right side of this MaxSizeContainer.
}
# Parameters
## The constraint mode of this container.
@export var mode := MODE.PIXEL_SIZE:
set(value):
if value == mode: return
mode = value
if value == MODE.PIXEL_SIZE:
limit = pixel_limit
else:
limit = aspect_limit
## In Pixel Size mode, the maximum size the child node is allowed to be, or '-1' for no limit. In other modes, an aspect ratio, where (4,3) is equivalent to (8,6), and so on.
@export var limit := Vector2(-1, -1):
set(value):
if mode == MODE.PIXEL_SIZE:
if value.x < 0: value.x = -1
if value.y < 0: value.y = -1
limit = value
pixel_limit = value
max_size = value
else:
if value.x <= 0: value.x = 1
if value.y <= 0: value.y = 1
limit = value
aspect_limit = value
if is_initialized:
_adapt_margins()
## How the child node is vertically aligned within the excess space once it has reached its maximum height.
@export var valign := VERTICAL_ALIGN.CENTER:
set(value):
valign = value
if is_initialized:
_adapt_margins()
## How the child node is horizontally aligned within the excess space once it has reached its maximum width.
@export var halign := HORIZONTAL_ALIGN.CENTER:
set(value):
halign = value
if is_initialized:
_adapt_margins()
var max_size := Vector2(-1,-1)
var pixel_limit := Vector2(-1,-1)
var aspect_limit := Vector2(1,1)
# child node of the container
var child : Node
# Intern var
var minimum_child_size : Vector2
var is_size_valid := {"x": false, "y": false}
var is_initialized := false
var is_resizing := false # infinite recursion guard
func _ready() -> void:
# Reset custom margins if modified from the editor
_set_custom_margin(LEFT, 0)
_set_custom_margin(RIGHT, 0)
_set_custom_margin(TOP, 0)
_set_custom_margin(BOTTOM, 0)
# Sets up the Container
resized.connect(_on_self_resized)
child_entered_tree.connect( _on_child_entered_tree )
child_exiting_tree.connect( _on_child_exiting_tree )
if get_child_count() > 0:
_initialize(get_child(0))
func _initialize(p_child: Node) -> void:
# Sets the child node
if not p_child: return
child = p_child
minimum_child_size = p_child.get_combined_minimum_size()
p_child.minimum_size_changed.connect( _on_child_minimum_size_changed )
_adapt_margins()
# Tells other parts that the child node is ready
# important to avoid early calculations that give wrong minimum child size
is_initialized = true
func _update_maximum_size():
if mode != MODE.PIXEL_SIZE:
var fit_w = size.y * (aspect_limit.x / aspect_limit.y) # aspect pixel width given current height
var fit_h = size.x * (aspect_limit.y / aspect_limit.x) # aspect pixel height given current width
match mode:
MODE.ASPECT_FIT:
if fit_w <= size.x:
max_size.x = fit_w
max_size.y = size.y
else:
max_size.x = size.x
max_size.y = fit_h
MODE.ASPECT_OR_WIDER:
if fit_w <= size.x:
max_size.x = -1
max_size.y = size.y
else:
max_size.x = -1
max_size.y = fit_h
MODE.ASPECT_OR_TALLER:
if fit_w <= size.x:
max_size.x = fit_w
max_size.y = -1
else:
max_size.x = size.x
max_size.y = -1
_validate_maximum_size()
func _validate_maximum_size() -> void:
# This function checks if the child is smaller than max_size.
# Otherwise there would be a risk of infinite margins
if child == null:
return
if max_size.x < 0:
is_size_valid.x = false
elif minimum_child_size.x > max_size.x:
is_size_valid.x = false
push_warning(str("max_size ( ", max_size, " ) ignored on x axis: too small.",
"The minimum possible size is: ", minimum_child_size))
else:
is_size_valid.x = true
if max_size.y < 0:
is_size_valid.y = false
elif minimum_child_size.y > max_size.y:
is_size_valid.y = false
push_warning(str("max_size ( ", max_size, " ) ignored on y axis: too small.",
"The minimum possible size is: ", minimum_child_size))
else:
is_size_valid.y = true
func _adapt_margins() -> void:
# Adapts the margin to keep the child size below max_size
_update_maximum_size() # adjusts & validates max size for aspect modes
var rect_size := size
# If the container size is smaller than the max size, no margins are necessary
if rect_size.x < max_size.x:
_set_custom_margin(LEFT, 0)
_set_custom_margin(RIGHT, 0)
if rect_size.y < max_size.y:
_set_custom_margin(TOP, 0)
_set_custom_margin(BOTTOM, 0)
### x ###
# If the max_size is smaller than the child's size: ignore it
if not is_size_valid.x:
_set_custom_margin(LEFT, 0)
_set_custom_margin(RIGHT, 0)
# Else, adds margins to keep the child's rect_size below the max_size
elif rect_size.x >= max_size.x:
var new_margin_left : int
var new_margin_right : int
match halign:
HORIZONTAL_ALIGN.LEFT:
new_margin_left = 0
new_margin_right = int(rect_size.x - max_size.x)
HORIZONTAL_ALIGN.CENTER:
new_margin_left = int((rect_size.x - max_size.x) / 2)
new_margin_right = int((rect_size.x - max_size.x) / 2)
HORIZONTAL_ALIGN.RIGHT:
new_margin_left = int(rect_size.x - max_size.x)
new_margin_right = 0
_set_custom_margin(LEFT, new_margin_left)
_set_custom_margin(RIGHT, new_margin_right)
### y ###
# If the max_size is smaller than the child's size: ignore it
if not is_size_valid.y:
_set_custom_margin(TOP, 0)
_set_custom_margin(BOTTOM, 0)
# Else, adds margins to keep the child's rect_size below the max_size
elif rect_size.y >= max_size.y:
var new_margin_top : int
var new_margin_bottom : int
match valign:
VERTICAL_ALIGN.TOP:
new_margin_top = 0
new_margin_bottom = int(rect_size.y - max_size.y)
VERTICAL_ALIGN.CENTER:
new_margin_top = int((rect_size.y - max_size.y) / 2)
new_margin_bottom = int((rect_size.y - max_size.y) / 2)
VERTICAL_ALIGN.BOTTOM:
new_margin_top = int(rect_size.y - max_size.y)
new_margin_bottom = 0
_set_custom_margin(TOP, new_margin_top)
_set_custom_margin(BOTTOM, new_margin_bottom)
func _set_custom_margin(side : int, value : int) -> void:
# This function makes custom constants modifications easier
match side:
LEFT: add_theme_constant_override("margin_left", value)
RIGHT: add_theme_constant_override("margin_right", value)
TOP: add_theme_constant_override("margin_top", value)
BOTTOM: add_theme_constant_override("margin_bottom", value)
func _on_self_resized() -> void:
# To avoid errors in tool mode and setup, the container must be fully ready
if is_initialized and not is_resizing:
is_resizing = true
_adapt_margins()
is_resizing = false
func _on_child_entered_tree( p_child:Node ) -> void:
if get_child_count() == 1:
_initialize( p_child )
else:
push_warning(str("MaxSizeContainer can only handle one child. ", p_child.name,
" will be ignored because ", get_child(0).name, " is the first child."))
func _on_child_exiting_tree( p_child:Node ) -> void:
if not p_child == child:
# Some other child that we're not paying attention to is being removed
return
# Stops margin calculations
is_initialized = false
# Disconnect signals
p_child.minimum_size_changed.disconnect( _on_child_minimum_size_changed )
child = null
# Reset custom margins
_set_custom_margin(LEFT, 0)
_set_custom_margin(RIGHT, 0)
_set_custom_margin(TOP, 0)
_set_custom_margin(BOTTOM, 0)
if get_child_count() > 1:
# There will still be at least one node remaining. Reinitialize and manage it.
for i in range( get_child_count() ):
var cur = get_child(i)
if cur != p_child:
_initialize( cur )
break
func _on_child_minimum_size_changed() -> void:
minimum_child_size = child.get_combined_minimum_size()
_validate_maximum_size()

View file

@ -0,0 +1,13 @@
[plugin]
name="Max Size Container"
description="This is a custom container that limits its child maximum size.
1. Add a Control node as a child
2. Set its maximum width and height
3. Choose how to align the child node when the maximum size is reached
Note that the container can only accept 1 child."
author="Brom Bresenham"
version="1.3"
script="plugin.gd"

View file

@ -0,0 +1,12 @@
@tool
extends EditorPlugin
func _enter_tree():
# Initialization of the plugin goes here.
# Add the new type with a name, a parent type, a script and an icon.
add_custom_type("MaxSizeContainer", "MarginContainer", preload("max_size_container.gd"), preload("icon.png"))
func _exit_tree():
# Clean-up of the plugin goes here.
# Always remember to remove it from the engine when deactivated.
remove_custom_type("MaxSizeContainer")

View file

@ -7,47 +7,13 @@
viewBox="0 0 67.733334 67.733337"
version="1.1"
id="svg5"
inkscape:export-filename="icon_256.png"
inkscape:export-xdpi="25.4"
inkscape:export-ydpi="25.4"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="icon-round-2.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="false"
inkscape:document-units="mm"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.50000003"
inkscape:cx="189.99999"
inkscape:cy="-80.999996"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
inkscape:showpageshadow="0"
inkscape:deskcolor="#505050"
showborder="true" />
<defs
id="defs2">
<linearGradient
id="linearGradient1"
inkscape:collect="always">
id="linearGradient1">
<stop
style="stop-color:#9e9efa;stop-opacity:1;"
offset="0"
@ -58,56 +24,81 @@
id="stop2" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5268">
<stop
style="stop-color:#9e9efa;stop-opacity:1"
offset="0"
id="stop5264" />
<stop
style="stop-color:#3400ae;stop-opacity:1"
offset="1"
id="stop5266" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient5268"
id="linearGradient5274"
x1="5e-07"
y1="5e-07"
x2="256"
y2="256"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.234375,0,0,0.234375,1.7361666,4.000006)" />
<linearGradient
xlink:href="#linearGradient5268"
id="linearGradient967"
gradientUnits="userSpaceOnUse"
x1="5e-07"
y1="5e-07"
x2="256"
y2="256"
gradientTransform="matrix(0.23437499,0,0,0.23437499,1.7361669,4.0000003)" />
<linearGradient
xlink:href="#linearGradient1"
id="linearGradient2"
x1="10.522916"
y1="12.786757"
x2="52.949112"
y2="55.212955"
x1="8.4428892"
y1="10.706723"
x2="55.029442"
y2="57.293278"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.1058338,0,0,1.1058338,-3.3587443,-3.5983352)" />
gradientTransform="matrix(0.91069626,0,0,0.91069626,2.83401,3.0361791)" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(2.2638371)">
<rect
style="display:none;opacity:0.987203;fill:url(#linearGradient5274);fill-opacity:1;fill-rule:nonzero;stroke:#000080;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
id="rect882"
width="59.999996"
height="59.999996"
x="1.7361667"
y="4"
ry="0" />
<rect
style="display:none;opacity:0.987203;fill:url(#linearGradient967);fill-opacity:1;fill-rule:nonzero;stroke:#000080;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
id="rect903"
width="59.999996"
height="59.999996"
x="1.736167"
y="4.0000005"
ry="10.583333"
rx="10.583333" />
<circle
style="display:inline;fill:url(#linearGradient2);fill-opacity:1;stroke:#000080;stroke-width:0;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
style="display:inline;fill:url(#linearGradient2);stroke:#000080;stroke-width:0;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
id="path1"
cx="31.736015"
cy="33.999855"
r="33.174854" />
<circle
style="display:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000080;stroke-width:0;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
id="circle2"
cx="31.736015"
cy="33.999855"
r="33.174854" />
<circle
style="display:none;fill:#ffffff;fill-opacity:1;stroke:#000080;stroke-width:0;stroke-linecap:round;stroke-dasharray:none"
id="path2"
cx="31.736198"
cy="34.000034"
r="2.4857001" />
r="29.999853" />
<path
style="display:none;fill:none;stroke:#ffffff;stroke-width:1.52622;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:40.2195;stroke-opacity:1"
d="m 28.446838,37.694758 c 0,0 0,-5.144147 0,-5.958098 0,-0.813953 0.247336,-3.723813 3.289366,-3.723813 3.054974,0 3.289367,2.90924 3.289367,3.723813 v 5.958098"
id="path2550"
sodipodi:nodetypes="csscc"
inkscape:label="small" />
style="display:inline;fill:none;stroke:#ffffff;stroke-width:1.228;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:40.2195;stroke-opacity:1"
d="m 29.089536,36.972782 c 0,0 0,-4.138992 0,-4.793899 0,-0.654908 0.199007,-2.996188 2.646631,-2.996188 2.458039,0 2.646632,2.340781 2.646632,2.996188 v 4.793899"
id="path2550" />
<path
style="display:inline;fill:none;stroke:#ffffff;stroke-width:3.51213;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:40.2195;stroke-opacity:1"
d="m 24.576552,44.007247 c 0,0 0,-11.233378 0,-13.01082 0,-1.777445 0.538349,-8.131764 7.159632,-8.131764 6.649449,0 7.159632,6.352963 7.159632,8.131764 v 13.01082"
id="path2547"
sodipodi:nodetypes="csscc"
inkscape:label="medium" />
style="display:inline;fill:none;stroke:#ffffff;stroke-width:2.676;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:40.2195;stroke-opacity:1"
d="m 24.750141,43.768465 c 0,0 0,-10.925247 0,-12.653935 0,-1.728689 0.525295,-7.90871 6.986026,-7.90871 6.488214,0 6.986026,6.178703 6.986026,7.90871 v 12.653935"
id="path2547" />
<path
style="display:inline;fill:none;stroke:#ffffff;stroke-width:5.75033;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:40.2195;stroke-opacity:1"
d="m 16.365089,56.116692 c 0,0 0,-23.73687 0,-27.49273 0,-3.75586 1.155789,-17.182957 15.371091,-17.182957 14.275767,0 15.371089,13.424236 15.371089,17.182957 v 27.49273"
id="path1246"
sodipodi:nodetypes="csscc"
inkscape:label="big" />
style="display:inline;fill:none;stroke:#ffffff;stroke-width:5.2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:40.2195;stroke-opacity:1"
d="m 17.746746,54.736312 c 0,0 0,-21.877798 0,-25.3395 0,-3.461699 1.051899,-15.837186 13.98942,-15.837186 12.99255,0 13.989417,12.37285 13.989417,15.837186 v 25.3395"
id="path1246" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Before After
Before After

View file

@ -3,8 +3,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bw1cffhlt112i"
path.bptc="res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.bptc.ctex"
path.astc="res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.astc.ctex"
path.s3tc="res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.s3tc.ctex"
path.etc2="res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
@ -13,12 +13,12 @@ metadata={
[deps]
source_file="res://assets/textures/icon-round.svg"
dest_files=["res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.bptc.ctex", "res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.astc.ctex"]
dest_files=["res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.s3tc.ctex", "res://.godot/imported/icon-round.svg-960dde2a3cd6f3751096cc6c33335de2.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=true
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
@ -34,6 +34,6 @@ process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=0.5
svg/scale=0.75
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -29,7 +29,7 @@ driver/enable_input=true
DataSaver="*res://scripts/data_saver.gd"
FileDownloader="*res://scripts/loading/file_downloader.gd"
Debug="*res://scripts/debug-log/debug.gd"
Debug="*res://scripts/debug_log/debug.gd"
AnalyticsEvents="*res://scripts/api/analytics/analytics_events.gd"
Backend="*res://scripts/api/backend.gd"
@ -53,6 +53,10 @@ window/per_pixel_transparency/allowed=true
naming/script_name_casing=2
[editor_plugins]
enabled=PackedStringArray("res://addons/max_size_container/plugin.cfg")
[gui]
theme/custom_font="res://assets/fonts/Inter-Regular.otf"

View file

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://scripts/app.gd" id="1_skc7d"]
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_cdryv"]
[ext_resource type="PackedScene" uid="uid://pgl3w7q5w84m" path="res://scenes/menu_body/bookmarks.tscn" id="3_l8glb"]
[ext_resource type="PackedScene" uid="uid://ca647gp63bshc" path="res://scenes/menu_body/home.tscn" id="3_i66gl"]
[ext_resource type="PackedScene" uid="uid://5btb7nvgmfhl" path="res://scenes/menu.tscn" id="3_o1f7b"]
[ext_resource type="PackedScene" uid="uid://kywrsqro3d5i" path="res://scenes/menu_body/world.tscn" id="4_p75rl"]
[ext_resource type="PackedScene" uid="uid://dh3owgirapji5" path="res://scenes/menu_body/search_results.tscn" id="4_phjpd"]
@ -21,7 +21,7 @@
[node name="App" type="Node" node_paths=PackedStringArray("scenes_root")]
script = ExtResource("1_skc7d")
gate_events = ExtResource("2_cdryv")
bookmarks = ExtResource("3_l8glb")
home = ExtResource("3_i66gl")
search_results = ExtResource("4_phjpd")
world_scene = ExtResource("4_p75rl")
scenes_root = NodePath("Menu/VBoxContainer/Body")

View file

@ -91,6 +91,8 @@ process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 2
auto_translate_mode = 1
editor_description = ""
visible = true
modulate = Color(1, 1, 1, 1)
@ -128,7 +130,6 @@ pivot_offset = Vector2(0, 0)
size_flags_horizontal = 1
size_flags_vertical = 1
size_flags_stretch_ratio = 1.0
auto_translate = true
localize_numeral_system = true
tooltip_text = ""
focus_neighbor_left = NodePath("")

View file

@ -71,13 +71,7 @@ texture = ExtResource("1_jc4ra")
expand_mode = 1
stretch_mode = 4
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_constants/margin_top = 2
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/MarginContainer"]
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "New Tab"

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=9 format=3 uid="uid://byrcbqat0n2px"]
[ext_resource type="Script" path="res://scripts/debug-log/debug_window.gd" id="1_j4w8w"]
[ext_resource type="Script" path="res://scripts/debug_log/debug_window.gd" id="1_j4w8w"]
[ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="2_da5xc"]
[ext_resource type="Script" path="res://scripts/debug-log/debug_log.gd" id="2_lgt6s"]
[ext_resource type="Script" path="res://scripts/debug_log/debug_log.gd" id="2_lgt6s"]
[ext_resource type="FontFile" uid="uid://c14w1y1r54wgi" path="res://assets/fonts/Inter-Bold.otf" id="3_w27g3"]
[ext_resource type="FontFile" uid="uid://b3xb1fpllhnf4" path="res://assets/fonts/Inter-Italic.otf" id="4_jcerd"]
[ext_resource type="FontFile" uid="uid://tfj3o1e1wytn" path="res://assets/fonts/Inter-BoldItalic.otf" id="5_jgvml"]

View file

@ -34,7 +34,6 @@ content_margin_bottom = 0.0
color = Color(0.12549, 0.133333, 0.172549, 1)
grow_begin = 0.0
grow_end = 0.0
thickness = 2
[sub_resource type="Animation" id="Animation_ydijj"]
length = 0.001

View file

@ -1,30 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://pgl3w7q5w84m"]
[ext_resource type="Script" path="res://scripts/ui/menu/bookmark_container.gd" id="1_vspm3"]
[ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://resources/bookmarks.tres" id="2_g2k3b"]
[ext_resource type="PackedScene" uid="uid://82ca8so31njy" path="res://scenes/components/bookmark.tscn" id="3_dyxu5"]
[node name="Bookmarks" type="ScrollContainer"]
custom_minimum_size = Vector2(1200, 400)
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_top = -100.0
offset_bottom = 100.0
grow_horizontal = 2
grow_vertical = 2
follow_focus = true
horizontal_scroll_mode = 0
[node name="GridContainer" type="GridContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/h_separation = 70
theme_override_constants/v_separation = 40
columns = 6
script = ExtResource("1_vspm3")
bookmarks = ExtResource("2_g2k3b")
bookmark_scene = ExtResource("3_dyxu5")

View file

@ -0,0 +1,97 @@
[gd_scene load_steps=6 format=3 uid="uid://ca647gp63bshc"]
[ext_resource type="Texture2D" uid="uid://bw1cffhlt112i" path="res://assets/textures/icon-round.svg" id="1_dh3vr"]
[ext_resource type="Script" path="res://scripts/ui/menu/bookmark_container.gd" id="1_g38mt"]
[ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://resources/bookmarks.tres" id="2_2igc6"]
[ext_resource type="Script" path="res://addons/max_size_container/max_size_container.gd" id="2_ceb6w"]
[ext_resource type="PackedScene" uid="uid://82ca8so31njy" path="res://scenes/components/bookmark.tscn" id="3_isdis"]
[node name="Home" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ScrollContainer" type="ScrollContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
follow_focus = true
horizontal_scroll_mode = 0
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
clip_contents = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="SpaceTop" type="Control" parent="ScrollContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 240)
layout_mode = 2
size_flags_vertical = 3
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/VBoxContainer/SpaceTop"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -40.0
offset_top = -180.0
offset_right = 40.0
offset_bottom = -100.0
grow_horizontal = 2
grow_vertical = 0
texture = ExtResource("1_dh3vr")
expand_mode = 1
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="SpaceLeft" type="Control" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="MaxSizeContainer" type="MarginContainer" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(200, 400)
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 3.0
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
script = ExtResource("2_ceb6w")
limit = Vector2(1200, -1)
valign = 0
[node name="Bookmarks" type="HFlowContainer" parent="ScrollContainer/VBoxContainer/HBoxContainer/MaxSizeContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/h_separation = 70
theme_override_constants/v_separation = 40
alignment = 1
last_wrap_alignment = 1
script = ExtResource("1_g38mt")
bookmarks = ExtResource("2_2igc6")
bookmark_scene = ExtResource("3_isdis")
[node name="SpaceRight" type="Control" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="SpaceBottom" type="Control" parent="ScrollContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 120)
layout_mode = 2
size_flags_vertical = 3

View file

@ -1,7 +1,7 @@
extends Node
@export var gate_events: GateEvents
@export var bookmarks: PackedScene
@export var home: PackedScene
@export var search_results: PackedScene
@export var world_scene: PackedScene
@export var scenes_root: Node
@ -10,9 +10,9 @@ extends Node
func _ready() -> void:
gate_events.search.connect(func(_query): switch_scene(search_results))
gate_events.open_gate.connect(func(_url): switch_scene(world_scene))
gate_events.exit_gate.connect(func(): switch_scene(bookmarks))
gate_events.exit_gate.connect(func(): switch_scene(home))
switch_scene(bookmarks)
switch_scene(home)
func switch_scene(scene: PackedScene) -> void:

View file

@ -1,4 +1,4 @@
extends GridContainer
extends HFlowContainer
@export var bookmarks: Bookmarks
@export var bookmark_scene: PackedScene

View file

@ -2,10 +2,17 @@ extends Control
@export var ui_events: UiEvents
var window: Window
func _ready() -> void:
window = get_window()
window.dpi_changed.connect(scale_content)
resized.connect(on_resized)
set_initial_screen()
scale_content()
on_resized()
@ -14,6 +21,13 @@ func on_resized() -> void:
ui_events.ui_size_changed_emit(size)
func scale_content() -> void:
# TODO: support other platforms FEATURE_HIDPI
var screen_scale = DisplayServer.screen_get_scale()
get_window().content_scale_factor = screen_scale
Debug.logclr("Content scale factor: %.2f" % [screen_scale], Debug.SILENT_CLR)
func set_initial_screen() -> void:
var last_screen = DataSaver.get_value("settings", "last_screen")
if last_screen == null: last_screen = 0
@ -24,12 +38,8 @@ func set_initial_screen() -> void:
if Platform.is_macos():
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
Debug.logclr("Setting fullscreen mode", Debug.SILENT_CLR)
var screen_scale = DisplayServer.screen_get_scale()
get_window().content_scale_factor = screen_scale
Debug.logclr("Content scale factor: %.2f" % [screen_scale], Debug.SILENT_CLR)
func _exit_tree() -> void:
var last_screen = DisplayServer.window_get_current_screen()
DataSaver.set_value("settings", "last_screen", last_screen)
var last_screen = DisplayServer.window_get_current_screen()
DataSaver.set_value("settings", "last_screen", last_screen)