updated touchscreen settings for MainWindow system

This commit is contained in:
Eric 2024-09-03 17:26:08 -07:00
parent 8a35969fc0
commit 8cd4b2baf2
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
10 changed files with 121 additions and 92 deletions

56
.efrocachemap generated
View File

@ -4096,26 +4096,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "fdb570ca6bdd3b6d99ce8c8d253fb2e3",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "5d4acb829768fdbeabe94131d0483a6a",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "b6627d26b51b581205ce26e493bd190c",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "cbb7d5c3650237e6b442fb2ebda46f1c",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "b8b599bf7db21492c4a45e80978b5949",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "0d90cea395d9aaaabcd158663225a3dd",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "1564bba0949d9e1aa65f1389cd03c96e",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "2613a1072975508a5123ccd847b6a1c9",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "941b27dafbe60f4a4225ecc2998ce4f6",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "5e95b9923453b0f4b78f9e2a7258c3d5",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "810852a17cf44c522740628fa24f71e8",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "13008f16f21abcfb24262ce2842718dc",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "9af0b5d3b404bd6a00e7405ec28d2f86",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "9316ea6bb849e1f2420fa738ebd51be0",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "5c25ed8b51702160adf7f94975333690",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "32cb3de3deccb042d6bc23f9051605db",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "980fabe1caa650ad63e0dfad15aeb681",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8fa7fd27a3f1cbca84c1e22e899ea82f",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "58b9330de90f5e7dd2f448252a1e5c62",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "ad8711189edb9ac148010d4cb976fedf",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "dd3351f875c7f1ebc7475e1878e3b70b",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "54594112bc57bde0a84827f038327c88",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "4105f2bc300954c2b0f1ca02de22cd8a",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "223df1db2bcad539caea58ed6c74e247",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "da8ba45943d195a5bfa7a030fba42eb7",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "fc4ead0d2002ed11253183855e92a560",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "da7ef6205bada0a9fbca9c2fe6d2c9e6",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "6963b73b5b89bd4099493af0e0629e9b",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "cde4c77485a8d9fd72fc8faded5d756f",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "d7eac32efd5f57d914965cdfbfbbf968",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "dc2f9c4b9bde148c373652c3444a4b75",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "99171bfb206814bed28da7358b1462de",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "76885f2221f179a2bbecff0751080bcd",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "e9d613fb41c03077b1f4b93d75688d80",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "33aa23a5329d7d157a70267f52225c75",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "c1e1e2dc90aefc8270fe1dd63b2d4ba3",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "7e8e8ba464ba64c902638f77c3351bba",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "5b507d73207dc1a57b8061ff840f2f78",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "8228a25a276514280da9bfbea119a65f",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "1a3ac3f388b47c55f75c2da9704dd5b8",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "fa659b5d6119acba6570c92ce4d35ae2",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c",
@ -4132,14 +4132,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "3e5c5fd0a09f55ba7b05ce1e2ec7171e",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "1659535e95e3047fda529543e265ac97",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "3e5c5fd0a09f55ba7b05ce1e2ec7171e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "5be7c79fcb8dfefc17234f63094dae1a",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c61e76677707094a5c476d4bf3b35027",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "1cce083c5562eebc8bab6ecf8154223a",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "2d5421108b9066f34c049fce5f0dec2c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "149d53a2414c3731e595f5d93dc966cd",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "c88b477490ed0e3cf5712cbef3efbe66",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "241bef769bc25143b622da29cd2e7b9d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "64483ffc9564a7e3f782c26637b0bd4f",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "18baa99704381be8e41a25076ec17383",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "0e7adfb8137919457c7e696e47c98fc9",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "777ca0e814594195eafea61fa4ecda74",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "b77bdd35d833f6edd4f4346d8adb8ac6",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "6b2510a269eb6c28d853e27c38175994",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "f6841f5b2c28d33a27b0c3edbffbe01e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "b24527db115dbf53f3c5795381e2cd4c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "f7dde79d60634436528e8d2cf6f952e7",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "cb299985623bbcc86015cb103a424ae6",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 21982, api 9, 2024-09-03)
### 1.7.37 (build 21983, api 9, 2024-09-03)
- 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

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

View File

@ -105,7 +105,7 @@ class ControlsSettingsWindow(bui.MainWindow):
height += spacing
assert bui.app.classic is not None
smallscale = 1.7 if show_keyboard else 2.2
smallscale = 1.7
super().__init__(
root_widget=bui.containerwidget(
size=(width, height),

View File

@ -56,12 +56,12 @@ class GamepadSettingsWindow(bui.MainWindow):
root_widget=bui.containerwidget(
size=(self._width, self._height),
scale=(
1.63
1.4
if uiscale is bui.UIScale.SMALL
else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
),
stack_offset=(
(-20, -16) if uiscale is bui.UIScale.SMALL else (0, 0)
(0, -10) if uiscale is bui.UIScale.SMALL else (0, 0)
),
),
transition=transition,

View File

@ -40,7 +40,7 @@ class GamepadAdvancedSettingsWindow(bui.Window):
size=(self._width, self._height),
scale=1.06
* (
1.85
1.6
if uiscale is bui.UIScale.SMALL
else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0
),

View File

@ -13,11 +13,6 @@ class TouchscreenSettingsWindow(bui.MainWindow):
"""Settings window for touchscreens."""
def __del__(self) -> None:
# Note - this happens in 'back' too;
# we just do it here too in case the window is closed by other means.
# FIXME: Could switch to a UI destroy callback now that those are a
# thing that exists.
bs.set_touchscreen_editing(False)
def __init__(
@ -25,9 +20,9 @@ class TouchscreenSettingsWindow(bui.MainWindow):
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
) -> None:
self._width = 650
self._width = 780
self._height = 380
self._spacing = 40
# self._spacing = 40
self._r = 'configTouchscreenWindow'
bs.set_touchscreen_editing(True)
@ -42,25 +37,38 @@ class TouchscreenSettingsWindow(bui.MainWindow):
if uiscale is bui.UIScale.SMALL
else 1.55 if uiscale is bui.UIScale.MEDIUM else 1.2
),
toolbar_visibility=(
'menu_minimal'
if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
stack_offset=(
(0, -20) if uiscale is bui.UIScale.SMALL else (0, 0)
),
),
transition=transition,
origin_widget=origin_widget,
)
btn = bui.buttonwidget(
parent=self._root_widget,
position=(55, self._height - 60),
size=(120, 60),
label=bui.Lstr(resource='backText'),
button_type='back',
scale=0.8,
on_activate_call=self._back,
)
bui.containerwidget(edit=self._root_widget, cancel_button=btn)
if uiscale is bui.UIScale.SMALL:
bui.containerwidget(
edit=self._root_widget, on_cancel_call=self.main_window_back
)
else:
btn = bui.buttonwidget(
parent=self._root_widget,
position=(55, self._height - 60),
size=(60, 60),
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
scale=0.8,
on_activate_call=self.main_window_back,
)
bui.containerwidget(edit=self._root_widget, cancel_button=btn)
bui.textwidget(
parent=self._root_widget,
position=(25, self._height - 50),
position=(25, self._height - 57),
size=(self._width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'),
color=bui.app.ui_v1.title_color,
@ -69,13 +77,6 @@ class TouchscreenSettingsWindow(bui.MainWindow):
v_align='center',
)
bui.buttonwidget(
edit=btn,
button_type='backSmall',
size=(60, 60),
label=bui.charstr(bui.SpecialChar.BACK),
)
self._scroll_width = self._width - 100
self._scroll_height = self._height - 110
self._sub_width = self._scroll_width - 20
@ -113,6 +114,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
)
def _build_gui(self) -> None:
# pylint: disable=too-many-locals
from bauiv1lib.config import ConfigNumberEdit, ConfigCheckBox
from bauiv1lib.radiogroup import make_radio_group
@ -121,13 +123,16 @@ class TouchscreenSettingsWindow(bui.MainWindow):
for child in children:
child.delete()
h = 30
hoffs = 100
hoffs2 = 70
hoffs3 = 320
v = self._sub_height - 85
clr = (0.8, 0.8, 0.8, 1.0)
clr2 = (0.8, 0.8, 0.8)
bui.textwidget(
parent=self._subcontainer,
position=(-10, v + 43),
size=(self._sub_width, 25),
position=(self._sub_width * 0.5, v + 63),
size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.swipeInfoText'),
flatness=1.0,
color=(0, 0.9, 0.1, 0.7),
@ -148,7 +153,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
)
cb1 = bui.checkboxwidget(
parent=self._subcontainer,
position=(h + 220, v),
position=(h + hoffs + 220, v),
size=(170, 30),
text=bui.Lstr(resource=f'{self._r}.joystickText'),
maxwidth=100,
@ -157,7 +162,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
)
cb2 = bui.checkboxwidget(
parent=self._subcontainer,
position=(h + 357, v),
position=(h + hoffs + 357, v),
size=(170, 30),
text=bui.Lstr(resource=f'{self._r}.swipeText'),
maxwidth=100,
@ -172,7 +177,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
ConfigNumberEdit(
parent=self._subcontainer,
position=(h, v),
xoffset=65,
xoffset=hoffs2 + 65,
configkey='Touch Controls Scale Movement',
displayname=bui.Lstr(
resource=f'{self._r}.movementControlScaleText'
@ -195,7 +200,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
)
cb1 = bui.checkboxwidget(
parent=self._subcontainer,
position=(h + 220, v),
position=(h + hoffs + 220, v),
size=(170, 30),
text=bui.Lstr(resource=f'{self._r}.buttonsText'),
maxwidth=100,
@ -204,7 +209,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
)
cb2 = bui.checkboxwidget(
parent=self._subcontainer,
position=(h + 357, v),
position=(h + hoffs + 357, v),
size=(170, 30),
text=bui.Lstr(resource=f'{self._r}.swipeText'),
maxwidth=100,
@ -218,7 +223,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
ConfigNumberEdit(
parent=self._subcontainer,
position=(h, v),
xoffset=65,
xoffset=hoffs2 + 65,
configkey='Touch Controls Scale Actions',
displayname=bui.Lstr(resource=f'{self._r}.actionControlScaleText'),
changesound=False,
@ -228,13 +233,23 @@ class TouchscreenSettingsWindow(bui.MainWindow):
)
v -= 50
bui.textwidget(
parent=self._subcontainer,
position=(h, v - 2),
size=(0, 30),
text=bui.Lstr(resource=f'{self._r}.swipeControlsHiddenText'),
maxwidth=190,
color=clr,
v_align='center',
)
ConfigCheckBox(
parent=self._subcontainer,
position=(h, v),
size=(400, 30),
position=(h + hoffs3, v),
size=(100, 30),
maxwidth=400,
configkey='Touch Controls Swipe Hidden',
displayname=bui.Lstr(resource=f'{self._r}.swipeControlsHiddenText'),
displayname='',
)
v -= 65
@ -288,18 +303,18 @@ class TouchscreenSettingsWindow(bui.MainWindow):
cfg.apply_and_commit()
bui.apptimer(0, self._build_gui)
def _back(self) -> None:
from bauiv1lib.settings import controls
# def _back(self) -> None:
# from bauiv1lib.settings import controls
# no-op if our underlying widget is dead or on its way out.
if not self._root_widget or self._root_widget.transitioning_out:
return
# # no-op if our underlying widget is dead or on its way out.
# if not self._root_widget or self._root_widget.transitioning_out:
# return
bui.containerwidget(edit=self._root_widget, transition='out_right')
assert bui.app.classic is not None
bui.app.ui_v1.set_main_window(
controls.ControlsSettingsWindow(transition='in_left'),
from_window=self,
is_back=True,
)
bs.set_touchscreen_editing(False)
# bui.containerwidget(edit=self._root_widget, transition='out_right')
# assert bui.app.classic is not None
# bui.app.ui_v1.set_main_window(
# controls.ControlsSettingsWindow(transition='in_left'),
# from_window=self,
# is_back=True,
# )
# bs.set_touchscreen_editing(False)

View File

@ -585,6 +585,17 @@ void AppAdapterSDL::RemoveSDLInputDevice_(int index) {
assert(g_core->InMainThread());
assert(index >= 0);
JoystickInput* j = GetSDLJoystickInput_(index);
// Note: am running into this with a PS5 controller on macOS Sequoia beta.
if (!j) {
Log(LogLevel::kError,
"GetSDLJoystickInput_() returned nullptr on RemoveSDLInputDevice_();"
" joysticks size is "
+ std::to_string(sdl_joysticks_.size()) + "; index is "
+ std::to_string(index));
return;
}
assert(j);
if (static_cast_check_fit<int>(sdl_joysticks_.size()) > index) {
sdl_joysticks_[index] = nullptr;

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

View File

@ -967,9 +967,12 @@ void RootWidget::Setup() {
// AddCover(0.5f, VAlign::kBottom, 0.0f, -180.0f, 600.0f, 550.0f,
// 0.35f);
float backingR = 0.44f;
float backingG = 0.41f;
float backingB = 0.56f;
float backingR = 0.4f;
float backingG = 0.38f;
float backingB = 0.53f;
// float backingR = 0.44f;
// float backingG = 0.41f;
// float backingB = 0.56f;
float backingCoverR = backingR;
float backingCoverG = backingG;
float backingCoverB = backingB;
@ -997,8 +1000,8 @@ void RootWidget::Setup() {
ButtonDef bd;
bd.h_align = 0.5f;
bd.v_align = VAlign::kBottom;
bd.width = 550.0f;
bd.height = 110.0f;
bd.width = 500.0f;
bd.height = 100.0f;
bd.x = 0.0f;
bd.y = 41.0f;
bd.img = "uiAtlas2";
@ -1023,7 +1026,7 @@ void RootWidget::Setup() {
ButtonDef b;
b.h_align = 0.5f;
b.v_align = VAlign::kBottom;
b.width = b.height = 120.0f;
b.width = b.height = 110.0f;
b.x = 0.0f;
b.y = b.height * 0.4f;
b.img = "chestIcon";
@ -1032,7 +1035,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));
float spacing = 130.0f;
float spacing = 120.0f;
b.x = -1.5f * spacing;
b.call = UIV1Python::ObjID::kRootUIChestSlot1PressCall;
b.allow_in_game = false;