x12 windowing system
This commit is contained in:
parent
e16b468e23
commit
e6ab1fb39a
60 changed files with 701 additions and 877 deletions
|
|
@ -8,7 +8,7 @@ var item_proper_names = []
|
|||
var categories
|
||||
var pixel_x
|
||||
var pixel_y
|
||||
var ui_scale = 1
|
||||
var ui_scale
|
||||
|
||||
func _enter_tree() -> void:
|
||||
conf_mm = ConfigFile.new()
|
||||
|
|
@ -17,13 +17,6 @@ func _enter_tree() -> void:
|
|||
conf_cat.load("res://02 - Configurations/campaign/categories.ini")
|
||||
print("main_menu:_enter_tree:1 " + str(conf_mm.get_sections()))
|
||||
categories = []
|
||||
pixel_x = get_viewport_rect().size[0]
|
||||
pixel_y = get_viewport_rect().size[1]
|
||||
if pixel_x + pixel_y > 2900:
|
||||
ui_scale = 1
|
||||
else:
|
||||
ui_scale = 0.7
|
||||
print("main_menu:_enter_tree:2 " + str(pixel_x) + " " + str(pixel_y))
|
||||
for i in conf_mm.get_sections():
|
||||
categories = categories + [i]
|
||||
|
||||
|
|
@ -50,7 +43,7 @@ func item_selected(k,tab):
|
|||
print("main_menu:select_category:2 " + str(item_names))
|
||||
menu_item.category = item_names[item_proper_names.find(tab.get_item_text(k))]
|
||||
add_child(menu_item)
|
||||
menu_item.set_menu_items(pixel_x,pixel_y,ui_scale)
|
||||
menu_item.set_menu_items()
|
||||
|
||||
func remove_tabs(tab):
|
||||
remove_child.call_deferred(tab)
|
||||
|
|
@ -59,38 +52,41 @@ func _on_exit_button_up() -> void:
|
|||
get_tree().quit()
|
||||
|
||||
func set_menu_items():
|
||||
print("main_menu:set_menu_items:1 " + str(pixel_x) + " " + str(pixel_y))
|
||||
%scroll.size.y = pixel_y - (256 * ui_scale)
|
||||
%scroll.position.y = 128 * ui_scale
|
||||
%campaign_manager.position.y = pixel_y - 192 * ui_scale
|
||||
%exit.position.y = pixel_y - 96 * ui_scale
|
||||
ui_scale = 1
|
||||
if get_viewport_rect().size[0] + get_viewport_rect().size[1] < 3000:
|
||||
ui_scale = 0.7
|
||||
pixel_x = get_viewport_rect().size[0] / ui_scale
|
||||
pixel_y = get_viewport_rect().size[1] / ui_scale
|
||||
$".".scale = Vector2(ui_scale,ui_scale)
|
||||
#print("main_menu:set_menu_items:1 " + str(pixel_x) + " " + str(pixel_y))
|
||||
%scroll.size.y = pixel_y - (320 )
|
||||
%scroll.position.y = 128
|
||||
%campaign_manager.position.y = pixel_y - 192
|
||||
%exit.position.y = pixel_y - 96
|
||||
%ui_main_menu.size.y = pixel_y
|
||||
%ui_background.size.y = pixel_y
|
||||
%ui_background.size.x = pixel_x
|
||||
if pixel_x < pixel_y: #mobile
|
||||
%ui_main_menu.size.x = pixel_x
|
||||
for i in [%scroll,%exit,%campaign_manager]:
|
||||
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_main_menu.size.x = 512.0 * ui_scale
|
||||
%ui_main_menu.size.x = 512.0
|
||||
for i in [%scroll,%exit,%campaign_manager]:
|
||||
i.scale = Vector2(ui_scale,ui_scale)
|
||||
i.size.x = 448
|
||||
i.position.x = 32 * ui_scale
|
||||
|
||||
i.position.x = 32
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if pixel_x != get_viewport_rect().size[0] or pixel_y != get_viewport_rect().size[1]:
|
||||
pixel_x = get_viewport_rect().size[0]
|
||||
pixel_y = get_viewport_rect().size[1]
|
||||
if pixel_x + pixel_y > 3000:
|
||||
ui_scale = 1
|
||||
else:
|
||||
ui_scale = 1
|
||||
if get_viewport_rect().size[0] + get_viewport_rect().size[1] < 3000:
|
||||
ui_scale = 0.7
|
||||
pixel_x = get_viewport_rect().size[0] / ui_scale
|
||||
pixel_y = get_viewport_rect().size[1] / ui_scale
|
||||
if menu_item:
|
||||
menu_item.set_menu_items(pixel_x,pixel_y,ui_scale)
|
||||
menu_item.set_menu_items()
|
||||
set_menu_items()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue