fixed onscreen fps/ping to avoid toolbars

This commit is contained in:
Eric Froemling 2024-12-17 03:26:29 -08:00
parent f76492a5bc
commit 15af0ae29d
No known key found for this signature in database
14 changed files with 94 additions and 54 deletions

82
.efrocachemap generated
View File

@ -421,10 +421,10 @@
"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": "7db4a04756081874702adcd3b295d9e8",
"build/assets/ba_data/data/langdata.json": "7cdc9f897e458e98cd0131a13b87db24",
"build/assets/ba_data/data/languages/arabic.json": "8f89f09ad168c251765efebde4c9069c",
"build/assets/ba_data/data/languages/belarussian.json": "0b60a9d4496d1213c2d0b647d346ce30",
"build/assets/ba_data/data/languages/chinese.json": "3a8ad6b99e13152872962019b3eef49d",
"build/assets/ba_data/data/languages/chinese.json": "fc45d2838b834889c06920ae7c2102fa",
"build/assets/ba_data/data/languages/chinesetraditional.json": "904b35b656c53f9830e406565edd5120",
"build/assets/ba_data/data/languages/croatian.json": "1e541070309ff6be95b0c39940aa7e99",
"build/assets/ba_data/data/languages/czech.json": "d18b7d1c6bf51fc81af4084ef0e69e3e",
@ -432,17 +432,17 @@
"build/assets/ba_data/data/languages/dutch.json": "f4e1e8e9231cda9d1bcc7e87a7f8821e",
"build/assets/ba_data/data/languages/english.json": "b5917c3b975155e35fedb655dbd7568c",
"build/assets/ba_data/data/languages/esperanto.json": "0e397cfa5f3fb8cef5f4a64f21cda880",
"build/assets/ba_data/data/languages/filipino.json": "08b626ee9d8b66c55e79a4829c6cb9f2",
"build/assets/ba_data/data/languages/filipino.json": "3d9269a90a2fee164d0a7513c4f130a3",
"build/assets/ba_data/data/languages/french.json": "6d20655730b1017ef187fd828b91d43c",
"build/assets/ba_data/data/languages/german.json": "a150dbb5c0f43984757f7db295d96203",
"build/assets/ba_data/data/languages/gibberish.json": "df76e851aee59657b69e34efd54fee06",
"build/assets/ba_data/data/languages/greek.json": "d28d1092fbb00ed857cbd53124c0dc78",
"build/assets/ba_data/data/languages/hindi.json": "567e6976b3c72f891431ad7fcc62ab16",
"build/assets/ba_data/data/languages/hungarian.json": "9d88004a98f0fbe2ea72edd5e0b3002e",
"build/assets/ba_data/data/languages/indonesian.json": "2ccb3fe081ead7706dbebb1008a8bc4e",
"build/assets/ba_data/data/languages/indonesian.json": "607ba358179185f032096ea1978e4448",
"build/assets/ba_data/data/languages/italian.json": "eabad2faba952c426876bc07e1490d09",
"build/assets/ba_data/data/languages/korean.json": "4e3524327a0174250aff5e1ef4c0c597",
"build/assets/ba_data/data/languages/malay.json": "f6ce0426d03a62612e3e436ed5d1be1f",
"build/assets/ba_data/data/languages/malay.json": "0212e18e54efa202c17505376e5b82fb",
"build/assets/ba_data/data/languages/persian.json": "2584895475fe62b3fe49a5ea5e69b4b1",
"build/assets/ba_data/data/languages/piratespeak.json": "7c7e3b72b87c1bcd5b04c9f64d912f0c",
"build/assets/ba_data/data/languages/polish.json": "d0822d5d3bdd72ddb04dc3c43a0b1395",
@ -4103,42 +4103,42 @@
"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": "5679c57e9f062babe3bc30c59b4e259b",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "85eb224abd29ef769b0429f754aa1f00",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "cfb118fcf2ab26cc9b8573855d926198",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "ea8290e9b8c46614a06f92e67dadb5be",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "cbca4ef71340187341cc5e135273581a",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "73723e1b19b6e84985462605a96654f7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "b73b9f3a463ac06902dda8f70f11547d",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "ebd13391d2b0e78785f06b4cd5ec6465",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "9d3a95968e99a40265442ce1d0379b45",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "3e6f96efc2215f601dfd3ca4b9ab43fd",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "d85e3c636175516a096dae345932f4b6",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "62470f179f21fb79570bf488b3e7bcef",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "13510081ac3cf151eb8a1c19e5990ecc",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "1f381529e4cdd7f85950394fe3e23281",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "e466c3e95a8fa8fa32bd133abfd250f5",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "3985eedd8ca02a571e94a2100f39dfab",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "7be89afaa8f76db9125b9068825b9fc2",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "08fc092ff14906eca9e31d82ba74c42e",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "7be89afaa8f76db9125b9068825b9fc2",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "08fc092ff14906eca9e31d82ba74c42e",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "a7a74cef67f1af0ca19ca736682c8246",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "0c1fe05db5bb51a29ba4eb62fce3374b",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "a7a74cef67f1af0ca19ca736682c8246",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "0c1fe05db5bb51a29ba4eb62fce3374b",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "09b549be9f1f9bffb9e3ec0f2f250da8",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "74d89bb313924dda7ce6c48cd018a6ae",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "09b549be9f1f9bffb9e3ec0f2f250da8",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "74d89bb313924dda7ce6c48cd018a6ae",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "5c68c1f8555eb0461aad279612635a6a",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "ed35ed0efd56563dd1b693214a8825d5",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "5a8ced4d3466a11a15378239a06beeac",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "7143878970007805d6860340c46a7b36",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "f9a1366833d16972e1b4c0a3d0515db5",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "fef9c14fe464034fb743bfca3829a0ad",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "5cf97355e3ea2a28cdcf4e2843c55374",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "dd3e1a4d47d14a1d2136b87da4742520",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "3dd66dfcf706962c87c5316e04ec3f31",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "490a8c49e02a4191c30e6ed60d6f4d9f",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "4bf9630c25094e26b55f21728df761aa",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "932ab6ca24fa629f37a6ac0d017eb5af",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "cf4fc2e014a1a704ee512444fe9d364a",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1a37cd3bebb37683e24e72b9b702e686",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "e3d75d506d866cf41b43608a367683a4",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "8fb682964be158cd645331516ed61440",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "a3317c2c62a6de8f35043afa292cdd04",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "97b41a461f9f71e8e093dd71d1c13ad5",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "a6ec7deb4beacc26ac7399994451605f",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "aa576dc1f944f7300958f95e5cc86984",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "5ae7d93eeb81f265087986579ffa9f11",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "ef8b5ca5e0877b9c0367913b18cba08c",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "e9c42b8a249557bb3b0cee18fbe254c6",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "48677d1e015369fe564f339785d167d7",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "8e0d4fe40c9d3f78dc353b855c36033d",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "7a523edeaea9e8e222e3d9daafd53d3a",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "8e0d4fe40c9d3f78dc353b855c36033d",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "7a523edeaea9e8e222e3d9daafd53d3a",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "3cdfe757d64213164f3cc1fb3d660f54",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "15740f71e03465f7341f6ecd83165f07",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "3cdfe757d64213164f3cc1fb3d660f54",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "15740f71e03465f7341f6ecd83165f07",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "3516e46d80d01cab8b93d3c50a5947bc",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "b57964942b8ca52efdf51582adc26aee",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "3516e46d80d01cab8b93d3c50a5947bc",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "b57964942b8ca52efdf51582adc26aee",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "92f4e8a1a7a02d67371021e4322fe64e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "bb65d468a59720259979daa18faed3c4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "6b7b8ca64ed2e9b0a93a9e3999192ff3",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "d662741332c1face1dd2635959a140dc",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "5c24a04029507fd79add85739e1be722",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "1bb1d8f2be67329d66557a55946a99a2",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "e7de0956d9215dde33ea9f0e487bd092",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "2475fa5570783ac4ab8c8c2360bc11e4",
"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 22134, api 9, 2024-12-14)
### 1.7.37 (build 22136, api 9, 2024-12-17)
- 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 = 22134
TARGET_BALLISTICA_BUILD = 22136
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -71,4 +71,6 @@ auto AppMode::LastClientJoinTime() const -> millisecs_t { return -1; }
auto AppMode::IsInMainMenu() const -> bool { return false; }
auto AppMode::GetBottomLeftEdgeHeight() -> float { return 0.0f; }
} // namespace ballistica::base

View File

@ -104,6 +104,11 @@ class AppMode {
/// Get a string for current ping display.
virtual auto GetDisplayPing() -> std::optional<float>;
/// Return the offset used when drawing elements such as fps counters at
/// the bottom left of the screen. Should be used to avoid overlap with
/// icons or toolbars placed there by the app-mode.
virtual auto GetBottomLeftEdgeHeight() -> float;
};
} // namespace ballistica::base

View File

@ -288,7 +288,6 @@ void BaseFeatureSet::SuspendApp() {
// push runnables to them from here they may or may not be called before
// their event-loop is actually paused.
// Pause all event loops.
EventLoop::SetEventLoopsSuspended(true);
if (g_base->network_reader) {

View File

@ -111,8 +111,8 @@ void Graphics::OnAppShutdownComplete() { assert(g_base->InLogicThread()); }
void Graphics::DoApplyAppConfig() {
assert(g_base->InLogicThread());
// Any time we load the config we ship a new graphics-settings to
// the graphics server since something likely changed.
// Any time we load the config we ship a new graphics-settings to the
// graphics server since something likely changed.
graphics_settings_dirty_ = true;
show_fps_ = g_base->app_config->Resolve(AppConfig::BoolID::kShowFPS);
@ -373,6 +373,10 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) {
last_total_frames_rendered_ = total_frames_rendered;
}
float bot_left_offset{};
if (show_fps_ || show_ping_) {
bot_left_offset = g_base->app_mode()->GetBottomLeftEdgeHeight();
}
if (show_fps_) {
char fps_str[32];
snprintf(fps_str, sizeof(fps_str), "%d", last_fps_);
@ -401,7 +405,7 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) {
c.SetFlatness(1.0f);
{
auto xf = c.ScopedTransform();
c.Translate(6.0f, 6.0f, kScreenTextZDepth);
c.Translate(6.0f, bot_left_offset + 6.0f, kScreenTextZDepth);
c.DrawMesh(fps_text_group_->GetElementMesh(e));
}
}
@ -436,8 +440,9 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) {
c.SetFlatness(1.0f);
{
auto xf = c.ScopedTransform();
c.Translate(6.0f + 14.0f + (show_fps_ ? 35.0f : 0.0f), 6.0f + 1.0f,
kScreenTextZDepth);
c.Translate(
6.0f, bot_left_offset + 6.0f + 1.0f + (show_fps_ ? 30.0f : 0.0f),
kScreenTextZDepth);
c.Scale(0.7f, 0.7f);
c.DrawMesh(ping_text_group_->GetElementMesh(e));
}

View File

@ -14,10 +14,11 @@
namespace ballistica::base {
/// EFRO NOTE: I think everything here should be migrated to app_adapter,
/// which can then be renamed to app_platform. Having both
/// base_platform and app_adapter feels redundant. If there is
/// functionality shared by multiple app_platforms, it can be
/// implemented as a common base class.
/// which perhaps could be renamed to something like
/// app_platform. Having both base_platform and app_adapter feels
/// redundant. If there is functionality shared by multiple
/// app_platforms, it can be implemented as a common base class
/// or via composition.
/// Most general platform-specific functionality is contained here, to be
/// implemented by platform-specific subclasses. Exceptions to this rule are

View File

@ -1676,4 +1676,14 @@ void ClassicAppMode::SetRootUIInboxCountText(const std::string text) {
}
}
auto ClassicAppMode::GetBottomLeftEdgeHeight() -> float {
assert(g_base->InLogicThread());
if (uiv1_) {
if (auto* root_widget = uiv1_->root_widget()) {
return root_widget->bottom_left_height();
}
}
return 0.0f;
}
} // namespace ballistica::classic

View File

@ -105,6 +105,8 @@ class ClassicAppMode : public base::AppMode {
void OnScreenSizeChange() override;
auto kick_idle_players() const -> bool { return kick_idle_players_; }
void LanguageChanged() override;
auto GetBottomLeftEdgeHeight() -> float override;
void SetDebugSpeedExponent(int val);
void SetReplaySpeedExponent(int val);
void PauseReplay();

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

View File

@ -1091,17 +1091,22 @@ void RootWidget::StepChildWidgets_(float dt) {
}
}
xpos = 0.0f;
float bottom_left_height{};
for (auto* btn : bottom_left_buttons_) {
auto enabled = btn->enabled;
float bwidthhalf = btn->width * 0.5;
if (enabled) {
xpos += bwidthhalf + btn->pre_buffer;
bottom_left_height =
std::max(bottom_left_height, btn->y + btn->height * 0.5f);
}
btn->x = xpos;
if (enabled) {
xpos += bwidthhalf + btn->post_buffer;
}
}
bottom_left_height_ = bottom_left_height * base_scale_;
xpos = 0.0f;
for (auto* btn : bottom_right_buttons_) {
auto enabled = btn->enabled;

View File

@ -48,6 +48,8 @@ class RootWidget : public ContainerWidget {
void SetXPText(const std::string& val);
void SetInboxCountText(const std::string& val);
auto bottom_left_height() const { return bottom_left_height_; }
private:
struct ButtonDef;
struct Button;
@ -68,6 +70,7 @@ class RootWidget : public ContainerWidget {
StackWidget* screen_stack_widget_{};
StackWidget* overlay_stack_widget_{};
float base_scale_{1.0f};
float bottom_left_height_{};
millisecs_t update_time_{};
std::list<Button> buttons_;
std::list<Text> texts_;

View File

@ -149,6 +149,14 @@ def is_urllib3_communication_error(exc: BaseException, url: str | None) -> bool:
# real error.
import urllib3.exceptions
# If this error is from hitting max-retries, look at the underlying
# error instead.
if isinstance(exc, urllib3.exceptions.MaxRetryError):
# Hmm; will a max-retry error ever not have an underlying error?
if exc.reason is None:
return False
exc = exc.reason
if isinstance(exc, _Urllib3HttpError):
# Special sub-case: appspot.com hosting seems to give 403 errors
# (forbidden) to some countries. I'm assuming for legal reasons?..