chest window is now screen-size-responsive

This commit is contained in:
Eric Froemling 2025-01-23 13:55:38 -08:00
parent 447d7df05d
commit 81b83dc262
No known key found for this signature in database
7 changed files with 109 additions and 89 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": "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/full/linux_arm64_gui/debug/ballisticakit": "9586059917b68d5e1c63e6e4c2a65b97",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "5c96ded4f5ac876ad063a8194062c828",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "77cfa82b16ecdf951b2dc95927e78a84",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "4becd7098fe72c991917ad853161348b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "068ad5fd9d6a2a9332398a3b06bfea9f",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "5feeadb78a562da1957ee85513ffe97e",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "80137664014da1e3379a0e0ea2d2d972",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "7b5d8ff3b7263ff742c48223b70501eb",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "8ce3831ee5e8e2942f4624e340908520",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "7f512c46f11bffa6149fa588d746fe34",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "7a5f32eccc54e7b78d2733d1f7d7a29f",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "85e95bf514ef456d785abde4f74441b9",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "446b773eafba1c044ae4d481e176af40",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "60e949d37d19cbad9a0d036fd37068b3",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "b8dbb1cae92de06a49c19d4292db5b1b",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "4db34c7b0a5a9f09f73deda8e2746039",
"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": "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",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "defe2db9fa7ba168b5d85b15a626bf96",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "97d543bf0eb1c716486a92ff68cbcab1",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "858f9fb413db98abd7a49a73fef4cec3",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "1338eb5828608de643c9ce422f121c5c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "c4cc5c798e88aa4bae31f0af3d857a45",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "0c2f7fa1ad75ef1c4778567f1cfa62d9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "6b9f287bde6ee13be95e1623a90c8344",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "b43c3ee89137cab0fed1ba293aa0d112",
"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 22243, api 9, 2025-01-23)
### 1.7.37 (build 22245, 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.

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 = 22243
TARGET_BALLISTICA_BUILD = 22245
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -35,9 +35,7 @@ class ChestWindow(bui.MainWindow):
assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale
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
self._height = 800 if uiscale is bui.UIScale.SMALL else 450
self._action_in_flight = False
self._open_now_button: bui.Widget | None = None
self._open_now_spinner: bui.Widget | None = None
@ -57,23 +55,40 @@ class ChestWindow(bui.MainWindow):
# The set of widgets we keep when doing a clear.
self._core_widgets: list[bui.Widget] = []
# 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.8
if uiscale is bui.UIScale.SMALL
else 1.1 if uiscale is bui.UIScale.MEDIUM else 0.9
)
# Calc screen size in our local container space and clamp to a
# bit smaller than our container size.
target_height = min(self._height - 120, 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.
self._yoffstop = 0.5 * self._height + 0.5 * target_height + 18
# Offset for stuff we want centered.
self._yoffs = 0.5 * self._height + (
220 if uiscale is bui.UIScale.SMALL else 190
)
self._chest_yoffs = self._yoffs - 223
super().__init__(
root_widget=bui.containerwidget(
size=(self._width, self._height),
toolbar_visibility='menu_full',
scale=(
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, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
),
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,
)
# Tell the root-ui to stop updating toolbar values immediately;
@ -84,14 +99,18 @@ class ChestWindow(bui.MainWindow):
self._title_text = bui.textwidget(
parent=self._root_widget,
position=(0, self._height - 50 + self._yoffs),
size=(self._width, 25),
position=(
self._width * 0.5,
self._yoffstop - (36 if uiscale is bui.UIScale.SMALL else 10),
),
size=(0, 0),
text=bui.Lstr(
resource='chests.slotText',
subs=[('${NUM}', str(index + 1))],
),
color=bui.app.ui_v1.title_color,
maxwidth=150.0,
maxwidth=110.0 if uiscale is bui.UIScale.SMALL else 200,
scale=0.9 if uiscale is bui.UIScale.SMALL else 1.1,
h_align='center',
v_align='center',
)
@ -104,7 +123,7 @@ class ChestWindow(bui.MainWindow):
else:
btn = bui.buttonwidget(
parent=self._root_widget,
position=(self._xoffs + 50, self._height - 55 + self._yoffs),
position=(50, self._yoffs - 44),
size=(60, 55),
scale=0.8,
label=bui.charstr(bui.SpecialChar.BACK),
@ -127,7 +146,7 @@ class ChestWindow(bui.MainWindow):
self._infotext = bui.textwidget(
parent=self._root_widget,
position=(self._width * 0.5, self._height - 200 + self._yoffs),
position=(self._width * 0.5, self._yoffs - 200),
size=(0, 0),
text='',
maxwidth=700,
@ -306,7 +325,8 @@ class ChestWindow(bui.MainWindow):
parent=self._root_widget,
position=(
self._width * 0.5 - imgsize * 0.5,
self._height - 223 + self._yoffs,
# self._height - 223 + self._yoffs,
self._chest_yoffs,
),
color=self._chestdisplayinfo.color,
size=(imgsize, imgsize),
@ -328,7 +348,8 @@ class ChestWindow(bui.MainWindow):
parent=self._root_widget,
position=(
self._width * 0.5 - imgsize * 0.4 - lsize * 0.5,
self._height - 223 + 27.0 + self._yoffs,
# self._height - 223 + 27.0 + self._yoffs,
self._chest_yoffs + 27.0,
),
size=(lsize, lsize),
texture=bui.gettexture('lock'),
@ -338,7 +359,11 @@ class ChestWindow(bui.MainWindow):
if chest.unlock_tokens != 0:
self._time_string_text = bui.textwidget(
parent=self._root_widget,
position=(self._width * 0.5, self._height - 85 + self._yoffs),
position=(
self._width * 0.5,
# self._height - 85 + self._yoffs
self._yoffs - 85,
),
size=(0, 0),
text='',
maxwidth=700,
@ -372,7 +397,7 @@ class ChestWindow(bui.MainWindow):
parent=self._root_widget,
position=(
self._width * 0.5 - bwidth * 0.5 + boffsx,
self._height + bposy + self._yoffs,
self._yoffs + bposy,
),
size=(bwidth, bheight),
label='',
@ -394,7 +419,7 @@ class ChestWindow(bui.MainWindow):
text=bui.Lstr(resource='openText'),
position=(
self._width * 0.5 + boffsx,
self._height + bposy + self._yoffs + bheight * 0.5,
self._yoffs + bposy + bheight * 0.5,
),
color=(0, 1, 0),
draw_controller=self._open_now_button,
@ -412,7 +437,7 @@ class ChestWindow(bui.MainWindow):
text=bui.Lstr(resource='openNowText'),
position=(
self._width * 0.5 + boffsx,
self._height + bposy + self._yoffs + bheight * 1.15,
self._yoffs + bposy + bheight * 1.15,
),
maxwidth=bwidth * 0.8,
scale=0.7,
@ -428,7 +453,7 @@ class ChestWindow(bui.MainWindow):
size=(iconsize, iconsize),
position=(
self._width * 0.5 - iconsize * 0.5 + boffsx,
self._height + bposy + self._yoffs + bheight * 0.35,
self._yoffs + bposy + bheight * 0.35,
),
draw_controller=self._open_now_button,
texture=bui.gettexture('coin'),
@ -443,7 +468,7 @@ class ChestWindow(bui.MainWindow):
),
position=(
self._width * 0.5 + boffsx,
self._height + bposy + self._yoffs + bheight * 0.25,
self._yoffs + bposy + bheight * 0.25,
),
scale=0.65,
color=(0, 1, 0),
@ -458,7 +483,7 @@ class ChestWindow(bui.MainWindow):
parent=self._root_widget,
position=(
self._width * 0.5 + boffsx,
self._height + bposy + self._yoffs + 0.5 * bheight,
self._yoffs + bposy + 0.5 * bheight,
),
visible=False,
)
@ -469,7 +494,7 @@ class ChestWindow(bui.MainWindow):
text=bui.Lstr(resource='chests.reduceWaitText'),
position=(
self._width * 0.5 + hspace * 0.5 + bwidth * 0.5,
self._height + bposy + self._yoffs + bheight * 1.15,
self._yoffs + bposy + bheight * 1.15,
),
maxwidth=bwidth * 0.8,
scale=0.7,
@ -482,7 +507,7 @@ class ChestWindow(bui.MainWindow):
parent=self._root_widget,
position=(
self._width * 0.5 + hspace * 0.5,
self._height + bposy + self._yoffs,
self._yoffs + bposy,
),
size=(bwidth, bheight),
label='',
@ -499,7 +524,7 @@ class ChestWindow(bui.MainWindow):
+ hspace * 0.5
+ bwidth * 0.5
- iconsize * 0.5,
self._height + bposy + self._yoffs + bheight * 0.35,
self._yoffs + bposy + bheight * 0.35,
),
draw_controller=self._watch_ad_button,
color=(1.5, 1.0, 2.0),
@ -512,7 +537,7 @@ class ChestWindow(bui.MainWindow):
text=bui.Lstr(resource='watchAnAdText'),
position=(
self._width * 0.5 + hspace * 0.5 + bwidth * 0.5,
self._height + bposy + self._yoffs + bheight * 0.25,
self._yoffs + bposy + bheight * 0.25,
),
scale=0.65,
color=(0, 1, 0),
@ -561,7 +586,7 @@ class ChestWindow(bui.MainWindow):
rowheight = 25
totalheight = (len(self._prizesets) + 1) * rowheight
x = self._width * 0.5 + xoffs
y = self._height + self._yoffs - 150.0 + totalheight * 0.5
y = self._yoffs - 150.0 + totalheight * 0.5
# Title.
bui.textwidget(
@ -852,11 +877,7 @@ class ChestWindow(bui.MainWindow):
edit=img,
position=(
self._width * 0.5 - imgsize * scale * 0.5 + x,
self._height
- 223
+ self._yoffs
+ imgsize * 0.5
- imgsize * scale * 0.5,
self._yoffs - 223 + imgsize * 0.5 - imgsize * scale * 0.5,
),
size=(imgsize * scale, imgsize * scale),
)
@ -934,7 +955,7 @@ class ChestWindow(bui.MainWindow):
self._root_widget,
pos=(
self._width * 0.5 + xoffs,
self._height - 250.0 + self._yoffs,
self._yoffs - 250.0,
),
width=width,
),
@ -995,11 +1016,7 @@ class ChestWindow(bui.MainWindow):
edit=img,
position=(
self._width * 0.5 - imgsize * scale * 0.5 + x,
self._height
- 223
+ self._yoffs
+ imgsize * 0.5
- imgsize * scale * 0.5,
self._yoffs - 223 + imgsize * 0.5 - imgsize * scale * 0.5,
),
size=(imgsize * scale, imgsize * scale),
)
@ -1047,7 +1064,7 @@ class ChestWindow(bui.MainWindow):
parent=self._root_widget,
position=(
self._width * 0.5 - bwidth * 0.5,
self._height - 350 + self._yoffs,
self._yoffs - 350,
),
size=(bwidth, bheight),
label=bui.Lstr(resource='doneText'),

View File

@ -71,8 +71,8 @@ class WatchWindow(bui.MainWindow):
self.yoffs = 0.5 * self._height + 0.5 * target_height + 30.0
self._scroll_width = target_width
self._scroll_height = target_height - 60
self._scroll_y = self.yoffs - 90 - self._scroll_height
self._scroll_height = target_height - 55
self._scroll_y = self.yoffs - 85 - self._scroll_height
super().__init__(
root_widget=bui.containerwidget(
@ -111,20 +111,23 @@ class WatchWindow(bui.MainWindow):
bui.textwidget(
parent=self._root_widget,
position=(
self._width * 0.5,
self.yoffs - (44 if uiscale is bui.UIScale.SMALL else 10),
(
self._width * 0.5
+ (
(self._scroll_width * -0.5 + 93)
if uiscale is bui.UIScale.SMALL
else 0
)
),
self.yoffs - (63 if uiscale is bui.UIScale.SMALL else 10),
),
size=(0, 0),
color=bui.app.ui_v1.title_color,
scale=0.6 if uiscale is bui.UIScale.SMALL else 1.5,
h_align='center',
scale=1.3 if uiscale is bui.UIScale.SMALL else 1.5,
h_align='left' if uiscale is bui.UIScale.SMALL else 'center',
v_align='center',
text=(
''
if uiscale is bui.UIScale.SMALL
else bui.Lstr(resource=f'{self._r}.titleText')
),
maxwidth=400,
text=bui.Lstr(resource=f'{self._r}.titleText'),
maxwidth=200,
)
tabdefs = [
@ -142,7 +145,7 @@ class WatchWindow(bui.MainWindow):
tabdefs,
pos=(
self._width * 0.5 - self._scroll_width * 0.5 + tab_bar_inset,
self._scroll_y + self._scroll_height,
self._scroll_y + self._scroll_height - 4.0,
),
size=(self._scroll_width - 2.0 * tab_bar_inset, 50),
on_select_call=self._set_tab,

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

View File

@ -646,7 +646,7 @@ void RootWidget::Setup() {
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
b.pre_buffer = 25.0f;
b.pre_buffer = 20.0f;
b.allow_in_game = false;
inbox_button_ = AddButton_(b);
@ -703,7 +703,7 @@ void RootWidget::Setup() {
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
b.pre_buffer = 25.0f;
b.pre_buffer = 20.0f;
b.allow_in_game = false;
achievements_button_ = AddButton_(b);
bottom_left_buttons_.push_back(achievements_button_);
@ -763,7 +763,7 @@ void RootWidget::Setup() {
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuInGame));
b.pre_buffer = 25.0f;
b.pre_buffer = 20.0f;
settings_button_ = AddButton_(b);
bottom_left_buttons_.push_back(settings_button_);
}
@ -922,7 +922,7 @@ void RootWidget::Setup() {
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
b.disable_offset_scale = 1.5f;
b.pre_buffer = 20.0f;
b.pre_buffer = 10.0f;
b.allow_in_game = false;
// This is a very big icon that can interfere with clicking stuff near
@ -946,7 +946,7 @@ void RootWidget::Setup() {
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
b.pre_buffer = 20.0f;
b.pre_buffer = 10.0f;
b.allow_in_game = false;
store_button_ = AddButton_(b);