store window is now screen-size-responsive

This commit is contained in:
Eric Froemling 2025-01-22 17:12:05 -08:00
parent e4ce015fcf
commit 04337000bc
No known key found for this signature in database
6 changed files with 121 additions and 95 deletions

48
.efrocachemap generated
View File

@ -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": "f7d08fbd72a0894dfce797e51f914b1c",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "73957f49ba4a098666812912f16487ca",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "4cf6065ea0c4581b1bd87cae43ade7ec",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "8ab9225590a1d42e3d8f5e65086adb27",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "d67ba5cfaee14bd72a90e4b7ef98c69a",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "29422b5c4f29d1c7992748a1fd04a1c1",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "c0f1dc95fcb52f58d521d3b23aef828e",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "f92c50cd9f6f199d22e6774bc7771bb4",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "29d3706e79592f02a46524156cec66db",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "055d3ca125ec2cc4cab88debe636dbe7",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "157070b431db26add10fa78b2d4ec3c1",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "968b0055431f6451710d21107a69c70f",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "3c67d5225bcac7ef234cde44263bfea3",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8c7e793f291cc790524ec9545e56f9bf",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "ecbe7c842634edd985c73ffbd1d16ab1",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "d72021dd04618834154ee7a70538ef77",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "9e818494845ff5344780b72b5988867f",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "c81da6ba8fa2de1c94da5733a60189fa",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "b01e08a6a59dcd7d808b3a079b5014fb",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "0d5b57e412cbb52204ce3ece08924cb6",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "1f5af4f7466cb329ee03d085749e835c",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "7a9a11e8fdad56b1aa2cd8654d8574be",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "0c016926940f6bf9e94e452f42e1e588",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "94b0959afc637d9e007614800bf3b827",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "167fac667b73a9f6869a1be3f116aea8",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "f6f5aafab72ed17ce33e17f3d01a1ab6",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "8dd3e8c63d30f96c1852bbb14ed06032",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "e85785c1c69693baa542619e854386b5",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "998debc459647c9e73793706ca782617",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "3b67899b55ef1531b1eed045482a7bd0",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "11bab1183e99bdb735664dea49226c23",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "c054369ec524817de898781fdea1f2f1",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "4d70703c4eba1a402fbc2d997d84aa93",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "bb64e2182b1a533679f93c5997f14584",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "4d70703c4eba1a402fbc2d997d84aa93",
@ -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": "2cc15cbbc10d2ae2a24a19473a273501",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c27f9b1ef33ab55005f9f0484e14f198",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "dcc442b0d6ba485603430ba5f66557ca",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "af78e2540ca86b5c08bdc6866d443a74",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "475fb627204ff9cfc94acd5d522bfbf6",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "fea88f47db12e4f09e667e023ddb708e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "832ae1966945e2be619a694a95e6f708",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "69c937c5c4dff8fecd12cda84bbe7532",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "a926e1e01b876332520587b836eb4375",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "f1f46c598c6e5bcaa6604661d1700f2b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "ae2fa87f97d66bf2f352882028abe272",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "ccfea410203fba94a1b24084536f54ca",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "6f839d1b563635adf42feda7f3caa1fc",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "56587738242e082b87d4359eccfd7a43",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "9410860a48dc0d4830a45f1cc88990b7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "44db1c45b0ca7aeaf7187e5b66554634",
"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",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 22232, api 9, 2025-01-22)
### 1.7.37 (build 22233, api 9, 2025-01-22)
- 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.

View File

@ -53,7 +53,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 22232
TARGET_BALLISTICA_BUILD = 22233
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -139,7 +139,7 @@ class PlayWindow(bui.MainWindow):
)
scl = 0.75 if self._playlist_select_context is None else 0.68
v = height * 0.5 - button_height * scl * 0.5
v = height * 0.5 - button_height * scl * 0.5 - 20.0
clr = (0.6, 0.7, 0.6, 1.0)
bcount = 3 if self._playlist_select_context is None else 2

View File

@ -61,10 +61,9 @@ class StoreBrowserWindow(bui.MainWindow):
self._status_textwidget_update_timer = None
self._show_tab = show_tab
self._width = 1670 if uiscale is bui.UIScale.SMALL else 1040
self._x_inset = x_inset = 310 if uiscale is bui.UIScale.SMALL else 0
self._width = 1800 if uiscale is bui.UIScale.SMALL else 1040
self._height = (
538
1200
if uiscale is bui.UIScale.SMALL
else 645 if uiscale is bui.UIScale.MEDIUM else 800
)
@ -75,6 +74,29 @@ class StoreBrowserWindow(bui.MainWindow):
self._r = 'store'
self._last_buy_time: float | None = None
# 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.3
if uiscale is bui.UIScale.SMALL
else 0.9 if uiscale is bui.UIScale.MEDIUM else 0.8
)
# Calc screen size in our local container space and clamp to a
# bit smaller than our container size.
target_width = min(self._width - 120, screensize[0] / scale)
target_height = min(self._height - 140, 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
self._scroll_width = target_width
self._scroll_height = target_height - 50
self._scroll_bottom = yoffs - 80 - self._scroll_height
super().__init__(
root_widget=bui.containerwidget(
size=(self._width, self._height + extra_top),
@ -88,24 +110,21 @@ class StoreBrowserWindow(bui.MainWindow):
if uiscale is bui.UIScale.SMALL
else 0.9 if uiscale is bui.UIScale.MEDIUM else 0.8
),
stack_offset=(
(0, 10)
if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
),
),
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,
)
self._back_button = btn = bui.buttonwidget(
parent=self._root_widget,
position=(70 + x_inset, self._height - 74),
size=(140, 60),
position=(70, yoffs - 37),
size=(60, 60),
scale=1.1,
autoselect=True,
label=bui.Lstr(resource='backText'),
button_type='back',
label=bui.charstr(SpecialChar.BACK),
button_type='backSmall',
on_activate_call=self.main_window_back,
)
@ -114,10 +133,8 @@ class StoreBrowserWindow(bui.MainWindow):
bui.containerwidget(
edit=self._root_widget, on_cancel_call=self.main_window_back
)
backbuttonspecial = True
else:
bui.containerwidget(edit=self._root_widget, cancel_button=btn)
backbuttonspecial = False
if (
app.classic.platform in ['mac', 'ios']
@ -140,29 +157,25 @@ class StoreBrowserWindow(bui.MainWindow):
bui.textwidget(
parent=self._root_widget,
position=(
self._width * 0.5,
self._height - (55 if uiscale is bui.UIScale.SMALL else 44),
(
self._width * 0.5
+ (
(self._scroll_width * -0.5 + 140.0)
if uiscale is bui.UIScale.SMALL
else 0.0
)
),
yoffs - (48 if uiscale is bui.UIScale.SMALL else -3.0),
),
size=(0, 0),
color=app.ui_v1.title_color,
scale=1.1 if uiscale is bui.UIScale.SMALL else 1.5,
scale=1.1 if uiscale is bui.UIScale.SMALL else 1.3,
h_align='center',
v_align='center',
text=bui.Lstr(resource='storeText'),
maxwidth=290,
maxwidth=100 if uiscale is bui.UIScale.SMALL else 290,
)
if not backbuttonspecial:
bui.buttonwidget(
edit=self._back_button,
button_type='backSmall',
size=(60, 60),
label=bui.charstr(SpecialChar.BACK),
)
scroll_buffer_h = 130 + 2 * x_inset
tab_buffer_h = 250 + 2 * x_inset
tabs_def = [
# (self.TabID.EXTRAS, bui.Lstr(resource=f'{self._r}.extrasText')),
(self.TabID.MAPS, bui.Lstr(resource=f'{self._r}.mapsText')),
@ -177,11 +190,17 @@ class StoreBrowserWindow(bui.MainWindow):
(self.TabID.ICONS, bui.Lstr(resource=f'{self._r}.iconsText')),
]
tab_inset = 200 if uiscale is bui.UIScale.SMALL else 100
self._tab_row = TabRow(
self._root_widget,
tabs_def,
pos=(tab_buffer_h * 0.5, self._height - 130),
size=(self._width - tab_buffer_h, 50),
# pos=(tab_buffer_h * 0.5, self._height - 130),
# size=(self._width - tab_buffer_h, 50),
size=(self._scroll_width - 2.0 * tab_inset, 50),
pos=(
self._width * 0.5 - self._scroll_width * 0.5 + tab_inset,
self._scroll_bottom + self._scroll_height,
),
on_select_call=self._set_tab,
)
@ -267,14 +286,16 @@ class StoreBrowserWindow(bui.MainWindow):
bui.widget(
edit=first_tab_button,
left_widget=bui.get_special_widget('back_button'),
up_widget=bui.get_special_widget('back_button'),
)
bui.widget(
edit=last_tab_button,
right_widget=bui.get_special_widget('squad_button'),
up_widget=bui.get_special_widget('tickets_meter'),
right_widget=bui.get_special_widget('tickets_meter'),
)
self._scroll_width = self._width - scroll_buffer_h
self._scroll_height = self._height - 180
# self._scroll_width = self._width - scroll_buffer_h
# self._scroll_height = self._height - 180
self._scrollwidget: bui.Widget | None = None
self._status_textwidget: bui.Widget | None = None
@ -343,11 +364,11 @@ class StoreBrowserWindow(bui.MainWindow):
self._scrollwidget = bui.scrollwidget(
parent=self._root_widget,
highlight=False,
position=(
(self._width - self._scroll_width) * 0.5,
self._height - self._scroll_height - 79 - 48,
),
size=(self._scroll_width, self._scroll_height),
position=(
self._width * 0.5 - self._scroll_width * 0.5,
self._scroll_bottom,
),
claims_left_right=True,
selection_loops_to_parent=True,
border_opacity=0.4,
@ -837,11 +858,12 @@ class StoreBrowserWindow(bui.MainWindow):
)
if 'title' not in section:
section['title'] = ''
section['x_offs'] = (
130
if self._tab == 'extras'
else 270 if self._tab == 'maps' else 0
)
section['x_offs'] = 0.0
# section['x_offs'] = (
# 130
# if self._tab == 'extras'
# else 270 if self._tab == 'maps' else 0
# )
section['y_offs'] = (
20
if (
@ -873,7 +895,7 @@ class StoreBrowserWindow(bui.MainWindow):
title_spacing = 40
button_border = 20
button_spacing = 4
boffs_h = 40
boffs_h = 0.0
self._height = 80.0
# Calc total height.
@ -882,17 +904,16 @@ class StoreBrowserWindow(bui.MainWindow):
assert self._height is not None
self._height += title_spacing
b_width, b_height = section['button_size']
b_column_count = int(
b_count = len(section['items'])
b_column_count = min(
b_count,
int(
math.floor(
(self._width - boffs_h - 20)
/ (b_width + button_spacing)
)
)
b_row_count = int(
math.ceil(
float(len(section['items'])) / b_column_count
self._width / (b_width + button_spacing)
)
),
)
b_row_count = int(math.ceil(b_count / b_column_count))
b_height_total = (
2 * button_border
+ b_row_count * b_height
@ -1017,12 +1038,15 @@ class StoreBrowserWindow(bui.MainWindow):
v -= button_border
b_width, b_height = section['button_size']
b_count = len(section['items'])
b_column_count = int(
b_column_count = min(
b_count,
int(
math.floor(
(self._width - boffs_h - 20)
/ (b_width + button_spacing)
self._width / (b_width + button_spacing)
)
),
)
col = 0
item: dict[str, Any]
assert self._store_window.button_infos is not None
@ -1033,15 +1057,17 @@ class StoreBrowserWindow(bui.MainWindow):
item['call'] = bui.WeakCall(
self._store_window.buy, item_name
)
if 'x_offs' in section:
boffs_h2 = section['x_offs']
else:
boffs_h2 = 0
boffs_h2 = section.get('x_offs', 0.0)
boffs_v2 = section.get('y_offs', 0.0)
# Calc the diff between the space we use and
# the space available and nudge us right by
# half that to center things.
boffs_h2 += 0.5 * (
self._width
- ((b_width + button_spacing) * b_column_count)
)
if 'y_offs' in section:
boffs_v2 = section['y_offs']
else:
boffs_v2 = 0
b_pos = (
boffs_h
+ boffs_h2

View File

@ -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 = 22232;
const int kEngineBuildNumber = 22233;
const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9;