updated audio window to be screen-size-responsive

This commit is contained in:
Eric Froemling 2025-02-01 14:57:58 -08:00
parent 8e9e7563cc
commit 6b1f96365b
No known key found for this signature in database
6 changed files with 112 additions and 135 deletions

48
.efrocachemap generated
View File

@ -4171,22 +4171,22 @@
"build/assets/windows/Win32/pythonw.exe": "60f972a154dd6af1b4a67a23bcd89a92", "build/assets/windows/Win32/pythonw.exe": "60f972a154dd6af1b4a67a23bcd89a92",
"build/assets/windows/Win32/pythonw_d.exe": "440ba78327698a2706fe7a0eb358dfe8", "build/assets/windows/Win32/pythonw_d.exe": "440ba78327698a2706fe7a0eb358dfe8",
"build/assets/windows/Win32/vc_redist.x86.exe": "91f13ae4b9f4dee9430a9d9b0c8b2afa", "build/assets/windows/Win32/vc_redist.x86.exe": "91f13ae4b9f4dee9430a9d9b0c8b2afa",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "e9b65e2ecc15bb4c6657c0a684eba1d9", "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "a54ebe9e64552f3de963402814e0f4a2",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "a254053e7f58e3da2dbb4d45c2ef310f", "build/prefab/full/linux_arm64_gui/release/ballisticakit": "6354c156e909d07f3434c931a9656579",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "ccc36d009bc0fd7548b31ecb3c591025", "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "6e13137a60758d025cee646cf977f0c1",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "b9a9812927a25bc9f2d58f2aa14dd073", "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "51f102a6b3f2908302963fbc54b0d1aa",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "095a15043434cfa6bca1c2469f395f0b", "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "f0ad9435b57e2dbc166b83ee58b225c8",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "7a5ed0add2617f6a7c1322fffe577f9f", "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "94172d7d9f068f084f47aeb2e28930c7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "02cc384ae2c3b30e7fe52f9eaa28ae2d", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "d446f9c22f66b97e932877947f5a4ef3",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "b70d7556c1a73e79ee07e40c0ff8fa1b", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "f70474f33841dcc10a114d47b21b0b85",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "79ca4ab042690182c69333d93b4e6d4a", "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "63714ddf452cda2be929cf515c8fa9a9",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "8a4deacb894a249cc1bc08cab046c511", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "2f9086ee203152bb51dca29b18756a12",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "90914d56ef9fe32bbbe4e9882a205b7c", "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "64c429638d88729fa152bda696a8b90b",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "f76dbcf7ff4095aeda7e34238f1ef2bc", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "f78fe0dcc03f7c5fd5cbb37c4e1e2c44",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "60c8eea0253d2617b074879326ddf1d9", "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "dea88fc657abfdf5de6ca6598fcf6f21",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "9083b099418c54cb2187bef6891df2e8", "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "7b96bbbf2fcc00701ac530ef62a982e3",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "dea224a60ef7c246a4f0951689f2624d", "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "351e3a2b7b5cc37378b1a422e6d212a7",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "f34e9ec8f91cfca5b3ff4190b2fb54e1", "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "84e4a81bb545b363194311340f9e6139",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "5c7b118a1780cbf24c8b4bf6fd30ddb0", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "5c7b118a1780cbf24c8b4bf6fd30ddb0",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "69a28ff5f0d1fb79a012449c90e3c0d0", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "69a28ff5f0d1fb79a012449c90e3c0d0",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "5c7b118a1780cbf24c8b4bf6fd30ddb0", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "5c7b118a1780cbf24c8b4bf6fd30ddb0",
@ -4199,14 +4199,14 @@
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "593606fabbdd503bab555d49b7963ad1", "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "593606fabbdd503bab555d49b7963ad1",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "07143cfbe795a2cbaa47a09daf1261b3", "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "07143cfbe795a2cbaa47a09daf1261b3",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "593606fabbdd503bab555d49b7963ad1", "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "593606fabbdd503bab555d49b7963ad1",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "f737f347dac174866c6ec2a5f16dc029", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "359152642ae4462b201ccd564f9221d2",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "fa5d0866d5951bfd5965f020fad5deef", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "6a1a556e98dc76b00db6945d774bfeb7",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "a1ccea4ec4184ebb805c8643708c8a1b", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "b8849bfed37a7bb991746f777493d8f9",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "c94ed3fe1006e9d9142d4020e416ebfa", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "af1ba8f3b06dbe662c15b7c9b69c9100",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "a9c4f66ee4f5c95f0d738688a846c48e", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "9c81a5bd112d8851742f2348f83229a5",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "5794e420e44048078ee3e641468d662c", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "23568511c237cb2572ec913d6e12e12d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "34034aa12539cf62b130d7d9e035d5aa", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "0631217906ea9644f6703e3186311548",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "30636d0ebb461f97fe2900a3e3ad45d7", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "9d6b88bbb575f227afdd4354a02d68b7",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad", "src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91", "src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 22262, api 9, 2025-01-31) ### 1.7.37 (build 22265, api 9, 2025-02-01)
- Bumping api version to 9. As you'll see below, there's some UI changes that - 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 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. 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 # Build number and version of the ballistica binary we expect to be
# using. # using.
TARGET_BALLISTICA_BUILD = 22262 TARGET_BALLISTICA_BUILD = 22265
TARGET_BALLISTICA_VERSION = '1.7.37' TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -395,7 +395,15 @@ class GetTokensWindow(bui.MainWindow):
v_align='center', v_align='center',
color=(0.6, 0.6, 0.6), color=(0.6, 0.6, 0.6),
scale=0.75, scale=0.75,
text=bui.Lstr(resource='store.loadingText'), text='',
)
# Create a spinner - it will get cleared when state changes from
# LOADING.
bui.spinnerwidget(
parent=self._root_widget,
size=60,
position=(self._width * 0.5, self._height * 0.5),
style='bomb',
) )
self._core_widgets = [ self._core_widgets = [
@ -543,8 +551,14 @@ class GetTokensWindow(bui.MainWindow):
b for b in self._buttondefs if b.itemid in available_purchases b for b in self._buttondefs if b.itemid in available_purchases
] ]
# We currently don't handle the zero-button case. # Fail if something errored server-side or they didn't send us
assert buttondefs_shown # anything we can show.
if (
response.result is not response.Result.SUCCESS
or not buttondefs_shown
):
self._on_load_error()
return
sidepad = 10.0 sidepad = 10.0
xfudge = 6.0 xfudge = 6.0

View File

@ -21,10 +21,8 @@ class AudioSettingsWindow(bui.MainWindow):
transition: str | None = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bauiv1lib.popup import PopupMenu
from bauiv1lib.config import ConfigNumberEdit from bauiv1lib.config import ConfigNumberEdit
assert bui.app.classic is not None assert bui.app.classic is not None
@ -33,60 +31,76 @@ class AudioSettingsWindow(bui.MainWindow):
self._r = 'audioSettingsWindow' self._r = 'audioSettingsWindow'
spacing = 50.0 spacing = 50.0
width = 460.0
height = 240.0
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
yoffs = -5.0 width = 1200.0 if uiscale is bui.UIScale.SMALL else 500.0
height = 800.0 if uiscale is bui.UIScale.SMALL else 350.0
# Update: hard-coding head-relative audio to true now,
# so not showing options.
# show_vr_head_relative_audio = True if bui.app.vr_mode else False
show_vr_head_relative_audio = False
if show_vr_head_relative_audio:
height += 70
show_soundtracks = False show_soundtracks = False
if music.have_music_player(): if music.have_music_player():
show_soundtracks = True show_soundtracks = True
height += spacing * 2.0
base_scale = ( # Do some fancy math to fill all available screen area up to the
1.9 # 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 = (
2.2
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0
) )
popup_menu_scale = base_scale * 1.2 # Calc screen size in our local container space and clamp to a
# bit smaller than our container size.
# target_width = min(width - 60, screensize[0] / scale)
target_height = min(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.
yoffs = 0.5 * height + 0.5 * target_height + 30.0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(width, height), size=(width, height),
scale=base_scale, scale=scale,
toolbar_visibility=( toolbar_visibility=(
None if uiscale is bui.UIScale.SMALL else 'menu_full' 'menu_minimal'
if uiscale is bui.UIScale.SMALL
else 'menu_full'
), ),
), ),
transition=transition, transition=transition,
origin_widget=origin_widget, 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 = back_button = btn = bui.buttonwidget( if uiscale is bui.UIScale.SMALL:
parent=self._root_widget, bui.containerwidget(
position=(35, height + yoffs - 55), edit=self._root_widget, on_cancel_call=self.main_window_back
size=(60, 60), )
scale=0.8, self._back_button = None
text_scale=1.2, else:
label=bui.charstr(bui.SpecialChar.BACK), self._back_button = bui.buttonwidget(
button_type='backSmall', parent=self._root_widget,
on_activate_call=self.main_window_back, position=(35, yoffs - 55),
autoselect=True, size=(60, 60),
) scale=0.8,
bui.containerwidget(edit=self._root_widget, cancel_button=btn) text_scale=1.2,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
on_activate_call=self.main_window_back,
autoselect=True,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._back_button
)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, height + yoffs - 32), position=(
width * 0.5,
yoffs - (48 if uiscale is bui.UIScale.SMALL else 32),
),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -95,12 +109,14 @@ class AudioSettingsWindow(bui.MainWindow):
v_align='center', v_align='center',
) )
v = height + yoffs - 60 # Roughly center everything else in our window.
v -= spacing * 1.0 x = width * 0.5 - 160
y = height * 0.5 + (100 if show_soundtracks else 70)
y -= spacing * 1.0
self._sound_volume_numedit = svne = ConfigNumberEdit( self._sound_volume_numedit = svne = ConfigNumberEdit(
parent=self._root_widget, parent=self._root_widget,
position=(40, v), position=(x, y),
xoffset=10, xoffset=10,
configkey='Sound Volume', configkey='Sound Volume',
displayname=bui.Lstr(resource=f'{self._r}.soundVolumeText'), displayname=bui.Lstr(resource=f'{self._r}.soundVolumeText'),
@ -113,10 +129,10 @@ class AudioSettingsWindow(bui.MainWindow):
edit=svne.plusbutton, edit=svne.plusbutton,
right_widget=bui.get_special_widget('squad_button'), right_widget=bui.get_special_widget('squad_button'),
) )
v -= spacing y -= spacing
self._music_volume_numedit = ConfigNumberEdit( self._music_volume_numedit = ConfigNumberEdit(
parent=self._root_widget, parent=self._root_widget,
position=(40, v), position=(x, y),
xoffset=10, xoffset=10,
configkey='Music Volume', configkey='Music Volume',
displayname=bui.Lstr(resource=f'{self._r}.musicVolumeText'), displayname=bui.Lstr(resource=f'{self._r}.musicVolumeText'),
@ -128,87 +144,43 @@ class AudioSettingsWindow(bui.MainWindow):
as_percent=True, as_percent=True,
) )
v -= 0.5 * spacing y -= 0.5 * spacing
self._vr_head_relative_audio_button: bui.Widget | None
if show_vr_head_relative_audio:
v -= 40
bui.textwidget(
parent=self._root_widget,
position=(40, v + 24),
size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.headRelativeVRAudioText'),
color=(0.8, 0.8, 0.8),
maxwidth=230,
h_align='left',
v_align='center',
)
popup = PopupMenu(
parent=self._root_widget,
position=(290, v),
width=120,
button_size=(135, 50),
scale=popup_menu_scale,
choices=['Auto', 'On', 'Off'],
choices_display=[
bui.Lstr(resource='autoText'),
bui.Lstr(resource='onText'),
bui.Lstr(resource='offText'),
],
current_choice=bui.app.config.resolve('VR Head Relative Audio'),
on_value_change_call=self._set_vr_head_relative_audio,
)
self._vr_head_relative_audio_button = popup.get_button()
bui.textwidget(
parent=self._root_widget,
position=(width * 0.5, v - 11),
size=(0, 0),
text=bui.Lstr(
resource=f'{self._r}.headRelativeVRAudioInfoText'
),
scale=0.5,
color=(0.7, 0.8, 0.7),
maxwidth=400,
flatness=1.0,
h_align='center',
v_align='center',
)
v -= 30
else:
self._vr_head_relative_audio_button = None
self._soundtrack_button: bui.Widget | None self._soundtrack_button: bui.Widget | None
if show_soundtracks: if show_soundtracks:
v -= 1.2 * spacing y -= 1.2 * spacing
self._soundtrack_button = bui.buttonwidget( self._soundtrack_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=((width - 310) / 2, v), position=(width * 0.5 - 155, y),
size=(310, 50), size=(310, 50),
autoselect=True, autoselect=True,
label=bui.Lstr(resource=f'{self._r}.soundtrackButtonText'), label=bui.Lstr(resource=f'{self._r}.soundtrackButtonText'),
on_activate_call=self._do_soundtracks, on_activate_call=self._do_soundtracks,
) )
v -= spacing * 0.5 y -= spacing * 0.3
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, v), position=(0.5 * width, y),
size=(width, 20), size=(0.0, 0.0),
text=bui.Lstr(resource=f'{self._r}.soundtrackDescriptionText'), text=bui.Lstr(resource=f'{self._r}.soundtrackDescriptionText'),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center',
maxwidth=400,
scale=0.5, scale=0.5,
color=(0.7, 0.8, 0.7, 1.0), color=(0.7, 0.8, 0.7, 1.0),
maxwidth=400,
) )
else: else:
self._soundtrack_button = None self._soundtrack_button = None
# Tweak a few navigation bits. # Tweak a few navigation bits.
try: if self._back_button is not None:
bui.widget(edit=back_button, down_widget=svne.minusbutton) bui.widget(edit=self._back_button, down_widget=svne.minusbutton)
except Exception: else:
logging.exception('Error wiring AudioSettingsWindow.') spback = bui.get_special_widget('back_button')
bui.widget(
edit=svne.minusbutton, up_widget=spback, left_widget=spback
)
self._restore_state() self._restore_state()
@ -226,11 +198,6 @@ class AudioSettingsWindow(bui.MainWindow):
def on_main_window_close(self) -> None: def on_main_window_close(self) -> None:
self._save_state() self._save_state()
def _set_vr_head_relative_audio(self, val: str) -> None:
cfg = bui.app.config
cfg['VR Head Relative Audio'] = val
cfg.apply_and_commit()
def _do_soundtracks(self) -> None: def _do_soundtracks(self) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bauiv1lib.soundtrack.browser import SoundtrackBrowserWindow from bauiv1lib.soundtrack.browser import SoundtrackBrowserWindow
@ -271,8 +238,6 @@ class AudioSettingsWindow(bui.MainWindow):
sel_name = 'Soundtrack' sel_name = 'Soundtrack'
elif sel == self._back_button: elif sel == self._back_button:
sel_name = 'Back' sel_name = 'Back'
elif sel == self._vr_head_relative_audio_button:
sel_name = 'VRHeadRelative'
else: else:
raise ValueError(f'unrecognized selection \'{sel}\'') raise ValueError(f'unrecognized selection \'{sel}\'')
assert bui.app.classic is not None assert bui.app.classic is not None
@ -293,8 +258,6 @@ class AudioSettingsWindow(bui.MainWindow):
sel = self._music_volume_numedit.minusbutton sel = self._music_volume_numedit.minusbutton
elif sel_name == 'MusicPlus': elif sel_name == 'MusicPlus':
sel = self._music_volume_numedit.plusbutton sel = self._music_volume_numedit.plusbutton
elif sel_name == 'VRHeadRelative':
sel = self._vr_head_relative_audio_button
elif sel_name == 'Soundtrack': elif sel_name == 'Soundtrack':
sel = self._soundtrack_button sel = self._soundtrack_button
elif sel_name == 'Back': elif sel_name == 'Back':

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 22262; const int kEngineBuildNumber = 22265;
const char* kEngineVersion = "1.7.37"; const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9; const int kEngineApiVersion = 9;