x12 windowing system

This commit is contained in:
martyTF 2025-12-09 20:17:57 +01:00
parent e16b468e23
commit e6ab1fb39a
60 changed files with 701 additions and 877 deletions

View file

@ -13,7 +13,6 @@ func _enter_tree() -> void:
ini = "res://02 - Configurations/" + category + ".ini"
%new_item_name.visible = false
%delete.visible = false
%item_name.visible = false
%save.visible = false
%new_item.text = "New " + category
%filter.placeholder_text = "Filter " + category
@ -21,6 +20,7 @@ func _enter_tree() -> void:
%save.text = "Save " + category
#print(category)
list_items()
set_menu_items()
func _on_close_button_up() -> void:
queue_free()
@ -50,7 +50,6 @@ func list_items() -> void:
func refresh_view():
%item_name.text = item
if item != "":
config = ConfigFile.new()
config.load(ini)
@ -62,15 +61,11 @@ func _on_list_item_selected(index: int) -> void:
#print(%list.get_item_text(index))
%delete.text = "Delete " + %list.get_item_text(index)
%delete.visible = true
%item_name.visible = true
if sheet:
remove_child(sheet)
sheet = load("res://01 - Menus/03 - Sheets/item.tscn").instantiate()
sheet = load("res://01 - Menus/07 - Window/window.tscn").instantiate()
sheet.item = item
sheet.category = category
sheet.position.x = 512
sheet.position.y = 256
add_child(sheet)
#sheet.set_menu_items()
refresh_view()
@ -129,24 +124,27 @@ func _on_save_button_up() -> void:
func show_save():
%save.visible = true
func set_menu_items(pixel_x,pixel_y,ui_scale):
func set_menu_items():
var ui_scale = 1
if get_viewport_rect().size[0] + get_viewport_rect().size[1] < 3000:
ui_scale = 0.7
var pixel_x = get_viewport_rect().size[0] / ui_scale
var pixel_y = get_viewport_rect().size[1] / ui_scale
%ui_background.size.y = pixel_y
%close.position.y = pixel_y - 96 * ui_scale
%new_item.position.y = pixel_y - 192 * ui_scale
%new_item_name.position.y = pixel_y - 192 * ui_scale
%delete.position.y = pixel_y - 286 * ui_scale
%filter.position.y = pixel_y - 384 * ui_scale
%list.position = (Vector2(128,128)) * ui_scale
%list.size.y = pixel_y/ui_scale - 620
%close.position.y = pixel_y - 96
%new_item.position.y = pixel_y - 192
%new_item_name.position.y = pixel_y - 192
%delete.position.y = pixel_y - 286
%filter.position.y = pixel_y - 384
%list.position = (Vector2(128,128))
%list.size.y = pixel_y - 620
if pixel_x < pixel_y: #mobile
%ui_background.size.x = pixel_x
for i in [%close,%new_item,%filter,%delete,%save,%new_item_name,%list]:
i.scale = Vector2(ui_scale,ui_scale)
i.size.x = pixel_x/ui_scale - 128
i.position.x = 64 * ui_scale
i.size.x = pixel_x - 128
i.position.x = 64
else:
%ui_background.size.x = 512.0 * ui_scale
%ui_background.size.x = 512.0
for i in [%close,%new_item,%filter,%delete,%save,%new_item_name,%list]:
i.scale = Vector2(ui_scale,ui_scale)
i.size.x = 448
i.position.x = 32 * ui_scale
i.position.x = 32