From 447d7df05de5eeca371196895b9121cd7aaf18cd Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 23 Jan 2025 12:45:37 -0800 Subject: [PATCH] ui polishing --- .efrocachemap | 48 +++++------ CHANGELOG.md | 2 +- src/assets/ba_data/python/baenv.py | 2 +- .../ba_data/python/bauiv1lib/inventory.py | 81 +++++++++++-------- .../python/bauiv1lib/profile/browser.py | 2 +- .../ba_data/python/bauiv1lib/profile/edit.py | 2 +- .../python/bauiv1lib/profile/upgrade.py | 2 +- src/ballistica/shared/ballistica.cc | 2 +- 8 files changed, 78 insertions(+), 63 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 6cd41ef6..5daba2a0 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4174,22 +4174,22 @@ "build/assets/windows/Win32/ucrtbased.dll": "bfd1180c269d3950b76f35a63655e9e1", "build/assets/windows/Win32/vc_redist.x86.exe": "15a5f1f876503885adbdf5b3989b3718", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "d4afb7e36d8b5360a8d732d2376d4e68", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "30249d058b53a881b5b650f3f917d4da", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "59941114752afae94b5f329a8f8a6507", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "048f4aeba96993057f3d50411e4ea6fc", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "94187f3e4a1876a7277bcdf7c1a67f4c", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "badd58f901bf87cc9436f39e42ed8439", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "9de51fe0e366a49956aba76cfedcc6f7", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "02ddadc779977f459208dc21f30fd643", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "5484a872372738395494e5777533f14f", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "de0bb0b788f097a9addad57932500b99", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "bb6cad7a63021a7c33383fa4e47e9642", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "c3c75f8597e30f03f957cae588cf8438", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "942f37a6fb716ccbcc6ffca60f409240", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "0daadde55aae6c0a8a4b6344de817b06", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "2d3651c7ac78dc1127b0982acd3a2a56", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "630c5e33ee248495687a71f7a44b3e09", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "ab9fc089b81485c44ed76746a0bdf1cf", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "3712c969f9699638b0c4f90c30ae4be4", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "fedce22235256621f4170d287eee3b72", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "dc6cd39050ee095b10309a8a93d3e6d4", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "2dc7e81250c9661e8d33ceb8b361e44a", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "5d7f17dc5c7d075a93266abbd6f27aa2", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "d4bcaba56f2deb26313d19f49fb539d4", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "47d1f8987974a51acd38e9b66133992f", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "7ef156774b0e7187a625d1bf7878fb19", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "7a2073bafdee44c840978e899ad2aba1", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "8f36ffed42c2e42490ce7084e185652a", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "dba9221212a38dbbe882872b0a87cc40", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "134d3d8d66d24a56c7728dcd99d0ecd3", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "5fed97a743fcdd9fd1977b214ecc85d7", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "b5fba0fa7687c55d20f3b47d723105b1", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "9fd62364d90d5a4dbbf737ef679b16ee", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "162e6aae6056d594bc0c1d3a333a6e7e", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "bb64e2182b1a533679f93c5997f14584", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "162e6aae6056d594bc0c1d3a333a6e7e", @@ -4202,14 +4202,14 @@ "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "116b500c2d57caf06619408b2176e83b", "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "e3e9d9c7a94f8cd22939839fd8fbc178", "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "116b500c2d57caf06619408b2176e83b", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "b2b24eb3bc59037d1e7662411cae1311", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "a084d05e8a52a92b7e7c52a90ab7ebb8", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "e9894eed647dec7df66362241bc5696c", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "1aa74944c3a64da210b7187dd7a5d6c3", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "ed15f730698e4e933a1056ab0c8df38f", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "b78869fd689be7c8487a1e08963fd603", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "2228085efc0f1787bb4d72436d06359e", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "44ec45854761d3e1a09561d569218c44", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "853c15c5528dde1f2e914d857b85d8dc", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "dc2806f37bab246e1c6f20be596c1881", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "8f8df2f940828243acc71b975ccc0e41", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "635ac139a7617cc909168b44028bfd5f", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "02a4cf67bc5942eaddd471b827bac3e9", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "456f7d61f644558b5cddcbe556925ea6", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "e42a67e7e8ccd5f3678da305ec9f8dde", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "71c42b2f709a57858ea2eb29bd054b8e", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad", "src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91", diff --git a/CHANGELOG.md b/CHANGELOG.md index 9944c5ea..98b74622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.37 (build 22242, api 9, 2025-01-23) +### 1.7.37 (build 22243, api 9, 2025-01-23) - Bumping api version to 9. As you'll see below, there's some UI changes that will require a bit of work for any UI mods to adapt to. If your mods don't touch UI stuff at all you can simply bump your api version and call it a day. diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index f8ce0095..04da351e 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -53,7 +53,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 22242 +TARGET_BALLISTICA_BUILD = 22243 TARGET_BALLISTICA_VERSION = '1.7.37' diff --git a/src/assets/ba_data/python/bauiv1lib/inventory.py b/src/assets/ba_data/python/bauiv1lib/inventory.py index 1c0458e7..f2904cf2 100644 --- a/src/assets/ba_data/python/bauiv1lib/inventory.py +++ b/src/assets/ba_data/python/bauiv1lib/inventory.py @@ -22,44 +22,59 @@ class InventoryWindow(bui.MainWindow): assert bui.app.classic is not None uiscale = bui.app.ui_v1.uiscale - width = 1050 if uiscale is bui.UIScale.SMALL else 750 - height = ( - 500 + self._width = 1400 if uiscale is bui.UIScale.SMALL else 750 + self._height = ( + 1200 if uiscale is bui.UIScale.SMALL else 530 if uiscale is bui.UIScale.MEDIUM else 600 ) - xoffs = 70 if uiscale is bui.UIScale.SMALL else 0 - yoffs = -45 if uiscale is bui.UIScale.SMALL else 0 + # xoffs = 70 if uiscale is bui.UIScale.SMALL else 0 + # yoffs = -45 if uiscale is bui.UIScale.SMALL else 0 + + # Do some fancy math to fill all available screen area up to the + # size of our backing container. This lets us fit to the exact + # screen shape at small ui scale. + screensize = bui.get_virtual_screen_size() + scale = ( + 1.55 + if uiscale is bui.UIScale.SMALL + else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 + ) + + # Calc screen size in our local container space and clamp to a + # bit smaller than our container size. + # target_width = min(self._width - 60, screensize[0] / scale) + target_height = min(self._height - 100, screensize[1] / scale) + + # To get top/left coords, go to the center of our window and + # offset by half the width/height of our target area. + yoffs = 0.5 * self._height + 0.5 * target_height + 30.0 super().__init__( root_widget=bui.containerwidget( - size=(width, height), + size=(self._width, self._height), toolbar_visibility=( - 'menu_minimal' - if uiscale is bui.UIScale.SMALL - else 'menu_full' - ), - scale=( - 1.55 - if uiscale is bui.UIScale.SMALL - else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 - ), - stack_offset=( - (0, 0) - if uiscale is bui.UIScale.SMALL - else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) + 'menu_full' if uiscale is bui.UIScale.SMALL else 'menu_full' ), + scale=scale, ), transition=transition, origin_widget=origin_widget, + # We're affected by screen size only at small ui-scale. + refresh_on_screen_size_changes=uiscale is bui.UIScale.SMALL, ) bui.textwidget( parent=self._root_widget, - position=(0, height - 45 + yoffs), - size=(width, 25), + position=( + self._width * 0.5, + yoffs - (50 if uiscale is bui.UIScale.SMALL else 30), + ), + size=(0, 0), text=bui.Lstr(resource='inventoryText'), color=bui.app.ui_v1.title_color, + scale=0.9 if uiscale is bui.UIScale.SMALL else 1.0, + maxwidth=(130 if uiscale is bui.UIScale.SMALL else 200), h_align='center', v_align='center', ) @@ -71,7 +86,7 @@ class InventoryWindow(bui.MainWindow): else: btn = bui.buttonwidget( parent=self._root_widget, - position=(xoffs + 50, height - 55 + yoffs), + position=(50, yoffs - 50), size=(60, 55), scale=0.8, label=bui.charstr(bui.SpecialChar.BACK), @@ -82,20 +97,10 @@ class InventoryWindow(bui.MainWindow): ) bui.containerwidget(edit=self._root_widget, cancel_button=btn) - bui.textwidget( - parent=self._root_widget, - position=(0, height - 120 + yoffs), - size=(width, 25), - text='(under construction)', - scale=0.7, - h_align='center', - v_align='center', - ) - button_width = 300 self._player_profiles_button = btn = bui.buttonwidget( parent=self._root_widget, - position=((width - button_width) * 0.5, height - 200 + yoffs), + position=(self._width * 0.5 - button_width * 0.5, yoffs - 200), autoselect=True, size=(button_width, 60), label=bui.Lstr(resource='playerProfilesWindow.titleText'), @@ -104,6 +109,16 @@ class InventoryWindow(bui.MainWindow): textcolor=(0.75, 0.7, 0.8), on_activate_call=self._player_profiles_press, ) + bui.textwidget( + parent=self._root_widget, + position=(self._width * 0.5, yoffs - 250), + size=(0, 0), + text=bui.Lstr(resource='moreSoonText'), + scale=0.7, + maxwidth=self._width * 0.9, + h_align='center', + v_align='center', + ) def _player_profiles_press(self) -> None: # pylint: disable=cyclic-import diff --git a/src/assets/ba_data/python/bauiv1lib/profile/browser.py b/src/assets/ba_data/python/bauiv1lib/profile/browser.py index 2deaa390..649dc2ce 100644 --- a/src/assets/ba_data/python/bauiv1lib/profile/browser.py +++ b/src/assets/ba_data/python/bauiv1lib/profile/browser.py @@ -60,7 +60,7 @@ class ProfileBrowserWindow(bui.MainWindow): else 'menu_full' ), scale=( - 2.0 + 2.5 if uiscale is bui.UIScale.SMALL else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0 ), diff --git a/src/assets/ba_data/python/bauiv1lib/profile/edit.py b/src/assets/ba_data/python/bauiv1lib/profile/edit.py index 27af5033..2cfe76c1 100644 --- a/src/assets/ba_data/python/bauiv1lib/profile/edit.py +++ b/src/assets/ba_data/python/bauiv1lib/profile/edit.py @@ -75,7 +75,7 @@ class EditProfileWindow( yoffs = -42 if uiscale is bui.UIScale.SMALL else 0 spacing = 40 self._base_scale = ( - 1.6 + 2.0 if uiscale is bui.UIScale.SMALL else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0 ) diff --git a/src/assets/ba_data/python/bauiv1lib/profile/upgrade.py b/src/assets/ba_data/python/bauiv1lib/profile/upgrade.py index 7fdc3a2a..cb2bc96e 100644 --- a/src/assets/ba_data/python/bauiv1lib/profile/upgrade.py +++ b/src/assets/ba_data/python/bauiv1lib/profile/upgrade.py @@ -37,7 +37,7 @@ class ProfileUpgradeWindow(bui.Window): self._height = 450 if uiscale is bui.UIScale.SMALL else 350 assert bui.app.classic is not None self._base_scale = ( - 1.9 + 1.92 if uiscale is bui.UIScale.SMALL else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.2 ) diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index f57866d9..20f15265 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 22242; +const int kEngineBuildNumber = 22243; const char* kEngineVersion = "1.7.37"; const int kEngineApiVersion = 9;