From 6986896de63d66adffbe3f6944e9121f23643a11 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 23 Jan 2025 09:08:55 -0800 Subject: [PATCH] reverted small ui safe area to be same 16:9 one as medium and large --- .efrocachemap | 56 +++++++++---------- CHANGELOG.md | 28 +++++++--- src/assets/ba_data/python/babase/__init__.py | 2 + .../ba_data/python/babase/_devconsoletabs.py | 6 +- src/assets/ba_data/python/baenv.py | 2 +- src/assets/ba_data/python/bauiv1/__init__.py | 2 + .../python/bauiv1lib/account/settings.py | 3 +- .../ba_data/python/bauiv1lib/achievements.py | 2 +- src/assets/ba_data/python/bauiv1lib/chest.py | 6 +- .../ba_data/python/bauiv1lib/coop/browser.py | 8 +-- .../ba_data/python/bauiv1lib/credits.py | 5 +- .../python/bauiv1lib/gather/__init__.py | 12 ++-- src/assets/ba_data/python/bauiv1lib/help.py | 6 +- src/assets/ba_data/python/bauiv1lib/inbox.py | 2 +- .../python/bauiv1lib/league/rankwindow.py | 2 +- .../ba_data/python/bauiv1lib/mainmenu.py | 11 +++- src/assets/ba_data/python/bauiv1lib/party.py | 2 +- src/assets/ba_data/python/bauiv1lib/play.py | 9 ++- .../python/bauiv1lib/settings/advanced.py | 2 +- .../python/bauiv1lib/settings/allsettings.py | 9 ++- .../python/bauiv1lib/settings/controls.py | 2 +- .../ba_data/python/bauiv1lib/store/browser.py | 16 ++---- src/assets/ba_data/python/bauiv1lib/watch.py | 2 +- .../base/app_adapter/app_adapter_sdl.cc | 4 +- src/ballistica/base/graphics/graphics.cc | 22 ++++---- src/ballistica/base/graphics/graphics.h | 12 ++-- .../python/methods/python_methods_base_2.cc | 25 +++++++++ .../python/methods/python_methods_base_3.cc | 38 ++++++------- src/ballistica/shared/ballistica.cc | 2 +- src/ballistica/shared/ballistica.h | 4 +- .../python/methods/python_methods_ui_v1.cc | 14 ++--- src/ballistica/ui_v1/widget/root_widget.cc | 2 +- 32 files changed, 193 insertions(+), 125 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 585f2508..4bc78e08 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4174,42 +4174,42 @@ "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": "bf3b7b4a3288f886a9fb7c5da960f119", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "f5bdfc3b103ca266540d7666da45465e", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "167e94a5abe297f6ecf1e68d2e322c0c", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "067f4cbd2cff445c54a0b4ff5ed51588", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "fc3b241d6f12f556317346bd6ecac649", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "dd1c7409c2f10287242b336fcd116c5f", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "dd4202d0c869c986e81421faec2f421c", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "88413e877960d7dd3e2bf4e1c7f0fbc6", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "9704b8bbef614e3a99361ad4a5f22be5", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "174118c9c6ab6e22356b9d9af4041566", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "d08abaa6613697c99484ce092c69800e", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "4a0d32380a824d0ac5f972734f5fe827", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "4d838790343991aa343942ea2358bc90", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "c28966f4b3d1ea3e98890b96f8ae374a", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "6149a44a7ac0e26ccecb88704216885c", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "123dc31083e4fd574c917364050aa4a4", - "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "4d70703c4eba1a402fbc2d997d84aa93", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "871cc2b603c3380a4e6410e49a294eb8", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "a1670c63dc8feefd283e303313142305", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "0f5951f1bcf846dbacbce3154ab05de9", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "c89ee1ce99e02b7fde5bbe710bb20fe8", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "a4915c8065e1922fbf4517009bec9895", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "07a0a6bf6bc3b754eff4452803ef2ebf", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "7cce99fa65c061bd7cc2cdbf2698480f", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "06e411ec91d4bdec27bff79eca7bd2e5", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "c57fe8f81255c3165760616dbface818", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "c8a365227a776d314d7f46f36494dc1f", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "053135ff5531b5d284338dc36da62972", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "eba59b13d857b201e77f82a8704ad171", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "0979153e376a28cabc28b45abaacf1d2", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "199e7f60711699d045f842c599a6949e", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "b11e8d4b1cc2ee5815ed3ee294b2189f", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "bf495eaaa5a89877fa75c565042f3680", + "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": "4d70703c4eba1a402fbc2d997d84aa93", + "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "162e6aae6056d594bc0c1d3a333a6e7e", "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "bb64e2182b1a533679f93c5997f14584", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "1d25993b7cd4676d3884781b002edf53", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "834ca6a4328b26e9ee900c9091b954ff", "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "ab6f04d0fb73d88ccbd3c65e73ead01f", - "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "1d25993b7cd4676d3884781b002edf53", + "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "834ca6a4328b26e9ee900c9091b954ff", "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "ab6f04d0fb73d88ccbd3c65e73ead01f", "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "e3e9d9c7a94f8cd22939839fd8fbc178", "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": "92e474de293287bfe17a3c81f7adfd8c", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "ff2215385d5fd68ac0078ce86ef06003", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "ea497a717d76a5525476a14590dab4fa", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "21fb3479c8753f3722dc63d3dd122748", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "261c905e45c1f30dc975e2a074e4fa4d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "387da3db2df75624ae685e1f06a8cdb7", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "5178f6943d3190e42456f760bd645456", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "f6dcd5a08c27fde4ace634b667271d2f", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "adb36987cc93ca6dd3dd124da61b4530", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "abc23cb3942fa064a6dbf610dc5d0102", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "7e94d9e59c9e5b72bd00f225410eea0b", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "e3e06c3f1b0c54ab87c13555c978d691", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "46b9c30a5b8121bf07be1e61bbea529f", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "ad159f29776fa8bd2741140421edfa01", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "88af984712b58aa9d85543dcdad0cbdb", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "56f8590bc130b26075bac32a73a9dfac", "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 b412366f..c0a72afb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.37 (build 22236, api 9, 2025-01-22) +### 1.7.37 (build 22238, 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. @@ -191,12 +191,26 @@ in various places. - Tournament now award chests instead of tickets. - Tournaments are now free to enter if you are running this build or newer. -- (build 22225) Added `babase.get_virtual_screen_size()` to get the current - virtual screen size, and added a `refresh_on_screen_size_changes` arg to the - `MainWindow` class. This can be used to fit windows to the exact screen size, - which is especially useful at the small ui-scale. Generally medium and large - ui-scale windows don't fill the entire screen and can simply stay within the - virtual safe area and don't need to refresh. +- (build 22225) Added `babase.get_virtual_screen_size()` and to get the current + virtual screen size, `babase.get_virtual_safe_area_size()` to get the size of + the area where things are guaranteed to be visible no matter how the window is + resized, and added a `refresh_on_screen_size_changes` arg to the `MainWindow` + class to automatically recreate the window when the screen is resized. This + combined functionality can be used to custom fit UI elements to the exact + screen size, which is especially useful at the small ui-scale with its limited + screen real-estate. Generally medium and large ui-scale windows don't fill the + entire screen and can simply stay within the virtual safe area and thus don't + need to refresh. +- (build 22237) Reverted the change from earlier in this release where small + ui-scale would have its own distinct widescreen virtual-safe-area. The virtual + safe area is now always 1280x720 (16:9). I came to realize there were + significant downsides to having safe-area be inconsistent; for instance + onscreen elements designed for one safe area might be out of frame for players + using the other, and things would effectively need to be limited to the + intersection of the two safe areas to work everywhere. Since it is now + possible to take advantage of the full screen area using the + `get_virtual_screen_size()` and whatnot mentioned above, it makes sense to + return to a single consistent safe area. ### 1.7.36 (build 21944, api 8, 2024-07-26) - Wired up Tokens, BombSquad's new purchasable currency. The first thing these diff --git a/src/assets/ba_data/python/babase/__init__.py b/src/assets/ba_data/python/babase/__init__.py index 954c48ec..fb1a4147 100644 --- a/src/assets/ba_data/python/babase/__init__.py +++ b/src/assets/ba_data/python/babase/__init__.py @@ -60,6 +60,7 @@ from _babase import ( get_string_width, get_ui_scale, get_v1_cloud_log_file_path, + get_virtual_safe_area_size, get_virtual_screen_size, getsimplesound, has_user_run_commands, @@ -271,6 +272,7 @@ __all__ = [ 'get_string_width', 'get_type_name', 'get_ui_scale', + 'get_virtual_safe_area_size', 'get_virtual_screen_size', 'get_v1_cloud_log_file_path', 'getclass', diff --git a/src/assets/ba_data/python/babase/_devconsoletabs.py b/src/assets/ba_data/python/babase/_devconsoletabs.py index 9e60b0a6..6429fa6a 100644 --- a/src/assets/ba_data/python/babase/_devconsoletabs.py +++ b/src/assets/ba_data/python/babase/_devconsoletabs.py @@ -131,7 +131,7 @@ class DevConsoleTabUI(DevConsoleTab): v_align='center', ) - ui_overlay = _babase.get_draw_ui_bounds() + ui_overlay = _babase.get_draw_virtual_safe_area_bounds() self.button( 'Virtual Safe Area ON' if ui_overlay else 'Virtual Safe Area OFF', pos=(xoffs + 10, 10), @@ -167,7 +167,9 @@ class DevConsoleTabUI(DevConsoleTab): def toggle_ui_overlay(self) -> None: """Toggle UI overlay drawing.""" - _babase.set_draw_ui_bounds(not _babase.get_draw_ui_bounds()) + _babase.set_draw_virtual_safe_area_bounds( + not _babase.get_draw_virtual_safe_area_bounds() + ) self.request_refresh() diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 5aa17962..1079df75 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 = 22236 +TARGET_BALLISTICA_BUILD = 22238 TARGET_BALLISTICA_VERSION = '1.7.37' diff --git a/src/assets/ba_data/python/bauiv1/__init__.py b/src/assets/ba_data/python/bauiv1/__init__.py index 2555178e..49a9503d 100644 --- a/src/assets/ba_data/python/bauiv1/__init__.py +++ b/src/assets/ba_data/python/bauiv1/__init__.py @@ -58,6 +58,7 @@ from babase import ( get_string_height, get_string_width, get_type_name, + get_virtual_safe_area_size, get_virtual_screen_size, getclass, have_permission, @@ -188,6 +189,7 @@ __all__ = [ 'get_string_height', 'get_string_width', 'get_type_name', + 'get_virtual_safe_area_size', 'get_virtual_screen_size', 'getclass', 'getmesh', diff --git a/src/assets/ba_data/python/bauiv1lib/account/settings.py b/src/assets/ba_data/python/bauiv1lib/account/settings.py index 8011f914..b2d02b25 100644 --- a/src/assets/ba_data/python/bauiv1lib/account/settings.py +++ b/src/assets/ba_data/python/bauiv1lib/account/settings.py @@ -73,8 +73,9 @@ class AccountSettingsWindow(bui.MainWindow): # 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.72 + 1.9 if uiscale is bui.UIScale.SMALL else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0 ) diff --git a/src/assets/ba_data/python/bauiv1lib/achievements.py b/src/assets/ba_data/python/bauiv1lib/achievements.py index 97d8e53f..b5e2f3fc 100644 --- a/src/assets/ba_data/python/bauiv1lib/achievements.py +++ b/src/assets/ba_data/python/bauiv1lib/achievements.py @@ -40,7 +40,7 @@ class AchievementsWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 2.3 + 2.7 if uiscale is bui.UIScale.SMALL else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.2 ) diff --git a/src/assets/ba_data/python/bauiv1lib/chest.py b/src/assets/ba_data/python/bauiv1lib/chest.py index 7134ac1e..9c0f0c4b 100644 --- a/src/assets/ba_data/python/bauiv1lib/chest.py +++ b/src/assets/ba_data/python/bauiv1lib/chest.py @@ -34,7 +34,7 @@ class ChestWindow(bui.MainWindow): assert bui.app.classic is not None uiscale = bui.app.ui_v1.uiscale - self._width = 1050 if uiscale is bui.UIScale.SMALL else 650 + self._width = 1200 if uiscale is bui.UIScale.SMALL else 650 self._height = 550 if uiscale is bui.UIScale.SMALL else 450 self._xoffs = 70 if uiscale is bui.UIScale.SMALL else 0 self._yoffs = -50 if uiscale is bui.UIScale.SMALL else -35 @@ -62,14 +62,14 @@ class ChestWindow(bui.MainWindow): size=(self._width, self._height), toolbar_visibility='menu_full', scale=( - 1.45 + 1.8 if uiscale is bui.UIScale.SMALL else 1.1 if uiscale is bui.UIScale.MEDIUM else 0.9 ), stack_offset=( (0, 0) if uiscale is bui.UIScale.SMALL - else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) + else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0) ), ), transition=transition, diff --git a/src/assets/ba_data/python/bauiv1lib/coop/browser.py b/src/assets/ba_data/python/bauiv1lib/coop/browser.py index 65aa2ace..4b9433b0 100644 --- a/src/assets/ba_data/python/bauiv1lib/coop/browser.py +++ b/src/assets/ba_data/python/bauiv1lib/coop/browser.py @@ -109,7 +109,7 @@ class CoopBrowserWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.31 + 1.5 if uiscale is bui.UIScale.SMALL else 0.8 if uiscale is bui.UIScale.MEDIUM else 0.75 ) @@ -130,11 +130,7 @@ class CoopBrowserWindow(bui.MainWindow): root_widget=bui.containerwidget( size=(self._width, self._height + top_extra), toolbar_visibility='menu_full', - scale=( - 1.31 - if uiscale is bui.UIScale.SMALL - else 0.8 if uiscale is bui.UIScale.MEDIUM else 0.75 - ), + scale=scale, ), transition=transition, origin_widget=origin_widget, diff --git a/src/assets/ba_data/python/bauiv1lib/credits.py b/src/assets/ba_data/python/bauiv1lib/credits.py index a9045761..c605c04f 100644 --- a/src/assets/ba_data/python/bauiv1lib/credits.py +++ b/src/assets/ba_data/python/bauiv1lib/credits.py @@ -38,7 +38,7 @@ class CreditsWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.8 + 2.0 if uiscale is bui.UIScale.SMALL else 1.2 if uiscale is bui.UIScale.MEDIUM else 1.0 ) @@ -113,6 +113,7 @@ class CreditsWindow(bui.MainWindow): position=(width * 0.5 - scroll_width * 0.5, scroll_y), capture_arrows=True, border_opacity=0.4, + center_small_content_horizontally=True, ) bui.widget( @@ -330,7 +331,7 @@ class CreditsWindow(bui.MainWindow): line_height = 20 scale = 0.55 - self._sub_width = width - 80 + self._sub_width = min(700, width - 80) self._sub_height = line_height * len(lines) + 40 container = self._subcontainer = bui.containerwidget( diff --git a/src/assets/ba_data/python/bauiv1lib/gather/__init__.py b/src/assets/ba_data/python/bauiv1lib/gather/__init__.py index 6c4eb505..93c9073b 100644 --- a/src/assets/ba_data/python/bauiv1lib/gather/__init__.py +++ b/src/assets/ba_data/python/bauiv1lib/gather/__init__.py @@ -105,7 +105,7 @@ class GatherWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.15 + 1.4 if uiscale is bui.UIScale.SMALL else 0.88 if uiscale is bui.UIScale.MEDIUM else 0.66 ) @@ -163,20 +163,20 @@ class GatherWindow(bui.MainWindow): ( self._width * 0.5 + ( - (self._scroll_width * -0.5 + 170.0) + (self._scroll_width * -0.5 + 170.0 - 70.0) if uiscale is bui.UIScale.SMALL else 0.0 ) ), - yoffs - (61 if uiscale is bui.UIScale.SMALL else 4), + yoffs - (64 if uiscale is bui.UIScale.SMALL else 4), ), size=(0, 0), color=bui.app.ui_v1.title_color, - scale=1.2 if uiscale is bui.UIScale.SMALL else 1.0, - h_align='center', + scale=1.3 if uiscale is bui.UIScale.SMALL else 1.0, + h_align='left' if uiscale is bui.UIScale.SMALL else 'center', v_align='center', text=(bui.Lstr(resource=f'{self._r}.titleText')), - maxwidth=140 if uiscale is bui.UIScale.SMALL else 320, + maxwidth=135 if uiscale is bui.UIScale.SMALL else 320, ) # Build up the set of tabs we want. diff --git a/src/assets/ba_data/python/bauiv1lib/help.py b/src/assets/ba_data/python/bauiv1lib/help.py index ac19dd51..abb63706 100644 --- a/src/assets/ba_data/python/bauiv1lib/help.py +++ b/src/assets/ba_data/python/bauiv1lib/help.py @@ -43,7 +43,7 @@ class HelpWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.55 + 1.8 if uiscale is bui.UIScale.SMALL else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 ) @@ -119,6 +119,7 @@ class HelpWindow(bui.MainWindow): simple_culling_v=100.0, capture_arrows=True, border_opacity=0.4, + center_small_content_horizontally=True, ) if uiscale is bui.UIScale.SMALL: @@ -135,7 +136,8 @@ class HelpWindow(bui.MainWindow): edit=self._root_widget, selected_child=self._scrollwidget ) - self._sub_width = 810 if uiscale is bui.UIScale.SMALL else 660 + # self._sub_width = 810 if uiscale is bui.UIScale.SMALL else 660 + self._sub_width = 660 self._sub_height = ( 1590 + bui.app.lang.get_resource(f'{self._r}.someDaysExtraSpace') diff --git a/src/assets/ba_data/python/bauiv1lib/inbox.py b/src/assets/ba_data/python/bauiv1lib/inbox.py index 9d498853..08dc9234 100644 --- a/src/assets/ba_data/python/bauiv1lib/inbox.py +++ b/src/assets/ba_data/python/bauiv1lib/inbox.py @@ -331,7 +331,7 @@ class InboxWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.74 + 1.9 if uiscale is bui.UIScale.SMALL else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 ) diff --git a/src/assets/ba_data/python/bauiv1lib/league/rankwindow.py b/src/assets/ba_data/python/bauiv1lib/league/rankwindow.py index f207ac7f..331e08e7 100644 --- a/src/assets/ba_data/python/bauiv1lib/league/rankwindow.py +++ b/src/assets/ba_data/python/bauiv1lib/league/rankwindow.py @@ -71,7 +71,7 @@ class LeagueRankWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.08 + 1.3 if uiscale is bui.UIScale.SMALL else 0.93 if uiscale is bui.UIScale.MEDIUM else 0.8 ) diff --git a/src/assets/ba_data/python/bauiv1lib/mainmenu.py b/src/assets/ba_data/python/bauiv1lib/mainmenu.py index 6c02528d..f0d6275d 100644 --- a/src/assets/ba_data/python/bauiv1lib/mainmenu.py +++ b/src/assets/ba_data/python/bauiv1lib/mainmenu.py @@ -30,6 +30,8 @@ class MainMenuWindow(bui.MainWindow): bui.set_analytics_screen('Main Menu') self._show_remote_app_info_on_first_launch() + uiscale = bui.app.ui_v1.uiscale + # Make a vanilla container; we'll modify it to our needs in # refresh. super().__init__( @@ -38,6 +40,8 @@ class MainMenuWindow(bui.MainWindow): ), 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, ) # Grab this stuff in case it changes. @@ -213,7 +217,12 @@ class MainMenuWindow(bui.MainWindow): side_button_2_scale = 0.5 if uiscale is bui.UIScale.SMALL: - root_widget_scale = 1.3 + # We're a generally widescreen shaped window, so bump our + # overall scale up a bit when screen width is wider than safe + # bounds to take advantage of the extra space. + screensize = bui.get_virtual_screen_size() + safesize = bui.get_virtual_safe_area_size() + root_widget_scale = min(1.55, 1.3 * screensize[0] / safesize[0]) button_y_offs = -20.0 self._button_height *= 1.3 elif uiscale is bui.UIScale.MEDIUM: diff --git a/src/assets/ba_data/python/bauiv1lib/party.py b/src/assets/ba_data/python/bauiv1lib/party.py index 65dbfd4a..effa4505 100644 --- a/src/assets/ba_data/python/bauiv1lib/party.py +++ b/src/assets/ba_data/python/bauiv1lib/party.py @@ -48,7 +48,7 @@ class PartyWindow(bui.Window): on_outside_click_call=self.close_with_sound, scale_origin_stack_offset=origin, scale=( - 1.6 + 1.8 if uiscale is bui.UIScale.SMALL else 1.3 if uiscale is bui.UIScale.MEDIUM else 0.9 ), diff --git a/src/assets/ba_data/python/bauiv1lib/play.py b/src/assets/ba_data/python/bauiv1lib/play.py index 9c482f37..647a9d83 100644 --- a/src/assets/ba_data/python/bauiv1lib/play.py +++ b/src/assets/ba_data/python/bauiv1lib/play.py @@ -63,8 +63,15 @@ class PlayWindow(bui.MainWindow): # size of our backing container. This lets us fit to the exact # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() + safesize = bui.get_virtual_safe_area_size() + + # We're a generally widescreen shaped window, so bump our + # overall scale up a bit when screen width is wider than safe + # bounds to take advantage of the extra space. + smallscale = min(1.6, 1.35 * screensize[0] / safesize[0]) + scale = ( - 1.35 + smallscale if uiscale is bui.UIScale.SMALL else 0.9 if uiscale is bui.UIScale.MEDIUM else 0.8 ) diff --git a/src/assets/ba_data/python/bauiv1lib/settings/advanced.py b/src/assets/ba_data/python/bauiv1lib/settings/advanced.py index ae079d50..9986472e 100644 --- a/src/assets/ba_data/python/bauiv1lib/settings/advanced.py +++ b/src/assets/ba_data/python/bauiv1lib/settings/advanced.py @@ -54,7 +54,7 @@ class AdvancedSettingsWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 2.04 + 2.2 if uiscale is bui.UIScale.SMALL else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 ) diff --git a/src/assets/ba_data/python/bauiv1lib/settings/allsettings.py b/src/assets/ba_data/python/bauiv1lib/settings/allsettings.py index 36c4fb4f..fb18c2f5 100644 --- a/src/assets/ba_data/python/bauiv1lib/settings/allsettings.py +++ b/src/assets/ba_data/python/bauiv1lib/settings/allsettings.py @@ -40,8 +40,15 @@ class AllSettingsWindow(bui.MainWindow): # size of our backing container. This lets us fit to the exact # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() + safesize = bui.get_virtual_safe_area_size() + + # We're a generally widescreen shaped window, so bump our + # overall scale up a bit when screen width is wider than safe + # bounds to take advantage of the extra space. + smallscale = min(2.0, 1.5 * screensize[0] / safesize[0]) + scale = ( - 1.5 + smallscale if uiscale is bui.UIScale.SMALL else 1.1 if uiscale is bui.UIScale.MEDIUM else 0.8 ) diff --git a/src/assets/ba_data/python/bauiv1lib/settings/controls.py b/src/assets/ba_data/python/bauiv1lib/settings/controls.py index 562c7e9f..7e49896b 100644 --- a/src/assets/ba_data/python/bauiv1lib/settings/controls.py +++ b/src/assets/ba_data/python/bauiv1lib/settings/controls.py @@ -91,7 +91,7 @@ class ControlsSettingsWindow(bui.MainWindow): height += spacing assert bui.app.classic is not None - smallscale = 1.7 + smallscale = 2.0 super().__init__( root_widget=bui.containerwidget( size=(width, height), diff --git a/src/assets/ba_data/python/bauiv1lib/store/browser.py b/src/assets/ba_data/python/bauiv1lib/store/browser.py index 14ab77d8..5a4baf89 100644 --- a/src/assets/ba_data/python/bauiv1lib/store/browser.py +++ b/src/assets/ba_data/python/bauiv1lib/store/browser.py @@ -83,7 +83,7 @@ class StoreBrowserWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.3 + 1.5 if uiscale is bui.UIScale.SMALL else 0.9 if uiscale is bui.UIScale.MEDIUM else 0.8 ) @@ -109,11 +109,7 @@ class StoreBrowserWindow(bui.MainWindow): if (uiscale is bui.UIScale.SMALL or minimal_toolbars) else 'menu_full' ), - scale=( - 1.3 - if uiscale is bui.UIScale.SMALL - else 0.9 if uiscale is bui.UIScale.MEDIUM else 0.8 - ), + scale=scale, ), transition=transition, origin_widget=origin_widget, @@ -164,17 +160,17 @@ class StoreBrowserWindow(bui.MainWindow): ( self._width * 0.5 + ( - (self._scroll_width * -0.5 + 140.0) + (self._scroll_width * -0.5 + 90.0) if uiscale is bui.UIScale.SMALL else 0.0 ) ), - yoffs - (58 if uiscale is bui.UIScale.SMALL else -3.0), + yoffs - (62 if uiscale is bui.UIScale.SMALL else -3.0), ), size=(0, 0), color=app.ui_v1.title_color, - scale=1.0 if uiscale is bui.UIScale.SMALL else 1.3, - h_align='center', + scale=1.1 if uiscale is bui.UIScale.SMALL else 1.3, + h_align='left' if uiscale is bui.UIScale.SMALL else 'center', v_align='center', text=bui.Lstr(resource='storeText'), maxwidth=100 if uiscale is bui.UIScale.SMALL else 290, diff --git a/src/assets/ba_data/python/bauiv1lib/watch.py b/src/assets/ba_data/python/bauiv1lib/watch.py index 7cd51758..fcd809f5 100644 --- a/src/assets/ba_data/python/bauiv1lib/watch.py +++ b/src/assets/ba_data/python/bauiv1lib/watch.py @@ -57,7 +57,7 @@ class WatchWindow(bui.MainWindow): # screen shape at small ui scale. screensize = bui.get_virtual_screen_size() scale = ( - 1.32 + 1.5 if uiscale is bui.UIScale.SMALL else 0.85 if uiscale is bui.UIScale.MEDIUM else 0.65 ) diff --git a/src/ballistica/base/app_adapter/app_adapter_sdl.cc b/src/ballistica/base/app_adapter/app_adapter_sdl.cc index 31fe570d..686d612e 100644 --- a/src/ballistica/base/app_adapter/app_adapter_sdl.cc +++ b/src/ballistica/base/app_adapter/app_adapter_sdl.cc @@ -671,8 +671,8 @@ void AppAdapterSDL::ReloadRenderer_(const GraphicsSettings_* settings) { // A reasonable default window size. int width, height; if (g_base->ui->scale() == UIScale::kSmall) { - width = static_cast(kBaseVirtualResSmallX * 0.8f); - height = static_cast(kBaseVirtualResSmallY * 0.8f); + width = static_cast(1300.0f * 0.8f); + height = static_cast(600.0f * 0.8f); } else { width = static_cast(kBaseVirtualResX * 0.8f); height = static_cast(kBaseVirtualResY * 0.8f); diff --git a/src/ballistica/base/graphics/graphics.cc b/src/ballistica/base/graphics/graphics.cc index 7c16f67f..b746f391 100644 --- a/src/ballistica/base/graphics/graphics.cc +++ b/src/ballistica/base/graphics/graphics.cc @@ -748,8 +748,8 @@ void Graphics::DrawUI(FrameDef* frame_def) { // Special variants like GraphicsVR may do fancier stuff here. g_base->ui->Draw(frame_def); - // We may want to see the bounds of our virtual screen. - DrawUIBounds(frame_def->overlay_pass()); + // We may want to see the virtual screen safe area. + DrawVirtualSafeAreaBounds(frame_def->overlay_pass()); } void Graphics::DrawDevUI(FrameDef* frame_def) { @@ -1527,13 +1527,13 @@ void Graphics::GetBaseVirtualRes(float* x, float* y) { assert(y); float base_virtual_res_x; float base_virtual_res_y; - if (g_base->ui->scale() == UIScale::kSmall) { - base_virtual_res_x = kBaseVirtualResSmallX; - base_virtual_res_y = kBaseVirtualResSmallY; - } else { - base_virtual_res_x = kBaseVirtualResX; - base_virtual_res_y = kBaseVirtualResY; - } + // if (g_base->ui->scale() == UIScale::kSmall) { + // base_virtual_res_x = kBaseVirtualResSmallX; + // base_virtual_res_y = kBaseVirtualResSmallY; + // } else { + base_virtual_res_x = kBaseVirtualResX; + base_virtual_res_y = kBaseVirtualResY; + // } *x = base_virtual_res_x; *y = base_virtual_res_y; } @@ -1760,9 +1760,9 @@ void Graphics::UpdatePlaceholderSettings() { settings()->texture_quality, client_context()->auto_texture_quality); } -void Graphics::DrawUIBounds(RenderPass* pass) { +void Graphics::DrawVirtualSafeAreaBounds(RenderPass* pass) { // We can optionally draw a guide to show the edges of the overlay pass - if (draw_ui_bounds_) { + if (draw_virtual_safe_area_bounds_) { SimpleComponent c(pass); c.SetColor(1, 0, 0); { diff --git a/src/ballistica/base/graphics/graphics.h b/src/ballistica/base/graphics/graphics.h index 18002cec..f3bedf8a 100644 --- a/src/ballistica/base/graphics/graphics.h +++ b/src/ballistica/base/graphics/graphics.h @@ -152,7 +152,7 @@ class Graphics { r, g, b, a); } - void DrawUIBounds(RenderPass* pass); + void DrawVirtualSafeAreaBounds(RenderPass* pass); static void GetBaseVirtualRes(float* x, float* y); // Enable progress bar drawing locally. @@ -362,8 +362,12 @@ class Graphics { assert(client_context_snapshot_.exists()); return client_context_snapshot_.get()->get(); } - auto draw_ui_bounds() const { return draw_ui_bounds_; } - void set_draw_ui_bounds(bool val) { draw_ui_bounds_ = val; } + auto draw_virtual_safe_area_bounds() const { + return draw_virtual_safe_area_bounds_; + } + void set_draw_virtual_safe_area_bounds(bool val) { + draw_virtual_safe_area_bounds_ = val; + } ScreenMessages* const screenmessages; @@ -424,7 +428,7 @@ class Graphics { bool applied_app_config_{}; bool sent_initial_graphics_settings_{}; bool got_screen_resolution_{}; - bool draw_ui_bounds_{}; + bool draw_virtual_safe_area_bounds_{}; Vector3f shadow_offset_{0.0f, 0.0f, 0.0f}; Vector2f shadow_scale_{1.0f, 1.0f}; Vector3f tint_{1.0f, 1.0f, 1.0f}; diff --git a/src/ballistica/base/python/methods/python_methods_base_2.cc b/src/ballistica/base/python/methods/python_methods_base_2.cc index 2528a5f8..1540d05c 100644 --- a/src/ballistica/base/python/methods/python_methods_base_2.cc +++ b/src/ballistica/base/python/methods/python_methods_base_2.cc @@ -1011,6 +1011,30 @@ static PyMethodDef PyGetVirtualScreenSizeDef = { "Return the current virtual size of the display.", }; +// ----------------------- get_virtual_safe_area_size -------------------------- + +static auto PyGetVirtualSafeAreaSize(PyObject* self) -> PyObject* { + BA_PYTHON_TRY; + BA_PRECONDITION(g_base->InLogicThread()); + + float x, y; + g_base->graphics->GetBaseVirtualRes(&x, &y); + return Py_BuildValue("(ff)", x, y); + BA_PYTHON_CATCH; +} + +static PyMethodDef PyGetVirtualSafeAreaSizeDef = { + "get_virtual_safe_area_size", // name + (PyCFunction)PyGetVirtualSafeAreaSize, // method + METH_NOARGS, // flags + + "get_virtual_safe_area_size() -> tuple[float, float]\n" + "\n" + "(internal)\n" + "\n" + "Return the size of the area on screen that will always be visible.", +}; + // ----------------------------------------------------------------------------- auto PythonMethodsBase2::GetMethods() -> std::vector { @@ -1047,6 +1071,7 @@ auto PythonMethodsBase2::GetMethods() -> std::vector { PyFullscreenControlSetDef, PySetUIAccountStateDef, PyGetVirtualScreenSizeDef, + PyGetVirtualSafeAreaSizeDef, }; } diff --git a/src/ballistica/base/python/methods/python_methods_base_3.cc b/src/ballistica/base/python/methods/python_methods_base_3.cc index a74e0789..c373a4b4 100644 --- a/src/ballistica/base/python/methods/python_methods_base_3.cc +++ b/src/ballistica/base/python/methods/python_methods_base_3.cc @@ -1949,13 +1949,13 @@ static PyMethodDef PyGetInputIdleTimeDef = { "Return seconds since any local input occurred (touch, keypress, etc.).", }; -// --------------------------- get_draw_ui_bounds ----------------------------- +// ------------------ get_draw_virtual_safe_area_bounds ------------------------ -static auto PyGetDrawUIBounds(PyObject* self) -> PyObject* { +static auto PyGetDrawVirtualSafeAreaBounds(PyObject* self) -> PyObject* { BA_PYTHON_TRY; BA_PRECONDITION(g_base->InLogicThread()); - if (g_base->graphics->draw_ui_bounds()) { + if (g_base->graphics->draw_virtual_safe_area_bounds()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; @@ -1963,12 +1963,12 @@ static auto PyGetDrawUIBounds(PyObject* self) -> PyObject* { BA_PYTHON_CATCH; } -static PyMethodDef PyGetDrawUIBoundsDef = { - "get_draw_ui_bounds", // name - (PyCFunction)PyGetDrawUIBounds, // method - METH_NOARGS, // flags +static PyMethodDef PyGetDrawVirtualSafeAreaBoundsDef = { + "get_draw_virtual_safe_area_bounds", // name + (PyCFunction)PyGetDrawVirtualSafeAreaBounds, // method + METH_NOARGS, // flags - "get_draw_ui_bounds() -> bool\n" + "get_draw_virtual_safe_area_bounds() -> bool\n" "\n" "(internal)", }; @@ -1993,10 +1993,10 @@ static PyMethodDef PyGetInitialAppConfigDef = { "(internal)", }; -// --------------------------- set_draw_ui_bounds ----------------------------- +// ------------------ set_draw_virtual_safe_area_bounds ------------------------ -static auto PySetDrawUIBounds(PyObject* self, PyObject* args, PyObject* keywds) - -> PyObject* { +static auto PySetDrawVirtualSafeAreaBounds(PyObject* self, PyObject* args, + PyObject* keywds) -> PyObject* { BA_PYTHON_TRY; BA_PRECONDITION(g_base->InLogicThread()); @@ -2008,18 +2008,18 @@ static auto PySetDrawUIBounds(PyObject* self, PyObject* args, PyObject* keywds) return nullptr; } - g_base->graphics->set_draw_ui_bounds(value); + g_base->graphics->set_draw_virtual_safe_area_bounds(value); Py_RETURN_NONE; BA_PYTHON_CATCH; } -static PyMethodDef PySetDrawUIBoundsDef = { - "set_draw_ui_bounds", // name - (PyCFunction)PySetDrawUIBounds, // method - METH_VARARGS | METH_KEYWORDS, // flags +static PyMethodDef PySetDrawVirtualSafeAreaBoundsDef = { + "set_draw_virtual_safe_area_bounds", // name + (PyCFunction)PySetDrawVirtualSafeAreaBounds, // method + METH_VARARGS | METH_KEYWORDS, // flags - "set_draw_ui_bounds(value: bool) -> None\n" + "set_draw_virtual_safe_area_bounds(value: bool) -> None\n" "\n" "(internal)", }; @@ -2163,8 +2163,8 @@ auto PythonMoethodsBase3::GetMethods() -> std::vector { PyOpenFileExternallyDef, PyGetInputIdleTimeDef, PyPushBackPressDef, - PyGetDrawUIBoundsDef, - PySetDrawUIBoundsDef, + PyGetDrawVirtualSafeAreaBoundsDef, + PySetDrawVirtualSafeAreaBoundsDef, PyGetInitialAppConfigDef, PySetAppConfigDef, PyUpdateInternalLoggerLevelsDef, diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index d6b0ae2e..63ca322c 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 = 22236; +const int kEngineBuildNumber = 22238; const char* kEngineVersion = "1.7.37"; const int kEngineApiVersion = 9; diff --git a/src/ballistica/shared/ballistica.h b/src/ballistica/shared/ballistica.h index c5aa109b..8e9507af 100644 --- a/src/ballistica/shared/ballistica.h +++ b/src/ballistica/shared/ballistica.h @@ -49,8 +49,8 @@ const int kBaseVirtualResY = 720; // Our 'small' res which is used for 'small' ui mode only. This matches // the 19.5:9 aspect ratio common on modern smartphones (as of 2024). -const int kBaseVirtualResSmallX = 1300; -const int kBaseVirtualResSmallY = 600; +// const int kBaseVirtualResSmallX = 1300; +// const int kBaseVirtualResSmallY = 600; // Magic numbers at the start of our file types. const int kBrpFileID = 83749; diff --git a/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc b/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc index c83f3f49..59209549 100644 --- a/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc +++ b/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc @@ -2594,13 +2594,13 @@ auto PyUIBounds(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* { // current (which can be bigger). float x, virtual_res_y; - if (g_base->ui->scale() == UIScale::kSmall) { - x = 0.5f * kBaseVirtualResSmallX; - virtual_res_y = kBaseVirtualResSmallY; - } else { - x = 0.5f * kBaseVirtualResX; - virtual_res_y = kBaseVirtualResY; - } + // if (g_base->ui->scale() == UIScale::kSmall) { + // x = 0.5f * kBaseVirtualResSmallX; + // virtual_res_y = kBaseVirtualResSmallY; + // } else { + x = 0.5f * kBaseVirtualResX; + virtual_res_y = kBaseVirtualResY; + // } float y = 0.5f * virtual_res_y; return Py_BuildValue("(ffff)", -x, x, -y, y); BA_PYTHON_CATCH; diff --git a/src/ballistica/ui_v1/widget/root_widget.cc b/src/ballistica/ui_v1/widget/root_widget.cc index d93cf209..25ae2c3d 100644 --- a/src/ballistica/ui_v1/widget/root_widget.cc +++ b/src/ballistica/ui_v1/widget/root_widget.cc @@ -1333,7 +1333,7 @@ void RootWidget::UpdateLayout() { base_scale_ = 0.8f; break; default: - base_scale_ = 1.0f; + base_scale_ = 1.18f; break; }