added close button to dev console

This commit is contained in:
Eric 2024-10-19 22:35:24 -07:00
parent 676ebdc2b0
commit 4689dfaccc
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
7 changed files with 62 additions and 33 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": "d093b9f05a59887053f21547896f1621",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "5f123741224e935dae9aeefa3a9bcffa",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "9e014a6518548780154b06bb58e2060a",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "8b352bf2b6ebc96a57839eb3677c626a",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "9a46895715c29e8db47dff128028dfe9",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "cc9a9a3841b427a802435eb721a4f43e",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "575a91b0164e3b59e9f1b80859d26dac",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "c317c30a8d4b2076134f5d693f919eb3",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "a0e3a4500fbcd8294c4bfdcad9e413c4",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "c72084535f38e9119be7893537be8d99",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "dc474557f10afc022eaf5da9a774ed5b",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b73ddabd4535a670f59e0bd946213e1e",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "fa63c94c2a66cba0b54bc152198f999c",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "7f37b43b6bdbd288ad0fb2e6157ceb25",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "d6d40b00ca4e2cf4b93f05e6c06ed766",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "0bd0e8701cfef0e5cee51d88e3f3c8ed",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "ace9120f32aafd8599b47deebea06a28",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "bcc2ad7ce1c217ca4f60ed769cbc6d7d",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "99c04035b38773827f4e0bc8bd29adce",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "d16cc9cfdf548499f34854a67f4a7225",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "03ce0cbe2c5eb8576d814335c98ff1df",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "1bc4d43781710952837ed1f36cb9097a",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "26648500a2711df748e0da026c5714a0",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "ad48088c6950ea49afc507c945cd2c9c",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "4aff6fdd4acfdfc76510fe079acf6d1b",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "6e2bed02d26a055713d36ea1fda854bc",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "35b613d5c460e7da16dd4c8c2d4a5c62",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "645bfd279bce981998ba6178898d3d4d",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "5aed19cc3ced5e6f14b11cd9ec83c69e",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "42e4c96550b9f0b8a43605a0c568e48a",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "726b841da7222677fc01620b16be80a6",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "30d5973aff519624d7c5268d31a0d003",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "6d83c89cb4d4a2cdf73855e5e7c8fed6",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "34ff854bfcd18fa75a9bb620dfcd4da5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "2b4f709911e8460bc2abe3acfccdbb04",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "67ec66ade109751e6af1242b63850b1e",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "ebe5c4ec18d47ab793a103960e5515ff",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "fb266361242881927093827411e6ab3d",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "90ef79c3a9ef580570ac01b6c7e20178",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "fb8a94307692e581bf60208f63d765eb",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "653df60722ed096b8cc3ac3a4196e5a5",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "f82c1e575e8f23c1e278db61a740a4d5",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "653df60722ed096b8cc3ac3a4196e5a5",
@ -4132,14 +4132,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "ea327f45634a8e42259c5ecadf219e36",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "547362a74979fa82b854a475dffeae90",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "ea327f45634a8e42259c5ecadf219e36",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "c46bc2da33b300077f51c11846966504",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "49706dad7a84cafb139902b95d7ecaf4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "32b5765d12873b610ade2cc35c115eab",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "f4d32707b72f248407be7cdcd4ad67d0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "49a7cd802409e0ed6dfd44004ad03aee",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "100590b2b6f554d7763b18122ba9e04d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "8f0fe1c1173afc5c6c8efdb23e941b73",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "6cfb3a5dd5eefca669e3389e847562dc",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "558ef83c31ba8a0e9541f856ad997af2",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "d1bf489578c3800c1c2135742b16dbff",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "7217b4688aa3a08f06c938e4d1c653ce",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "ae327c7127f2d4d487ed4c13f5958ae7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "578b992ba4bebbb5b2895ebc923dd748",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "0d567bd2c97258e22d93ccc9591386c7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "b8e9ac8dccc7f2afeda34fb2c1f74a32",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "c4f2c0e42696712ad208d24ab7e095b7",
"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": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 22044, api 9, 2024-10-19)
### 1.7.37 (build 22045, api 9, 2024-10-19)
- 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.
@ -132,6 +132,8 @@
SDL_JoystickOpen() returns nullptr for whatever reason.
- (build 22028) Fixed a longstanding issue that could cause logic thread
bg-dynamics message overflows.
- Added a close button to the dev-console as an alternate to using key presses
to close it.
### 1.7.36 (build 21944, api 8, 2024-07-26)
- Wired up Tokens, BombSquad's new purchasable currency. The first thing these

View File

@ -2,7 +2,7 @@ cpplint==2.0.0
dmgbuild==1.6.2
filelock==3.16.1
furo==2024.8.6
mypy==1.12.0
mypy==1.12.1
pbxproj==4.2.1
pdoc==15.0.0
pur==7.3.2

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 = 22044
TARGET_BALLISTICA_BUILD = 22045
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -479,11 +479,23 @@ DevConsole::DevConsole() {
void DevConsole::OnUIScaleChanged() {
g_base->logic->event_loop()->PushCall([this] {
RefreshCloseButton_();
RefreshTabButtons_();
RefreshTabContents_();
});
}
void DevConsole::RefreshCloseButton_() {
float bs = BaseScale();
float bwidth = 32.0f * bs;
float bheight = 26.0f * bs;
float bscale = 0.6f * bs;
float x = 0.0f;
close_button_ = std::make_unique<TabButton_>(
"×", false, bscale, DevConsoleHAnchor_::kLeft, x, -bheight, bwidth,
bheight, [this] { Dismiss(); });
}
void DevConsole::RefreshTabButtons_() {
// IMPORTANT: This code should always be run in its own top level call and
// never directly from user code. Otherwise we can wind up mucking with
@ -525,6 +537,7 @@ void DevConsole::RefreshTabButtons_() {
// Can't muck with UI from code called while iterating through UI.
// So defer it.
g_base->logic->event_loop()->PushCall([this] {
RefreshCloseButton_();
RefreshTabButtons_();
RefreshTabContents_();
});
@ -620,6 +633,9 @@ auto DevConsole::HandleMouseDown(int button, float x, float y) -> bool {
// Make sure we don't muck with our UI while we're in here.
auto lock = ScopedUILock_(this);
if (close_button_ && close_button_->HandleMouseDown(x, y - bottom)) {
return true;
}
for (auto&& button : tab_buttons_) {
if (button->HandleMouseDown(x, y - bottom)) {
return true;
@ -663,6 +679,10 @@ void DevConsole::HandleMouseUp(int button, float x, float y) {
// Make sure we don't muck with our UI while we're in here.
auto lock = ScopedUILock_(this);
if (close_button_) {
close_button_->HandleMouseUp(x, y - bottom);
}
for (auto&& button : tab_buttons_) {
button->HandleMouseUp(x, y - bottom);
}
@ -1130,6 +1150,7 @@ void DevConsole::ToggleState() {
// Can't muck with UI from code (potentially) called while iterating
// through UI. So defer it.
g_base->logic->event_loop()->PushCall([this] {
RefreshCloseButton_();
RefreshTabButtons_();
RefreshTabContents_();
});
@ -1240,6 +1261,7 @@ void DevConsole::Draw(FrameDef* frame_def) {
last_virtual_res_y_ = screen_virtual_height;
last_virtual_res_change_time_ = display_time;
g_base->logic->event_loop()->PushCall([this] {
RefreshCloseButton_();
RefreshTabButtons_();
RefreshTabContents_();
});
@ -1423,11 +1445,13 @@ void DevConsole::Draw(FrameDef* frame_def) {
}
}
// Tab Buttons.
// Close Button and Tab Buttons.
{
// Make sure we don't muck with our UI while we're in here.
auto lock = ScopedUILock_(this);
close_button_->Draw(pass, bottom);
for (auto&& button : tab_buttons_) {
button->Draw(pass, bottom);
}

View File

@ -4,6 +4,7 @@
#define BALLISTICA_BASE_UI_DEV_CONSOLE_H_
#include <list>
#include <memory>
#include <string>
#include <vector>
@ -87,6 +88,7 @@ class DevConsole {
auto Bottom_() const -> float;
void SubmitPythonCommand_(const std::string& command);
void InvokeStringEditor_();
void RefreshCloseButton_();
void RefreshTabButtons_();
void RefreshTabContents_();
@ -120,6 +122,7 @@ class DevConsole {
PythonRef string_edit_adapter_;
std::list<std::string> input_history_;
std::list<OutputLine_> output_lines_;
std::unique_ptr<Widget_> close_button_;
std::vector<std::unique_ptr<Widget_> > widgets_;
std::vector<std::unique_ptr<Widget_> > tab_buttons_;
Object::Ref<Repeater> key_repeater_;

View File

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