mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 21:37:57 +08:00
playlist browser now adapts to screen size on small ui and shows more on large ui
This commit is contained in:
parent
b4b44790cb
commit
fe4aa9be8f
52
.efrocachemap
generated
52
.efrocachemap
generated
@ -432,7 +432,7 @@
|
||||
"build/assets/ba_data/audio/zoeOw.ogg": "b2d705c31c9dcc1efdc71394764c3beb",
|
||||
"build/assets/ba_data/audio/zoePickup01.ogg": "e9366dc2d2b8ab8b0c4e2c14c02d0789",
|
||||
"build/assets/ba_data/audio/zoeScream01.ogg": "903e0e45ee9b3373e9d9ce20c814374e",
|
||||
"build/assets/ba_data/data/langdata.json": "68bb24b898213188cd0d3dc0ba7cc1a4",
|
||||
"build/assets/ba_data/data/langdata.json": "603a4d0333564e469a7782d1bf39150b",
|
||||
"build/assets/ba_data/data/languages/arabic.json": "32b9849fb8389b8c7798f0b744620318",
|
||||
"build/assets/ba_data/data/languages/belarussian.json": "009b452aa308bf2b2f7e92d9b78ba5ff",
|
||||
"build/assets/ba_data/data/languages/chinese.json": "5363a79f843e6be7ef47a840f47cc17d",
|
||||
@ -462,7 +462,7 @@
|
||||
"build/assets/ba_data/data/languages/russian.json": "70cd57440e4cbb49f2fa0c79dedcafbe",
|
||||
"build/assets/ba_data/data/languages/serbian.json": "623fa4129a1154c2f32ed7867e56ff6a",
|
||||
"build/assets/ba_data/data/languages/slovak.json": "c11c29708b3742cdc2a92b4fa0d6d29f",
|
||||
"build/assets/ba_data/data/languages/spanish.json": "dbd5c1550b08ee77c0d6947cba759e7e",
|
||||
"build/assets/ba_data/data/languages/spanish.json": "8c319f6e50275fb0a22d5f1bd4b7f1e0",
|
||||
"build/assets/ba_data/data/languages/swedish.json": "3b179e7333183c70adb0811246b09959",
|
||||
"build/assets/ba_data/data/languages/tamil.json": "ead39b864228696a9b0d19344bc4b5ec",
|
||||
"build/assets/ba_data/data/languages/thai.json": "383540a1e9c7c131ac579f51afc87471",
|
||||
@ -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": "c1d6a9f331f9defedb0356017b436dfa",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "8a7b84d1522ceb056a0dba72a5fb567a",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "e218c8034bf1c8ee3593404706881788",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "d8ddc90445b569a14ac5386af0655650",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "1d16147a14e887edb2e58655265b47b3",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "b6a9d6fbba3bf186692b9a72846af373",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "d1169b7d48ce3f7255fa324bb0e41e5e",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "280a58af50d33f93f5e5e259d7b5e660",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "0885cb3baf58ca2cdf35f3aba923872d",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "f97dea463227677f13ca43005a7e9a52",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "9640022b959d9d088cffc2c56e7f6e6d",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "c6db1901367a3e49b901016a1160704b",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "ef708586f854cab45a3f6bb08a3b993e",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "2452545a539df2f1d1582c97c191bb76",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "b651c703b353c9d821e63131ee50dff2",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "275356349c832c7b9547343ea620ab39",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "9f8cc8474d9d9fafa7851c24e3b621c0",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "346b7218b645de8318994f3124bc9312",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "847cc254906723c32d27d778bdeb7b68",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "58c31a76047ed77c0f438af29f5d028e",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "94f1b6f9cbfff14e5d6a9276e222c7f4",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "d86bc94af4461ef2dec7ccd3dcd5578f",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "893ea9524e6d6abf8d0c47ae5ec0e66b",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "dadc5b75429ca98e406a99fe47c10cdd",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "1bcb3955cbf88fda9c66938cd773ffe4",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "0da1566deefa1bbc5f84c1e2e1fc2ab6",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "555b58e77cd6a5d736806367a8f0c18f",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "360b0662c075fd6f55f4c9c2a3ffbebd",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "22591e638d3f72c10a80856e050b00f8",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "ae2b28631e9e7b6fea4680c7981979bb",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "ba456d79d1148a2eb4197ada84adacfd",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "8318c623f927f576b415bc4e2f41c1fa",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "7497894d2943b75b6ac830cdba8481af",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "273a6f64cac5a233694223b85cd0f22b",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "7497894d2943b75b6ac830cdba8481af",
|
||||
@ -4202,14 +4202,14 @@
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "7e071962108a8d1727525fb331b70ee4",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "55a2b0c2d1db4d70627c901471d05fc7",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "7e071962108a8d1727525fb331b70ee4",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "256605f85c5783e642a6c017b6f33529",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "2d8ae34ca74cf04895ab7344c095fc8b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "61db19c25f5b288bf77658ee6d51de60",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "8c33dea530a9d20109c9162136cd2f43",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "ec60efa0a96b66e1ee37e8089b0961bd",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "b1670cf0be5d26cf8b809334c20c160b",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "4efb2248d04ae76e3120cc8803295e45",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "064488e219c0f9dee4841a1285d66d6c",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "1be9c32787b77fbff6b873c2105aa8df",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "e06383bd4455b4fb8d8c2a80af08f66f",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "5c188e125967a837a3ec8098bd18da7b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "0075d2a35454bf2a798947d30bc2304e",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "35dcb66b6c629d8d692d9e8fdca84708",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "2b34093f00e3059767b4a5aaf0978098",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "6df45f531d709730e042c6c0b492822a",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "3c0dff3038d6277c2e8535e0fc9e2e49",
|
||||
"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",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.37 (build 22220, api 9, 2025-01-20)
|
||||
### 1.7.37 (build 22221, api 9, 2025-01-20)
|
||||
- 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.
|
||||
|
||||
@ -53,7 +53,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 22220
|
||||
TARGET_BALLISTICA_BUILD = 22221
|
||||
TARGET_BALLISTICA_VERSION = '1.7.37'
|
||||
|
||||
|
||||
|
||||
@ -52,8 +52,8 @@ class AchievementsWindow(bui.MainWindow):
|
||||
target_width = min(self._width - 60, screensize[0] / scale)
|
||||
target_height = min(self._height - 70, 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.
|
||||
# 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
|
||||
|
||||
scroll_width = target_width
|
||||
|
||||
@ -53,19 +53,45 @@ class PlaylistBrowserWindow(bui.MainWindow):
|
||||
)
|
||||
|
||||
uiscale = bui.app.ui_v1.uiscale
|
||||
self._width = 1100.0 if uiscale is bui.UIScale.SMALL else 800.0
|
||||
x_inset = 150 if uiscale is bui.UIScale.SMALL else 0
|
||||
self._height = (
|
||||
440
|
||||
self._width = (
|
||||
1100.0
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 510 if uiscale is bui.UIScale.MEDIUM else 580
|
||||
else 800.0 if uiscale is bui.UIScale.MEDIUM else 1040
|
||||
)
|
||||
self._height = (
|
||||
600
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 550 if uiscale is bui.UIScale.MEDIUM else 700
|
||||
)
|
||||
|
||||
top_extra = 30 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.
|
||||
#
|
||||
# TODO: We need an auto-refresh mechanism for cases where screen
|
||||
# size changes under us. Currently one must navigate out and
|
||||
# back in to properly reflect such changes.
|
||||
screensize = bui.get_virtual_screen_size()
|
||||
scale = (
|
||||
1.85
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 1.0 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 - 100, 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
|
||||
|
||||
self._scroll_width = target_width
|
||||
self._scroll_height = target_height - 31
|
||||
scroll_y = yoffs - 60 - self._scroll_height
|
||||
|
||||
super().__init__(
|
||||
root_widget=bui.containerwidget(
|
||||
size=(self._width, self._height + top_extra),
|
||||
size=(self._width, self._height),
|
||||
toolbar_visibility=(
|
||||
'menu_minimal'
|
||||
if (
|
||||
@ -74,37 +100,38 @@ class PlaylistBrowserWindow(bui.MainWindow):
|
||||
)
|
||||
else 'menu_full'
|
||||
),
|
||||
scale=(
|
||||
1.85
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 1.05 if uiscale is bui.UIScale.MEDIUM else 0.9
|
||||
),
|
||||
stack_offset=(
|
||||
(0, -46) if uiscale is bui.UIScale.SMALL else (0, 0)
|
||||
),
|
||||
scale=scale,
|
||||
),
|
||||
transition=transition,
|
||||
origin_widget=origin_widget,
|
||||
)
|
||||
|
||||
self._back_button: bui.Widget | None = bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
position=(59 + x_inset, self._height - 70),
|
||||
size=(120, 60),
|
||||
scale=1.0,
|
||||
on_activate_call=self._on_back_press,
|
||||
autoselect=True,
|
||||
label=bui.Lstr(resource='backText'),
|
||||
button_type='back',
|
||||
)
|
||||
bui.containerwidget(
|
||||
edit=self._root_widget, cancel_button=self._back_button
|
||||
)
|
||||
self._back_button: bui.Widget | None
|
||||
if uiscale is bui.UIScale.SMALL:
|
||||
self._back_button = None
|
||||
bui.containerwidget(
|
||||
edit=self._root_widget, on_cancel_call=self._on_back_press
|
||||
)
|
||||
else:
|
||||
self._back_button = bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
position=(59, yoffs - 45),
|
||||
size=(60, 54),
|
||||
scale=1.0,
|
||||
on_activate_call=self._on_back_press,
|
||||
autoselect=True,
|
||||
label=bui.charstr(bui.SpecialChar.BACK),
|
||||
button_type='backSmall',
|
||||
)
|
||||
bui.containerwidget(
|
||||
edit=self._root_widget, cancel_button=self._back_button
|
||||
)
|
||||
|
||||
self._title_text = bui.textwidget(
|
||||
parent=self._root_widget,
|
||||
position=(
|
||||
self._width * 0.5,
|
||||
self._height - (32 if uiscale is bui.UIScale.SMALL else 41),
|
||||
yoffs - (45 if uiscale is bui.UIScale.SMALL else 20),
|
||||
),
|
||||
size=(0, 0),
|
||||
text=self._pvars.window_title_name,
|
||||
@ -115,36 +142,13 @@ class PlaylistBrowserWindow(bui.MainWindow):
|
||||
v_align='center',
|
||||
)
|
||||
|
||||
bui.buttonwidget(
|
||||
edit=self._back_button,
|
||||
button_type='backSmall',
|
||||
size=(60, 54),
|
||||
position=(59 + x_inset, self._height - 67),
|
||||
label=bui.charstr(bui.SpecialChar.BACK),
|
||||
)
|
||||
|
||||
if uiscale is bui.UIScale.SMALL:
|
||||
self._back_button.delete()
|
||||
self._back_button = None
|
||||
bui.containerwidget(
|
||||
edit=self._root_widget, on_cancel_call=self._on_back_press
|
||||
)
|
||||
scroll_offs = 33
|
||||
else:
|
||||
scroll_offs = 0
|
||||
self._scroll_width = self._width - (100 + 2 * x_inset)
|
||||
self._scroll_height = self._height - (
|
||||
146 if uiscale is bui.UIScale.SMALL else 136
|
||||
)
|
||||
self._scrollwidget = bui.scrollwidget(
|
||||
parent=self._root_widget,
|
||||
highlight=False,
|
||||
size=(self._scroll_width, self._scroll_height),
|
||||
position=(
|
||||
(self._width - self._scroll_width) * 0.5,
|
||||
65 + scroll_offs + (0 if uiscale is bui.UIScale.SMALL else -5),
|
||||
),
|
||||
position=(self._width * 0.5 - self._scroll_width * 0.5, scroll_y),
|
||||
border_opacity=0.4,
|
||||
center_small_content_horizontally=True,
|
||||
)
|
||||
bui.containerwidget(edit=self._scrollwidget, claims_left_right=True)
|
||||
self._subcontainer: bui.Widget | None = None
|
||||
@ -372,15 +376,22 @@ class PlaylistBrowserWindow(bui.MainWindow):
|
||||
items.sort(key=lambda x2: asserttype(x2[0], str).lower())
|
||||
items = [['__default__', None]] + items # default is always first
|
||||
|
||||
count = len(items)
|
||||
columns = 3
|
||||
rows = int(math.ceil(float(count) / columns))
|
||||
button_width = 230
|
||||
button_height = 230
|
||||
button_buffer_h = -3
|
||||
button_buffer_v = 0
|
||||
|
||||
self._sub_width = self._scroll_width
|
||||
count = len(items)
|
||||
columns = max(
|
||||
1,
|
||||
math.floor(
|
||||
self._scroll_width / (button_width + 2 * button_buffer_h)
|
||||
),
|
||||
)
|
||||
rows = int(math.ceil(float(count) / columns))
|
||||
|
||||
self._sub_width = columns * button_width + 2 * button_buffer_h
|
||||
|
||||
self._sub_height = (
|
||||
40.0 + rows * (button_height + 2 * button_buffer_v) + 90
|
||||
)
|
||||
@ -459,7 +470,7 @@ class PlaylistBrowserWindow(bui.MainWindow):
|
||||
),
|
||||
on_select_call=bui.Call(self._on_playlist_select, name),
|
||||
)
|
||||
bui.widget(edit=btn, show_buffer_top=50, show_buffer_bottom=50)
|
||||
bui.widget(edit=btn, show_buffer_top=30, show_buffer_bottom=30)
|
||||
|
||||
if self._selected_playlist == name:
|
||||
bui.containerwidget(
|
||||
|
||||
@ -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 = 22220;
|
||||
const int kEngineBuildNumber = 22221;
|
||||
const char* kEngineVersion = "1.7.37";
|
||||
const int kEngineApiVersion = 9;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user