mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-27 09:23:12 +08:00
improved in-app python console readability
This commit is contained in:
parent
58cec911a6
commit
53b0df2e6d
56
.efrocachemap
generated
56
.efrocachemap
generated
@ -4064,26 +4064,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": "c0e542e25f839b32d91a07046bd56333",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "f159a31dcd46f144cc796a6f2cbb0a2a",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "f0a7e6c9ad568b229b8299ac15a485b4",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "4c453da417e3e2ab696009f3efb0cbc5",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "56b10a97ac10e4ff9ae854616f3d58de",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "e6a5ecde216f1c180321eec53de8e54d",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "3170eb1b194b77204b5b3454d271e10d",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "368f1eb9a45f3e0d7452e5770f67bd65",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "4376bee2a3d9b1ac98f418e981bd6b5e",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "241bcdfb4a528a4f9714efa9c086a6a6",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "ed0ae25a5332c9e90bc576a41b0e6397",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b0fc89d99bfacf8326a313c0c9d89065",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "ab540c6524dfdc31ef55be4726f6a978",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "d0e6d409f0f5bfa339060bd6024b10f7",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "287d4e643461591bb897d26f9b24a600",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8f53ad04b1de065d104b7fd28da0e79c",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "74fa35f559c38176ff91c794b78d06e2",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "2cb71ce71f4ac5d8d2bda2af1ebc87b5",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "53ac1a5d801ae8ae82de21ec9d9a6b8d",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "113c82cf8b6c95a2c940c45b97e4b894",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "e1b769cee4e1910b1f624c8c89e4ac57",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "e3b8c7317208183b186cec87460c7c4a",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "d80101bc466f64c24be3919e4465f9a8",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "19736e5df72357700c9f29df4cc63256",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "11c6eab78eedb694955f72f1d9a3ff28",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "564e93d203233f683061bd997c9b97a6",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "5feb58af7c6324ba1ed40c5fa04dc902",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "45300ce2ed2934c04b290771097b57fc",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "8105175df0aa717e246605d737a8e4ac",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "197678caf46d9caa810be6ea31f74056",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "1b9f3662197f33b691ba2c7e3231c06d",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "e27d0e524256be185f81e661c7eebfcd",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "c61305f3fcab810444419b7920f592b9",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "aac2b4f520cd94185f41290e99c6efe2",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "5996e4300d00cb15c78595aae9ed354b",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "b87de361b664c71b029006a64507c970",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "9eedf6d4715657dbf5b8a014db02f281",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "915af3b698d4231c67693d13debf6195",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "e80b0dbb306ec03d6787909e2a5e6efb",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "24ee229ff8a107d4462b9b3f52c69731",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "6ccd6f2bd0e20520063d4bf8e2c016d0",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "82e76d58eab4962ee7567fbc655072d6",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "6ccd6f2bd0e20520063d4bf8e2c016d0",
|
||||
@ -4100,14 +4100,14 @@
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "6b00cce1baf5f95d36ae911cdcb23dba",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "8708149fb6208e4e5889b4742784623d",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "6b00cce1baf5f95d36ae911cdcb23dba",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "dc9d6facd1062a48245d5fcb603fe5d6",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "987b189ddac1f90808357749dd44fb2c",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "bf8be09124840f7af212918fa98a34ec",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "33ad88b1557e2828c8e0d8be10d9a5ca",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "3cec3a2d11567ff3dda36ace808c6082",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "b69a204fea2b6fcfee2cbce63a8edd9a",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "59874804f88d67858d988cbc746ca601",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "d9cb15a56ce8f6e3870cb2a5c83defda",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "a1ef4bb4e27d76089c190ed2203c498b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c72e1610acaca9ddbb425b21fd2b9cb0",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "2f53cc39631dad4c8932f1255644fba9",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "b16beacb638319086d6d70ecf2b67bc0",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "16a7028dbc1443127f8d53d4387606a6",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "2f7ba6a6a59cd9944c81dbba95dfeef7",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "fb12abbd4d7b19b13c6e20d87e2cc8b5",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "3325c38eb737213bffe773e84e769ebf",
|
||||
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
|
||||
"src/assets/ba_data/python/babase/_mgen/enums.py": "f8cd3af311ac63147882590123b78318",
|
||||
"src/ballistica/base/mgen/pyembed/binding_base.inc": "ad347097a38e0d7ede9eb6dec6a80ee9",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.28 (build 21322, api 8, 2023-09-07)
|
||||
### 1.7.28 (build 21324, api 8, 2023-09-07)
|
||||
|
||||
- Renamed Console to DevConsole, and added an option under advanced settings to
|
||||
always show an ugly 'dev' button onscreen which can be used to toggle it. The
|
||||
@ -6,6 +6,8 @@
|
||||
functionality besides just the Python console to the dev-console, and perhaps
|
||||
improve the Python console a bit too (add support for on-screen keyboards,
|
||||
etc.)
|
||||
- The in-app Python console text is now sized up on phone and tablet devices,
|
||||
and is generally a bit larger everywhere.
|
||||
- Added some high level functionality for copying and deleting feature-sets to
|
||||
the `spinoff` tool. For example, to create your own `poo` feature-set based on
|
||||
the existing `template_fs` one, do `tools/spinoff fset-copy template_fs poo`.
|
||||
|
||||
@ -52,7 +52,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 21322
|
||||
TARGET_BALLISTICA_BUILD = 21324
|
||||
TARGET_BALLISTICA_VERSION = '1.7.28'
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "ballistica/base/input/input.h"
|
||||
#include "ballistica/base/logic/logic.h"
|
||||
#include "ballistica/base/support/context.h"
|
||||
#include "ballistica/base/ui/ui.h"
|
||||
#include "ballistica/core/core.h"
|
||||
#include "ballistica/core/platform/support/min_sdl.h"
|
||||
#include "ballistica/shared/foundation/event_loop.h"
|
||||
@ -26,6 +27,24 @@ const int kDevConsoleStringBreakUpSize = 1950;
|
||||
const int kDevConsoleActivateKey1 = SDLK_BACKQUOTE;
|
||||
const int kDevConsoleActivateKey2 = SDLK_F2;
|
||||
|
||||
class DevConsole::Line_ {
|
||||
public:
|
||||
Line_(std::string s_in, millisecs_t c)
|
||||
: creation_time(c), s(std::move(s_in)) {}
|
||||
millisecs_t creation_time;
|
||||
std::string s;
|
||||
auto GetText() -> TextGroup& {
|
||||
if (!s_mesh_.Exists()) {
|
||||
s_mesh_ = Object::New<TextGroup>();
|
||||
s_mesh_->set_text(s);
|
||||
}
|
||||
return *s_mesh_;
|
||||
}
|
||||
|
||||
private:
|
||||
Object::Ref<TextGroup> s_mesh_;
|
||||
};
|
||||
|
||||
DevConsole::DevConsole() {
|
||||
assert(g_base->InLogicThread());
|
||||
std::string title = std::string("BallisticaKit ") + kEngineVersion + " ("
|
||||
@ -230,9 +249,6 @@ auto DevConsole::HandleKeyRelease(const SDL_Keysym* keysym) -> bool {
|
||||
return state_ != State::kInactive;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma ide diagnostic ignored "LocalValueEscapesScope"
|
||||
|
||||
void DevConsole::Print(const std::string& s_in) {
|
||||
assert(g_base->InLogicThread());
|
||||
std::string s = Utils::GetValidUTF8(s_in.c_str(), "cspr");
|
||||
@ -252,10 +268,9 @@ void DevConsole::Print(const std::string& s_in) {
|
||||
last_line_mesh_dirty_ = true;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void DevConsole::Draw(RenderPass* pass) {
|
||||
millisecs_t transition_ticks = 100;
|
||||
float bs = PythonConsoleBaseScale();
|
||||
if ((transition_start_ != 0)
|
||||
&& (state_ != State::kInactive
|
||||
|| ((g_core->GetAppTimeMillisecs() - transition_start_)
|
||||
@ -264,7 +279,7 @@ void DevConsole::Draw(RenderPass* pass) {
|
||||
(static_cast<float>(g_core->GetAppTimeMillisecs() - transition_start_)
|
||||
/ static_cast<float>(transition_ticks));
|
||||
float bottom;
|
||||
float mini_size = 90;
|
||||
float mini_size = 90.0f * bs;
|
||||
if (state_ == State::kMini) {
|
||||
bottom = pass->virtual_height() - mini_size;
|
||||
} else {
|
||||
@ -296,10 +311,10 @@ void DevConsole::Draw(RenderPass* pass) {
|
||||
bg_mesh_.SetPositionAndSize(0, bottom, kDevConsoleZDepth,
|
||||
pass->virtual_width(),
|
||||
(pass->virtual_height() - bottom));
|
||||
stripe_mesh_.SetPositionAndSize(0, bottom + 15, kDevConsoleZDepth,
|
||||
pass->virtual_width(), 15);
|
||||
shadow_mesh_.SetPositionAndSize(0, bottom - 7, kDevConsoleZDepth,
|
||||
pass->virtual_width(), 7);
|
||||
stripe_mesh_.SetPositionAndSize(0, bottom + 15.0f * bs, kDevConsoleZDepth,
|
||||
pass->virtual_width(), 15.0f * bs);
|
||||
shadow_mesh_.SetPositionAndSize(0, bottom - 7.0f * bs, kDevConsoleZDepth,
|
||||
pass->virtual_width(), 7.0f * bs);
|
||||
SimpleComponent c(pass);
|
||||
c.SetTransparent(true);
|
||||
c.SetColor(0, 0, 0.1f, 0.9f);
|
||||
@ -324,40 +339,44 @@ void DevConsole::Draw(RenderPass* pass) {
|
||||
int elem_count = built_text_group_.GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(built_text_group_.GetElementTexture(e));
|
||||
c.PushTransform();
|
||||
c.Translate(pass->virtual_width() - 175.0f, bottom + 0,
|
||||
kDevConsoleZDepth);
|
||||
c.Scale(0.5f, 0.5f, 0.5f);
|
||||
c.DrawMesh(built_text_group_.GetElementMesh(e));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(pass->virtual_width() - 115.0f * bs, bottom + 4.0f,
|
||||
kDevConsoleZDepth);
|
||||
c.Scale(0.35f * bs, 0.35f * bs, 1.0f);
|
||||
c.DrawMesh(built_text_group_.GetElementMesh(e));
|
||||
}
|
||||
}
|
||||
elem_count = title_text_group_.GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(title_text_group_.GetElementTexture(e));
|
||||
c.PushTransform();
|
||||
c.Translate(20.0f, bottom + 0, kDevConsoleZDepth);
|
||||
c.Scale(0.5f, 0.5f, 0.5f);
|
||||
c.DrawMesh(title_text_group_.GetElementMesh(e));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(10.0f * bs, bottom + 4.0f, kDevConsoleZDepth);
|
||||
c.Scale(0.35f * bs, 0.35f * bs, 1.0f);
|
||||
c.DrawMesh(title_text_group_.GetElementMesh(e));
|
||||
}
|
||||
}
|
||||
elem_count = prompt_text_group_.GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(prompt_text_group_.GetElementTexture(e));
|
||||
c.SetColor(1, 1, 1, 1);
|
||||
c.PushTransform();
|
||||
c.Translate(5.0f, bottom + 15.0f, kDevConsoleZDepth);
|
||||
c.Scale(0.5f, 0.5f, 0.5f);
|
||||
c.DrawMesh(prompt_text_group_.GetElementMesh(e));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(5.0f * bs, bottom + 14.5f * bs, kDevConsoleZDepth);
|
||||
c.Scale(0.5f * bs, 0.5f * bs, 1.0f);
|
||||
c.DrawMesh(prompt_text_group_.GetElementMesh(e));
|
||||
}
|
||||
}
|
||||
elem_count = input_text_group_.GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(input_text_group_.GetElementTexture(e));
|
||||
c.PushTransform();
|
||||
c.Translate(15.0f, bottom + 15.0f, kDevConsoleZDepth);
|
||||
c.Scale(0.5f, 0.5f, 0.5f);
|
||||
c.DrawMesh(input_text_group_.GetElementMesh(e));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(15.0f * bs, bottom + 14.5f * bs, kDevConsoleZDepth);
|
||||
c.Scale(0.5f * bs, 0.5f * bs, 1.0f);
|
||||
c.DrawMesh(input_text_group_.GetElementMesh(e));
|
||||
}
|
||||
}
|
||||
c.Submit();
|
||||
}
|
||||
@ -369,26 +388,30 @@ void DevConsole::Draw(RenderPass* pass) {
|
||||
SimpleComponent c(pass);
|
||||
c.SetTransparent(true);
|
||||
c.SetColor(1, 1, 1, 0.7f);
|
||||
c.PushTransform();
|
||||
c.Translate(
|
||||
19.0f + g_base->text_graphics->GetStringWidth(input_string_) * 0.5f,
|
||||
bottom + 23.0f, kDevConsoleZDepth);
|
||||
c.Scale(5, 11, 1.0f);
|
||||
c.DrawMeshAsset(g_base->assets->SysMesh(SysMeshID::kImage1x1));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(
|
||||
(19.0f
|
||||
+ g_base->text_graphics->GetStringWidth(input_string_) * 0.5f)
|
||||
* bs,
|
||||
bottom + 22.5f * bs, kDevConsoleZDepth);
|
||||
c.Scale(6.0f * bs, 12.0f * bs, 1.0f);
|
||||
c.DrawMeshAsset(g_base->assets->SysMesh(SysMeshID::kImage1x1));
|
||||
}
|
||||
c.Submit();
|
||||
}
|
||||
|
||||
// Draw console messages.
|
||||
// Draw output lines.
|
||||
{
|
||||
float draw_scale = 0.5f;
|
||||
float draw_scale = 0.6f;
|
||||
float v_inc = 18.0f;
|
||||
SimpleComponent c(pass);
|
||||
c.SetTransparent(true);
|
||||
c.SetColor(1, 1, 1, 1);
|
||||
float h = 0.5f
|
||||
* (g_base->graphics->screen_virtual_width()
|
||||
- (kDevConsoleStringBreakUpSize * draw_scale));
|
||||
float v = bottom + 32.0f;
|
||||
float v = bottom + 32.0f * bs;
|
||||
if (!last_line_.empty()) {
|
||||
if (last_line_mesh_dirty_) {
|
||||
if (!last_line_mesh_group_.Exists()) {
|
||||
@ -400,25 +423,27 @@ void DevConsole::Draw(RenderPass* pass) {
|
||||
int elem_count = last_line_mesh_group_->GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(last_line_mesh_group_->GetElementTexture(e));
|
||||
c.PushTransform();
|
||||
c.Translate(h, v + 2, kDevConsoleZDepth);
|
||||
c.Scale(draw_scale, draw_scale);
|
||||
c.DrawMesh(last_line_mesh_group_->GetElementMesh(e));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(h, v + 2, kDevConsoleZDepth);
|
||||
c.Scale(draw_scale, draw_scale);
|
||||
c.DrawMesh(last_line_mesh_group_->GetElementMesh(e));
|
||||
}
|
||||
}
|
||||
v += 14;
|
||||
v += v_inc;
|
||||
}
|
||||
for (auto i = lines_.rbegin(); i != lines_.rend(); i++) {
|
||||
int elem_count = i->GetText().GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(i->GetText().GetElementTexture(e));
|
||||
c.PushTransform();
|
||||
c.Translate(h, v + 2, kDevConsoleZDepth);
|
||||
c.Scale(draw_scale, draw_scale);
|
||||
c.DrawMesh(i->GetText().GetElementMesh(e));
|
||||
c.PopTransform();
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(h, v + 2, kDevConsoleZDepth);
|
||||
c.Scale(draw_scale, draw_scale);
|
||||
c.DrawMesh(i->GetText().GetElementMesh(e));
|
||||
}
|
||||
}
|
||||
v += 14;
|
||||
v += v_inc;
|
||||
if (v > pass->virtual_height() + 14) {
|
||||
break;
|
||||
}
|
||||
@ -427,5 +452,16 @@ void DevConsole::Draw(RenderPass* pass) {
|
||||
}
|
||||
}
|
||||
}
|
||||
auto DevConsole::PythonConsoleBaseScale() -> float {
|
||||
switch (g_base->ui->scale()) {
|
||||
case UIScale::kLarge:
|
||||
return 1.5f;
|
||||
case UIScale::kMedium:
|
||||
return 1.75f;
|
||||
case UIScale::kSmall:
|
||||
case UIScale::kLast:
|
||||
return 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ballistica::base
|
||||
|
||||
@ -36,6 +36,9 @@ class DevConsole {
|
||||
void EnableInput();
|
||||
|
||||
private:
|
||||
class Line_;
|
||||
|
||||
auto PythonConsoleBaseScale() -> float;
|
||||
void SubmitCommand_(const std::string& command);
|
||||
enum class State { kInactive, kMini, kFull };
|
||||
ImageMesh bg_mesh_;
|
||||
@ -50,30 +53,11 @@ class DevConsole {
|
||||
millisecs_t transition_start_{};
|
||||
State state_{State::kInactive};
|
||||
State state_prev_{State::kInactive};
|
||||
|
||||
class Message {
|
||||
public:
|
||||
Message(std::string s_in, millisecs_t c)
|
||||
: creation_time(c), s(std::move(s_in)) {}
|
||||
millisecs_t creation_time;
|
||||
std::string s;
|
||||
auto GetText() -> TextGroup& {
|
||||
if (!s_mesh_.Exists()) {
|
||||
s_mesh_ = Object::New<TextGroup>();
|
||||
s_mesh_->set_text(s);
|
||||
}
|
||||
return *s_mesh_;
|
||||
}
|
||||
|
||||
private:
|
||||
Object::Ref<TextGroup> s_mesh_;
|
||||
};
|
||||
|
||||
bool input_enabled_{};
|
||||
std::string input_string_;
|
||||
std::list<std::string> input_history_;
|
||||
int input_history_position_{};
|
||||
std::list<Message> lines_;
|
||||
std::list<Line_> lines_;
|
||||
std::string last_line_;
|
||||
Object::Ref<TextGroup> last_line_mesh_group_;
|
||||
bool last_line_mesh_dirty_{true};
|
||||
|
||||
@ -363,12 +363,15 @@ void UI::DrawDev(FrameDef* frame_def) {
|
||||
}
|
||||
|
||||
auto UI::DevConsoleButtonSize_() const -> float {
|
||||
if (scale_ == UIScale::kLarge) {
|
||||
return 25.0f;
|
||||
} else if (scale_ == UIScale::kMedium) {
|
||||
return 40.0f;
|
||||
switch (scale_) {
|
||||
case UIScale::kLarge:
|
||||
return 25.0f;
|
||||
case UIScale::kMedium:
|
||||
return 40.0f;
|
||||
case UIScale::kSmall:
|
||||
case UIScale::kLast:
|
||||
return 60.0f;
|
||||
}
|
||||
return 60.0f;
|
||||
}
|
||||
|
||||
auto UI::InDevConsoleButton_(float x, float y) const -> bool {
|
||||
@ -377,7 +380,7 @@ auto UI::InDevConsoleButton_(float x, float y) const -> bool {
|
||||
float bsz = DevConsoleButtonSize_();
|
||||
float bszh = bsz * 0.5f;
|
||||
float centerx = vwidth - bsz * 0.5f;
|
||||
float centery = vheight * 0.5f - bsz * 0.5f;
|
||||
float centery = vheight * 0.5f;
|
||||
float diffx = ::std::abs(centerx - x);
|
||||
float diffy = ::std::abs(centery - y);
|
||||
return diffx <= bszh && diffy <= bszh;
|
||||
@ -402,8 +405,7 @@ void UI::DrawDevConsoleButton_(FrameDef* frame_def) {
|
||||
}
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(vwidth - bsz * 0.5f, vheight * 0.5f - bsz * 0.5f,
|
||||
kCursorZDepth - 0.01f);
|
||||
c.Translate(vwidth - bsz * 0.5f, vheight * 0.5f, kCursorZDepth - 0.01f);
|
||||
c.Scale(bsz, bsz, 1.0f);
|
||||
c.DrawMeshAsset(g_base->assets->SysMesh(SysMeshID::kImage1x1));
|
||||
{
|
||||
|
||||
@ -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 = 21322;
|
||||
const int kEngineBuildNumber = 21324;
|
||||
const char* kEngineVersion = "1.7.28";
|
||||
const int kEngineApiVersion = 8;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user