more untangling

This commit is contained in:
Eric 2023-06-01 22:27:10 -07:00
parent 6ada31d16f
commit 91a0653400
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
12 changed files with 99 additions and 54 deletions

View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/9b/4f/4e0cda3e603e21acfb43d287b669",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/0e/4b/a4b6e7b071c1cd3a3779d0b6e4fb",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/19/13/76819a86e4bff66c3a44d12923f7",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/70/8f/798f9addd16ec93ba2c11a47181f",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/72/a7/45f9b730780dde9caf3ccae41747",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fb/b9/2bc33e282e8269b63b0924e55d3d",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/11/5b/422794fc9435be92944d387c36ed",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3d/f4/8a05ae4ba677c014a871823f91f9",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/9d/00/2c6819e79bd63ce48e4f793536ec",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/68/c1/dbb603418a5e395647c6853216a6",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/97/c1/1b0f8ec389c0529099935d3b4a20",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c1/00/9cee11c75b5c241457abc1c47164",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/7a/11/0818fd8a38fa15d43b8423aca130",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ae/98/2db72c172834f376b6ac6d64a89a",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/83/c81288bded2f4fa4610780d1f56c",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/23/dc/c11c6c4a0af25f5290b68932d8e7",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/6f/7b/0d824afadfad442dcd44ab672b46",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/1d/12/9f6b41c5221f62b34f8124b6cd3d",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ec/76/4cd926a68302779c4c1cf2859bb3",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/93/26/8ad5b9ebe9715e4c3eddc4412f42",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/9f/12/dae21a272aa0490de4567396de08",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/32/47/00ce97ea67f3639ee7a771c6364f",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/5c/75/16320db2a3bc92aabc01774ba4a1",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d9/d6/0c254158599c0ba16c04520fb166",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a1/7b/c9f2464256b5a1f5b46434dc944f",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/2b/ed/20a3b2e758b13110f4598552a467",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/42/ed/4dc2182180b24456edfff90697bc",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/77/8d/f44567ba8706d7a94fe7a10df3eb",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d8/1f/8bf54c800a593b2a9db9073ed725",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/2d/0c/f89b8327489807b1b82e60d4bfe3",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b1/ea/71c07dd8b8e1ee4c85c382b6d0c0",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e4/ca/dfbdf1d55e747f1d4f6a20aef6f0",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/fb/08/305603820ba3f4f1340e8f6657eb",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/5e/19/f4e1ea7efb3aff04066390ade2c7",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/51/4d/d89c3f77f367cc868f83c54cb998",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4b/0d/1e39c12729c254a30cb7edf355fa",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/1a/de/2fbebe44216e2157b1567e6201ad",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/fc/54/235af99d68d4ea786fa321881f83",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/de/8c/310f113d163d61314e46dfe30823",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ff/2a/168303f44d5a9f95c35c4dd6403b",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d4/6a/dd303a200b98a56ba3b100277057",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/fc/2c/2996c558fb408a548fdd37398c9a",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ed/28/b7a72be7ae1bd2b58dda4b6902a0",

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21036, api 8, 2023-06-01)
### 1.7.20 (build 21037, api 8, 2023-06-01)
- This seems like a good time for a `refactoring` release in anticipation of
changes coming in 1.8. Basically this means that a lot of things will be

View File

@ -30,7 +30,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21036
TARGET_BALLISTICA_BUILD = 21037
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None

View File

@ -14,7 +14,6 @@
#include "ballistica/shared/foundation/event_loop.h"
#include "ballistica/shared/python/python.h"
#include "ballistica/shared/python/python_command.h"
#include "ballistica/ui_v1/widget/container_widget.h"
namespace ballistica::base {
@ -1014,11 +1013,7 @@ void JoystickInput::HandleSDLEvent(const SDL_Event* e) {
// If there's a UI up (even if we didn't get it) lets not pass events along.
// The only exception is if we're doing a reset.
ui_v1::Widget* root{};
if (g_base) {
root = g_base->ui->screen_root_widget();
}
if (root && root->HasChildren() && !resetting_) {
if (g_base->ui->MainMenuVisible() && !resetting_) {
return;
}

View File

@ -16,7 +16,6 @@
#include "ballistica/base/ui/ui.h"
#include "ballistica/shared/foundation/event_loop.h"
#include "ballistica/shared/generic/utils.h"
#include "ballistica/ui_v1/support/root_ui.h"
#include "ballistica/ui_v1/widget/root_widget.h"
namespace ballistica::base {
@ -986,7 +985,9 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
break;
case SDLK_F5: {
g_base->ui->root_ui()->TogglePartyWindowKeyPress();
if (g_base->ui->PartyIconVisible()) {
g_base->ui->ActivatePartyIcon();
}
handled = true;
break;
}
@ -1217,7 +1218,7 @@ void Input::HandleMouseMotion(const Vector2f& position) {
last_mouse_move_time_ = g_core->GetAppTimeMillisecs();
mouse_move_count_++;
bool handled2{};
bool handled{};
// If we have a touch-input in editing mode, pass along events to it.
// (it usually handles its own events but here we want it to play nice
@ -1230,13 +1231,13 @@ void Input::HandleMouseMotion(const Vector2f& position) {
// UI interaction.
ui_v1::Widget* root_widget = g_base->ui->root_widget();
if (root_widget && !IsInputLocked())
handled2 = root_widget->HandleMessage(
handled = root_widget->HandleMessage(
WidgetMessage(WidgetMessage::Type::kMouseMove, nullptr, cursor_pos_x_,
cursor_pos_y_));
// Manual camera motion.
Camera* camera = g_base->graphics->camera();
if (!handled2 && camera && camera->manual()) {
if (!handled && camera && camera->manual()) {
float move_h = (cursor_pos_x_ - old_cursor_pos_x)
/ g_base->graphics->screen_virtual_width();
float move_v = (cursor_pos_y_ - old_cursor_pos_y)
@ -1244,7 +1245,8 @@ void Input::HandleMouseMotion(const Vector2f& position) {
camera->ManualHandleMouseMove(move_h, move_v);
}
g_base->ui->root_ui()->HandleMouseMotion(cursor_pos_x_, cursor_pos_y_);
// Old screen edge UI.
g_base->ui->HandleLegacyRootUIMouseMotion(cursor_pos_x_, cursor_pos_y_);
}
void Input::PushMouseDownEvent(int button, const Vector2f& position) {
@ -1269,8 +1271,6 @@ void Input::HandleMouseDown(int button, const Vector2f& position) {
last_mouse_move_time_ = g_core->GetAppTimeMillisecs();
mouse_move_count_++;
// printf("Mouse down at %f %f\n", position.x, position.y);
// Convert normalized view coords to our virtual ones.
cursor_pos_x_ = g_base->graphics->PixelToVirtualX(
position.x * g_base->graphics->screen_pixel_width());
@ -1281,33 +1281,32 @@ void Input::HandleMouseDown(int button, const Vector2f& position) {
bool double_click = (click_time - last_click_time_ <= double_click_time_);
last_click_time_ = click_time;
bool handled2 = false;
ui_v1::Widget* root_widget = g_base->ui->root_widget();
bool handled{};
auto* root_widget = g_base->ui->root_widget();
// If we have a touch-input in editing mode, pass along events to it.
// (it usually handles its own events but here we want it to play nice
// with stuff under it by blocking touches, etc)
if (touch_input_ && touch_input_->editing()) {
handled2 = touch_input_->HandleTouchDown(reinterpret_cast<void*>(1),
cursor_pos_x_, cursor_pos_y_);
handled = touch_input_->HandleTouchDown(reinterpret_cast<void*>(1),
cursor_pos_x_, cursor_pos_y_);
}
if (!handled2) {
if (g_base->ui->root_ui()->HandleMouseButtonDown(cursor_pos_x_,
cursor_pos_y_)) {
handled2 = true;
if (!handled) {
if (g_base->ui->HandleLegacyRootUIMouseDown(cursor_pos_x_, cursor_pos_y_)) {
handled = true;
}
}
if (root_widget && !handled2) {
handled2 = root_widget->HandleMessage(
if (root_widget && !handled) {
handled = root_widget->HandleMessage(
WidgetMessage(WidgetMessage::Type::kMouseDown, nullptr, cursor_pos_x_,
cursor_pos_y_, double_click ? 2 : 1));
}
// Manual camera input.
Camera* camera = g_base->graphics->camera();
if (!handled2 && camera) {
if (!handled && camera) {
switch (button) {
case SDL_BUTTON_LEFT:
camera->set_mouse_left_down(true);
@ -1340,7 +1339,7 @@ void Input::HandleMouseUp(int button, const Vector2f& position) {
cursor_pos_y_ = g_base->graphics->PixelToVirtualY(
position.y * g_base->graphics->screen_pixel_height());
bool handled2{};
bool handled{};
// If we have a touch-input in editing mode, pass along events to it.
// (it usually handles its own events but here we want it to play nice
@ -1351,11 +1350,13 @@ void Input::HandleMouseUp(int button, const Vector2f& position) {
}
ui_v1::Widget* root_widget = g_base->ui->root_widget();
if (root_widget)
handled2 = root_widget->HandleMessage(WidgetMessage(
if (root_widget) {
handled = root_widget->HandleMessage(WidgetMessage(
WidgetMessage::Type::kMouseUp, nullptr, cursor_pos_x_, cursor_pos_y_));
}
Camera* camera = g_base->graphics->camera();
if (!handled2 && camera) {
if (!handled && camera) {
switch (button) {
case SDL_BUTTON_LEFT:
camera->set_mouse_left_down(false);
@ -1371,7 +1372,8 @@ void Input::HandleMouseUp(int button, const Vector2f& position) {
}
camera->UpdateManualMode();
}
g_base->ui->root_ui()->HandleMouseButtonUp(cursor_pos_x_, cursor_pos_y_);
g_base->ui->HandleLegacyRootUIMouseUp(cursor_pos_x_, cursor_pos_y_);
}
void Input::PushTouchEvent(const TouchEvent& e) {

View File

@ -3,13 +3,13 @@
#include "ballistica/base/logic/logic.h"
#include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h"
#include "ballistica/base/audio/audio.h"
#include "ballistica/base/input/input.h"
#include "ballistica/base/python/base_python.h"
#include "ballistica/base/support/plus_soft.h"
#include "ballistica/base/ui/console.h"
#include "ballistica/base/ui/ui.h"
#include "ballistica/scene_v1/support/scene_v1_app_mode.h"
#include "ballistica/shared/foundation/event_loop.h"
#include "ballistica/shared/python/python_command.h"
#include "ballistica/shared/python/python_sys.h"

View File

@ -23,6 +23,9 @@ class UIV1SoftInterface {
virtual auto MainMenuVisible() -> bool = 0;
virtual auto PartyIconVisible() -> bool = 0;
virtual void ActivatePartyIcon() = 0;
virtual void HandleLegacyRootUIMouseMotion(float x, float y) = 0;
virtual auto HandleLegacyRootUIMouseDown(float x, float y) -> bool = 0;
virtual void HandleLegacyRootUIMouseUp(float x, float y) = 0;
};
} // namespace ballistica::base

View File

@ -112,6 +112,26 @@ void UI::ActivatePartyIcon() {
g_base->ui_v1()->ActivatePartyIcon();
}
}
void UI::HandleLegacyRootUIMouseMotion(float x, float y) {
if (g_base->HaveUIV1()) {
g_base->ui_v1()->HandleLegacyRootUIMouseMotion(x, y);
}
}
auto UI::HandleLegacyRootUIMouseDown(float x, float y) -> bool {
if (g_base->HaveUIV1()) {
return g_base->ui_v1()->HandleLegacyRootUIMouseDown(x, y);
}
return false;
}
void UI::HandleLegacyRootUIMouseUp(float x, float y) {
if (g_base->HaveUIV1()) {
g_base->ui_v1()->HandleLegacyRootUIMouseUp(x, y);
}
}
void UI::PushBackButtonCall(InputDevice* input_device) {
g_base->logic->event_loop()->PushCall([this, input_device] {
assert(g_base->InLogicThread());

View File

@ -63,6 +63,9 @@ class UI {
auto MainMenuVisible() -> bool;
auto PartyIconVisible() -> bool;
void ActivatePartyIcon();
void HandleLegacyRootUIMouseMotion(float x, float y);
auto HandleLegacyRootUIMouseDown(float x, float y) -> bool;
void HandleLegacyRootUIMouseUp(float x, float y);
// Return the root widget containing all windows & dialogs
// Whenever this contains children, the UI is considered to be in focus

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 = 21036;
const int kEngineBuildNumber = 21037;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -96,4 +96,23 @@ void UIV1FeatureSet::ActivatePartyIcon() {
}
}
void UIV1FeatureSet::HandleLegacyRootUIMouseMotion(float x, float y) {
if (auto* root_ui = g_base->ui->root_ui()) {
root_ui->HandleMouseMotion(x, y);
}
}
auto UIV1FeatureSet::HandleLegacyRootUIMouseDown(float x, float y) -> bool {
if (auto* root_ui = g_base->ui->root_ui()) {
return root_ui->HandleMouseButtonDown(x, y);
}
return false;
}
void UIV1FeatureSet::HandleLegacyRootUIMouseUp(float x, float y) {
if (auto* root_ui = g_base->ui->root_ui()) {
root_ui->HandleMouseButtonUp(x, y);
}
}
} // namespace ballistica::ui_v1

View File

@ -61,6 +61,9 @@ class UIV1FeatureSet : public FeatureSetNativeComponent,
auto MainMenuVisible() -> bool override;
auto PartyIconVisible() -> bool override;
void ActivatePartyIcon() override;
void HandleLegacyRootUIMouseMotion(float x, float y) override;
auto HandleLegacyRootUIMouseDown(float x, float y) -> bool override;
void HandleLegacyRootUIMouseUp(float x, float y) override;
UIV1Python* const python;