From df8c1b0493d63220b75dd332c506cd7326db2087 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Sat, 5 Aug 2023 22:11:02 +0930 Subject: [PATCH] Basic items menu layout Realign ability icons on atlas Fix testing override for ability icons --- scripts/managers/Common.gd | 8 ++-- test_scene.gd | 2 +- theme/ThemeElements.png | Bin 1408 -> 1356 bytes theme/icons/ability_character.tres | 3 +- theme/icons/ability_command.tres | 3 +- theme/icons/ability_menu.tres | 3 +- theme/icons/ability_party.tres | 3 +- widgets/ItemsMenu.tscn | 74 +++++++++++++++++++++++++++++ 8 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 widgets/ItemsMenu.tscn diff --git a/scripts/managers/Common.gd b/scripts/managers/Common.gd index 7c44b69..020ad1d 100644 --- a/scripts/managers/Common.gd +++ b/scripts/managers/Common.gd @@ -174,6 +174,7 @@ func shrink_to_integer(): if OS.get_window_size() != new_window_size: # avoid retriggering this event forever OS.set_window_size(new_window_size) print('resized to scale %d %s' % [scale, new_window_size]) + get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT, SceneTree.STRETCH_ASPECT_KEEP, base_resolution*scale, scale) func update_window_scale(): if OS.window_size < base_resolution*2: @@ -191,11 +192,12 @@ func update_window_scale(): # Don't fight the WM if it sets the window size back again print_debug("Config is to shrink down to integer scale, but %s was the last external resize event, so we won't fight the window manager" % size) else: - print_debug('Setting lastres to %s, will resize to %dx == %s in 1 second' % [self.last_resolution_pre_shrink, scale, target_size]) + var delay = 1.0 - min((size - self.last_resolution_pre_shrink).length_squared()/1000, 0.95) + print_debug('Setting lastres to %s, will resize to %dx == %s in %f seconds' % [self.last_resolution_pre_shrink, scale, target_size, delay]) self.last_resolution_pre_shrink = size shrink_timer.paused = false - shrink_timer.start(1) - get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT, SceneTree.STRETCH_ASPECT_KEEP, base_resolution*scale, scale) + shrink_timer.start(delay) + get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT, SceneTree.STRETCH_ASPECT_KEEP, base_resolution*scale, scale) static func game_time_frames_to_hhmm(game_time_frames: int) -> String: var game_seconds = game_time_frames / 60 diff --git a/test_scene.gd b/test_scene.gd index 5502de6..0345a2d 100644 --- a/test_scene.gd +++ b/test_scene.gd @@ -21,6 +21,6 @@ func _ready(): # buffer.data_array = save_file.get_buffer(0x600) # save_slot_dicts.append(SaveLoader.get_struct(buffer, 'Save_slot')) var data = save_slot_dicts[0] - data.characters[2].ability_4 = 0x9B + data.characters[2].equipped_abilities[3] = 0x9B $PartyMenu.update_labels(data) ThemeManager.set_menu_color_555(data.config.menu_color_r, data.config.menu_color_g, data.config.menu_color_b) diff --git a/theme/ThemeElements.png b/theme/ThemeElements.png index 9dcd87b7dc073461eb3b55da086cb169b0867862..ae44b141c1da59bc8e5b8ee1609dfe903ff50716 100644 GIT binary patch delta 1292 zcmV+n1@roV3(N|TB!3f0L_t(|+U=cDj^Z#3hMg718fh};nun$*YezzJt?a{+Dwrfq z*#af`J_$`pLt$&jwSQbz1iHq=Pn>f;HOV<=5@UXC&bwf(_47QN__>IP9*dth=K#T= z+K{PnJ(hdzE7{_pvB9mi-Z>Xuvy5qnXvzV?$r^@1j4>uQsDJm~kK?$UL_JqTBsZtz zASDBBi9{vi55usGjpLYoy|va`Yh|8ian8x-=ckB>{QmyR_xHDieJwh`a>4?^pn5wp z;?>;LoOpjcKR$*Y*ZWfYbB>Yw_vmBgj&oV{ex7IVz4!AxUu`?*e24}oO3=g?<#`m_uYDl(VtO0_qpTE^DH8=M1qz%r3@0E7(JFU zUTRK75@`x6c$ZMC9Vq7*J#&grdM?bS465fIwF<~3wV)hes}bM1>??)+OHLpnB0oPr zA^GdZ0h-eRYF2zG^-9KWwgQMxR3`lUgt2w__eTn?aeoDogG)ifIzY|JuN8*6@PgKK zfd9c-yVU=!*8bTXpjGE?HE~4S5ZV$2x=R9E6M}SUN+h`Dk2dJ#WG#=3v9IRVDsImv7(0^?W(j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-zO;>GiZ*Sr2>uWnnpeKw+*j8^5FAs#+dIT6+qp)=ecWqUGbxdm= zf}H2Ka!dGJ4lwkd(BIfRJM*_3VDorU0`*!zmEhi8btDH^DMItlIynT#Iso?u-sk}L zxEk2AqNpX*+*=EHh5Ta`4j@O3HGe|%sOqs9JX2XW8Dn^LwU;O*(-0^0q{sTW>SlLIh~mc`2Y~HywHYR`^#Fyr z{k=9z?BI_g08%hzAY~vz5JC`>0R=M}006*!`41QzOYb=Bp@{$h002ovPDHLkV1lgY BpYH$w diff --git a/theme/icons/ability_character.tres b/theme/icons/ability_character.tres index d62eaf4..1044171 100644 --- a/theme/icons/ability_character.tres +++ b/theme/icons/ability_character.tres @@ -4,4 +4,5 @@ [resource] atlas = ExtResource( 1 ) -region = Rect2( 64, 14, 12, 12 ) +region = Rect2( 64, 11, 12, 9 ) +margin = Rect2( 0, 2, 0, 3 ) diff --git a/theme/icons/ability_command.tres b/theme/icons/ability_command.tres index 3d0653e..246465a 100644 --- a/theme/icons/ability_command.tres +++ b/theme/icons/ability_command.tres @@ -4,4 +4,5 @@ [resource] atlas = ExtResource( 1 ) -region = Rect2( 64, 1, 12, 12 ) +region = Rect2( 64, 1, 12, 9 ) +margin = Rect2( 0, 2, 0, 3 ) diff --git a/theme/icons/ability_menu.tres b/theme/icons/ability_menu.tres index d003280..ab8d677 100644 --- a/theme/icons/ability_menu.tres +++ b/theme/icons/ability_menu.tres @@ -4,4 +4,5 @@ [resource] atlas = ExtResource( 1 ) -region = Rect2( 64, 40, 12, 12 ) +region = Rect2( 64, 31, 12, 9 ) +margin = Rect2( 0, 2, 0, 3 ) diff --git a/theme/icons/ability_party.tres b/theme/icons/ability_party.tres index d83697b..4e480d6 100644 --- a/theme/icons/ability_party.tres +++ b/theme/icons/ability_party.tres @@ -4,4 +4,5 @@ [resource] atlas = ExtResource( 1 ) -region = Rect2( 64, 27, 12, 12 ) +region = Rect2( 64, 21, 12, 9 ) +margin = Rect2( 0, 2, 0, 3 ) diff --git a/widgets/ItemsMenu.tscn b/widgets/ItemsMenu.tscn new file mode 100644 index 0000000..2fad0b6 --- /dev/null +++ b/widgets/ItemsMenu.tscn @@ -0,0 +1,74 @@ +[gd_scene format=2] + +[node name="ItemsMenu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +anchor_right = 1.0 +margin_bottom = 22.0 +custom_constants/separation = 0 + +[node name="title" type="PanelContainer" parent="HBoxContainer"] +margin_right = 45.0 +margin_bottom = 22.0 + +[node name="ITEMS" type="Label" parent="HBoxContainer/title"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 41.0 +margin_bottom = 18.0 +text = "Items" + +[node name="actions" type="PanelContainer" parent="HBoxContainer"] +margin_left = 45.0 +margin_right = 384.0 +margin_bottom = 22.0 +size_flags_horizontal = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/actions"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 335.0 +margin_bottom = 18.0 + +[node name="Label" type="Label" parent="HBoxContainer/actions/HBoxContainer"] +margin_right = 105.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +text = "Use" +align = 1 + +[node name="Label2" type="Label" parent="HBoxContainer/actions/HBoxContainer"] +margin_left = 113.0 +margin_right = 218.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +text = "Sort" +align = 1 + +[node name="Label3" type="Label" parent="HBoxContainer/actions/HBoxContainer"] +margin_left = 226.0 +margin_right = 331.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +text = "Rare" +align = 1 + +[node name="itemdesc" type="PanelContainer" parent="."] +anchor_right = 1.0 +margin_top = 22.0 +margin_bottom = 66.0 + +[node name="Label" type="Label" parent="itemdesc"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 380.0 +margin_bottom = 40.0 +size_flags_vertical = 1 +text = "Item description" + +[node name="items" type="PanelContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_top = 66.0