mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-01 04:03:17 +08:00
more dev-console work
This commit is contained in:
parent
f25f31cce4
commit
d85ac6a160
60
.efrocachemap
generated
60
.efrocachemap
generated
@ -421,31 +421,31 @@
|
||||
"build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26",
|
||||
"build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8",
|
||||
"build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55",
|
||||
"build/assets/ba_data/data/langdata.json": "ffaf99c11311bb311421f8537be1fab9",
|
||||
"build/assets/ba_data/data/languages/arabic.json": "c246699b9c1949ce7542d32d30d47632",
|
||||
"build/assets/ba_data/data/languages/belarussian.json": "995ee0abd5bc05704e9f5a7712774663",
|
||||
"build/assets/ba_data/data/langdata.json": "992c5c5ce292132c4f011f39e0d13de8",
|
||||
"build/assets/ba_data/data/languages/arabic.json": "d1f900ab5aa2433d402bd46ed1149cc7",
|
||||
"build/assets/ba_data/data/languages/belarussian.json": "e151808b6b4f6dc159cf55ee62adad3c",
|
||||
"build/assets/ba_data/data/languages/chinese.json": "8d889accdd49334591209bdaf6eaf02f",
|
||||
"build/assets/ba_data/data/languages/chinesetraditional.json": "19be7dcc11f5a9ed4fc408a0216ab36b",
|
||||
"build/assets/ba_data/data/languages/chinesetraditional.json": "f858da49be0a5374157c627857751078",
|
||||
"build/assets/ba_data/data/languages/croatian.json": "766532c67af5bd0144c2d63cab0516fa",
|
||||
"build/assets/ba_data/data/languages/czech.json": "70992c2e2ac08a1f95a3e94318ab3332",
|
||||
"build/assets/ba_data/data/languages/czech.json": "93c5fe0d884d95435da6c675f64e30e0",
|
||||
"build/assets/ba_data/data/languages/danish.json": "3fd69080783d5c9dcc0af737f02b6f1e",
|
||||
"build/assets/ba_data/data/languages/dutch.json": "22b44a33bf81142ba2befad14eb5746e",
|
||||
"build/assets/ba_data/data/languages/english.json": "b38d54aecf3ac47b8d8ca97d8bab3006",
|
||||
"build/assets/ba_data/data/languages/esperanto.json": "0e397cfa5f3fb8cef5f4a64f21cda880",
|
||||
"build/assets/ba_data/data/languages/filipino.json": "58f363cfd8a3ccf0c904ab753d95789b",
|
||||
"build/assets/ba_data/data/languages/filipino.json": "347f38524816691170d266708fe25894",
|
||||
"build/assets/ba_data/data/languages/french.json": "d8527da977a563185de25ef02bacf826",
|
||||
"build/assets/ba_data/data/languages/german.json": "549754d2a530d825200c6126be56df5c",
|
||||
"build/assets/ba_data/data/languages/gibberish.json": "837423db378b3e7679683805826aa26e",
|
||||
"build/assets/ba_data/data/languages/greek.json": "a65d78f912e9a89f98de004405167a6a",
|
||||
"build/assets/ba_data/data/languages/hindi.json": "88ee0cda537bab9ac827def5e236fe1a",
|
||||
"build/assets/ba_data/data/languages/hungarian.json": "796a290a8c44a1e7635208c2ff5fdc6e",
|
||||
"build/assets/ba_data/data/languages/indonesian.json": "00b351a98d6fc301df604e1e9d56a055",
|
||||
"build/assets/ba_data/data/languages/indonesian.json": "bff88ce57744a639810b93a1d1dd79f4",
|
||||
"build/assets/ba_data/data/languages/italian.json": "338e7a03dff47f4eefc0ca3a995cd4f4",
|
||||
"build/assets/ba_data/data/languages/korean.json": "ca1122a9ee551da3f75ae632012bd0e2",
|
||||
"build/assets/ba_data/data/languages/malay.json": "832562ce997fc70704b9234c95fb2e38",
|
||||
"build/assets/ba_data/data/languages/persian.json": "71cc5b33abda0f285b970b8cc4a014a8",
|
||||
"build/assets/ba_data/data/languages/polish.json": "826c5b0402c2f0bcc29bc6f48b833545",
|
||||
"build/assets/ba_data/data/languages/portuguese.json": "99b27c598c90fd522132af3536aef0ee",
|
||||
"build/assets/ba_data/data/languages/polish.json": "e1a1a801851924748ad38fa68216439a",
|
||||
"build/assets/ba_data/data/languages/portuguese.json": "9fcd6b4da9e5d0dc0e337ab00b5debe2",
|
||||
"build/assets/ba_data/data/languages/romanian.json": "aeebdd54f65939c2facc6ac50c117826",
|
||||
"build/assets/ba_data/data/languages/russian.json": "910cf653497654a16d5c4f067d6def22",
|
||||
"build/assets/ba_data/data/languages/serbian.json": "d7452dd72ac0e51680cb39b5ebaa1c69",
|
||||
@ -456,7 +456,7 @@
|
||||
"build/assets/ba_data/data/languages/thai.json": "33f63753c9af9a5b238d229a0bf23fbc",
|
||||
"build/assets/ba_data/data/languages/turkish.json": "9d7e58c9062dc517c3779c255a9b3142",
|
||||
"build/assets/ba_data/data/languages/ukrainian.json": "f72eb51abfbbb56e27866895d7e947d2",
|
||||
"build/assets/ba_data/data/languages/venetian.json": "71ff7ec07a1f9715fea93229bff249e1",
|
||||
"build/assets/ba_data/data/languages/venetian.json": "88595b7ee696b4094d7874c3c4188852",
|
||||
"build/assets/ba_data/data/languages/vietnamese.json": "921cd1e50f60fe3e101f246e172750ba",
|
||||
"build/assets/ba_data/data/maps/big_g.json": "1dd301d490643088a435ce75df971054",
|
||||
"build/assets/ba_data/data/maps/bridgit.json": "6aea74805f4880cc11237c5734a24422",
|
||||
@ -4056,26 +4056,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": "06130b0dfceeb424ba1b66414cf6d930",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "9ea9b12078443053eee0e0be5137492d",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "31f82f74a30d97d6bc66b2fa8d3abbcd",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "7ba3fa11b4e22b42aa16b8f0f904ea70",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "230141db6263d696c28ad00c011f0f9e",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1e0a508a1fbd20f7e8a1ed79e361ecc6",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "ad6f15fdb1b3956b08d73abb4a0b240d",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "49edc04b213fd8bb10d3227e27921fe8",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "169375157927ea3a826d06a2f3339ccc",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "ed4a2bf5ef5c9e90c4a34a94e82e1752",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "4a8df3bd047824c139d271cb82db06d5",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "a4b0933ce9220822302d660865766891",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "a22db827c37da85d73d248be95f07523",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "49bb13ad22a1f5a75246a21830689998",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "98aa51efb0554fadd446f48b8cb6f31e",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "4450820bb5a73e7b83004a3fe78a50d6",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "cff958f088a5bea303a846dbd0d96e14",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "b2cbf2eee4db47d8d4e1ce0df1c80214",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "3aa845292833b423a7b96263b368bb13",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "2b2a64c6fb1d73d6ddfc19dc597a0947",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "5979fc1374865abb96a8ff2e3f44c166",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "b389b9d4d3cac1d18dc6c04d266d444e",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "9446081855fe37326f970d0ab43e2e59",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "1527bc05d69edeb8af30c6ab25b928f0",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "c57b7f45564dd7cbb3f25c28266a5a3a",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "54911f2b25836bf38f8a33e306dcdee2",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "9f887dfab9eb196ee8a9ff5d7f876139",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "7f89a9b77feb1cde4ba611f4dd8bb444",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "b52a34026a36769640de84ae94ac94d3",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "3c90aa7a5828921da6fa2d1b0242c76a",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "f057fa1a420d0d23e6a5ccfa29a5cd2b",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "24ca0d3ddbe3c45870de1167cd92459a",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "eddb8691d13480b147baf732428139ca",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "9b276bef34a259e05c23391fa3d372a6",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "789d66ae2c844d81f3d4929cc6caf950",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "9fe031c292167461bd8790f11c1b78c6",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "461d3623b1d047a81000bf91f2b5095d",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "57fa8e653ccd0625fa6a95ba7cbcc089",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "7c9ef4e375fcfa593ea8ebdb2cb59f8e",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "d6e492d84f592d0547878c7de8b60e35",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "6ce4983e76e1cc2d2803fe306d08ad58",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "4ea0cf78901f994215f215aebb0af1dc",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "6ce4983e76e1cc2d2803fe306d08ad58",
|
||||
|
||||
1
.idea/dictionaries/ericf.xml
generated
1
.idea/dictionaries/ericf.xml
generated
@ -1221,6 +1221,7 @@
|
||||
<w>genmapjson</w>
|
||||
<w>genstartercache</w>
|
||||
<w>genutils</w>
|
||||
<w>get</w>
|
||||
<w>getaccountid</w>
|
||||
<w>getactivity</w>
|
||||
<w>getauxval</w>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.28 (build 21405, api 8, 2023-10-02)
|
||||
### 1.7.28 (build 21406, api 8, 2023-10-02)
|
||||
|
||||
- Massively cleaned up code related to rendering and window systems (OpenGL,
|
||||
SDL, etc). This code had been growing into a nasty tangle for 15 years
|
||||
|
||||
1
ballisticakit-cmake/.idea/dictionaries/ericf.xml
generated
1
ballisticakit-cmake/.idea/dictionaries/ericf.xml
generated
@ -736,6 +736,7 @@
|
||||
<w>gencmd</w>
|
||||
<w>gencount</w>
|
||||
<w>generatedsymfile</w>
|
||||
<w>get</w>
|
||||
<w>getactivity</w>
|
||||
<w>getattro</w>
|
||||
<w>getattrofunc</w>
|
||||
|
||||
@ -32,6 +32,7 @@ class DevConsoleTab:
|
||||
h_anchor: Literal['left', 'center', 'right'] = 'center',
|
||||
label_scale: float = 1.0,
|
||||
corner_radius: float = 8.0,
|
||||
style: Literal['normal', 'dark'] = 'normal',
|
||||
) -> None:
|
||||
"""Add a button to the tab being refreshed."""
|
||||
assert _babase.app.devconsole.is_refreshing
|
||||
@ -45,6 +46,7 @@ class DevConsoleTab:
|
||||
h_anchor,
|
||||
label_scale,
|
||||
corner_radius,
|
||||
style,
|
||||
)
|
||||
|
||||
def python_terminal(self) -> None:
|
||||
@ -95,6 +97,13 @@ class DevConsoleTabTest(DevConsoleTab):
|
||||
h_anchor='left',
|
||||
call=self.request_refresh,
|
||||
)
|
||||
self.button(
|
||||
f'FLOOP2-{random.randrange(200)}',
|
||||
pos=(120, 10),
|
||||
size=(100, 30),
|
||||
h_anchor='left',
|
||||
style='dark',
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@ -52,7 +52,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 21405
|
||||
TARGET_BALLISTICA_BUILD = 21406
|
||||
TARGET_BALLISTICA_VERSION = '1.7.28'
|
||||
|
||||
|
||||
|
||||
@ -1468,12 +1468,14 @@ static auto PyDevConsoleAddButton(PyObject* self, PyObject* args) -> PyObject* {
|
||||
const char* h_anchor;
|
||||
float label_scale;
|
||||
float corner_radius;
|
||||
if (!PyArg_ParseTuple(args, "sffffOsff", &label, &x, &y, &width, &height,
|
||||
&call, &h_anchor, &label_scale, &corner_radius)) {
|
||||
const char* style;
|
||||
if (!PyArg_ParseTuple(args, "sffffOsffs", &label, &x, &y, &width, &height,
|
||||
&call, &h_anchor, &label_scale, &corner_radius,
|
||||
&style)) {
|
||||
return nullptr;
|
||||
}
|
||||
dev_console->AddButton(label, x, y, width, height, call, h_anchor,
|
||||
label_scale, corner_radius);
|
||||
label_scale, corner_radius, style);
|
||||
Py_RETURN_NONE;
|
||||
BA_PYTHON_CATCH;
|
||||
}
|
||||
@ -1493,6 +1495,7 @@ static PyMethodDef PyDevConsoleAddButtonDef = {
|
||||
" h_anchor: str,\n"
|
||||
" label_scale: float,\n"
|
||||
" corner_radius: float,\n"
|
||||
" style: str,\n"
|
||||
") -> None\n"
|
||||
"\n"
|
||||
"(internal)",
|
||||
|
||||
@ -29,12 +29,12 @@ const int kDevConsoleLineLimit = 80;
|
||||
const int kDevConsoleStringBreakUpSize = 1950;
|
||||
const int kDevConsoleActivateKey1 = SDLK_BACKQUOTE;
|
||||
const int kDevConsoleActivateKey2 = SDLK_F2;
|
||||
const float kDevConsoleButtonCornerRadius{8.0f};
|
||||
const float kDevConsoleTabButtonCornerRadius{16.0f};
|
||||
|
||||
const double kTransitionSeconds = 0.1;
|
||||
|
||||
enum class DevButtonAttach_ { kLeft, kCenter, kRight };
|
||||
enum class DevButtonStyle_ { kNormal, kDark };
|
||||
|
||||
static auto XOffs(DevButtonAttach_ attach) -> float {
|
||||
switch (attach) {
|
||||
@ -101,11 +101,12 @@ class DevConsole::Button_ : public DevConsole::Widget_ {
|
||||
NinePatchMesh mesh;
|
||||
TextGroup text_group;
|
||||
float text_scale;
|
||||
DevButtonStyle_ style;
|
||||
|
||||
template <typename F>
|
||||
Button_(const std::string& label, float text_scale, DevButtonAttach_ attach,
|
||||
float x, float y, float width, float height, float corner_radius,
|
||||
const F& lambda)
|
||||
DevButtonStyle_ style, const F& lambda)
|
||||
: attach{attach},
|
||||
x{x},
|
||||
y{y},
|
||||
@ -113,6 +114,7 @@ class DevConsole::Button_ : public DevConsole::Widget_ {
|
||||
height{height},
|
||||
call{NewLambdaRunnable(lambda)},
|
||||
text_scale{text_scale},
|
||||
style{style},
|
||||
mesh(0.0f, 0.0f, 0.0f, width, height,
|
||||
NinePatchMesh::BorderForRadius(corner_radius, width, height),
|
||||
NinePatchMesh::BorderForRadius(corner_radius, height, width),
|
||||
@ -147,11 +149,24 @@ class DevConsole::Button_ : public DevConsole::Widget_ {
|
||||
}
|
||||
|
||||
void Draw(RenderPass* pass, float bottom) override {
|
||||
DrawBasicButton(
|
||||
pass, &mesh, &text_group, text_scale, bottom, x + XOffs(attach), y,
|
||||
width, height,
|
||||
pressed ? Vector3f{0.0f, 0.0f, 0.0f} : Vector3f{0.8f, 0.7f, 0.8f},
|
||||
pressed ? Vector3f{0.8f, 0.7f, 0.8f} : Vector3f{0.25, 0.2f, 0.3f});
|
||||
Vector3f fgcolor;
|
||||
Vector3f bgcolor;
|
||||
switch (style) {
|
||||
case DevButtonStyle_::kDark:
|
||||
fgcolor =
|
||||
pressed ? Vector3f{0.0f, 0.0f, 0.0f} : Vector3f{0.8f, 0.7f, 0.8f};
|
||||
bgcolor =
|
||||
pressed ? Vector3f{0.6f, 0.5f, 0.6f} : Vector3f{0.16, 0.07f, 0.18f};
|
||||
break;
|
||||
default:
|
||||
assert(style == DevButtonStyle_::kNormal);
|
||||
fgcolor =
|
||||
pressed ? Vector3f{0.0f, 0.0f, 0.0f} : Vector3f{0.8f, 0.7f, 0.8f};
|
||||
bgcolor =
|
||||
pressed ? Vector3f{0.8f, 0.7f, 0.8f} : Vector3f{0.25, 0.2f, 0.3f};
|
||||
}
|
||||
DrawBasicButton(pass, &mesh, &text_group, text_scale, bottom,
|
||||
x + XOffs(attach), y, width, height, fgcolor, bgcolor);
|
||||
}
|
||||
};
|
||||
|
||||
@ -173,7 +188,8 @@ class DevConsole::ToggleButton_ : public DevConsole::Widget_ {
|
||||
template <typename F, typename G>
|
||||
ToggleButton_(const std::string& label, float text_scale,
|
||||
DevButtonAttach_ attach, float x, float y, float width,
|
||||
float height, const F& on_call, const G& off_call)
|
||||
float height, float corner_radius, const F& on_call,
|
||||
const G& off_call)
|
||||
: attach{attach},
|
||||
x{x},
|
||||
y{y},
|
||||
@ -183,14 +199,10 @@ class DevConsole::ToggleButton_ : public DevConsole::Widget_ {
|
||||
off_call{NewLambdaRunnable(off_call)},
|
||||
text_scale{text_scale},
|
||||
mesh(0.0f, 0.0f, 0.0f, width, height,
|
||||
NinePatchMesh::BorderForRadius(kDevConsoleButtonCornerRadius,
|
||||
width, height),
|
||||
NinePatchMesh::BorderForRadius(kDevConsoleButtonCornerRadius,
|
||||
height, width),
|
||||
NinePatchMesh::BorderForRadius(kDevConsoleButtonCornerRadius,
|
||||
width, height),
|
||||
NinePatchMesh::BorderForRadius(kDevConsoleButtonCornerRadius,
|
||||
height, width)) {
|
||||
NinePatchMesh::BorderForRadius(corner_radius, width, height),
|
||||
NinePatchMesh::BorderForRadius(corner_radius, height, width),
|
||||
NinePatchMesh::BorderForRadius(corner_radius, width, height),
|
||||
NinePatchMesh::BorderForRadius(corner_radius, height, width)) {
|
||||
text_group.SetText(label, TextMesh::HAlign::kCenter,
|
||||
TextMesh::VAlign::kCenter);
|
||||
}
|
||||
@ -300,9 +312,10 @@ class DevConsole::TabButton_ : public DevConsole::Widget_ {
|
||||
x + XOffs(attach), y, width, height,
|
||||
pressed ? Vector3f{1.0f, 1.0f, 1.0f}
|
||||
: selected ? Vector3f{1.0f, 1.0f, 1.0f}
|
||||
: Vector3f{0.8f, 0.7f, 0.8f},
|
||||
pressed ? Vector3f{0.5f, 0.2f, 1.0f}
|
||||
: selected ? Vector3f{0.5f, 0.4f, 0.6f}
|
||||
: Vector3f{0.6f, 0.5f, 0.6f},
|
||||
pressed ? Vector3f{0.4f, 0.2f, 0.8f}
|
||||
: selected ? Vector3f{0.4f, 0.3f, 0.4f}
|
||||
// : selected ? Vector3f{0.5f, 0.4f, 0.6f}
|
||||
: Vector3f{0.25, 0.2f, 0.3f});
|
||||
}
|
||||
};
|
||||
@ -403,9 +416,17 @@ void DevConsole::RefreshTabContents_() {
|
||||
|
||||
void DevConsole::AddButton(const char* label, float x, float y, float width,
|
||||
float height, PyObject* call, const char* h_anchor,
|
||||
float label_scale, float corner_radius) {
|
||||
float label_scale, float corner_radius,
|
||||
const char* style) {
|
||||
assert(g_base->InLogicThread());
|
||||
|
||||
DevButtonStyle_ style_val;
|
||||
if (!strcmp(style, "dark")) {
|
||||
style_val = DevButtonStyle_::kDark;
|
||||
} else {
|
||||
style_val = DevButtonStyle_::kNormal;
|
||||
}
|
||||
|
||||
DevButtonAttach_ anchor;
|
||||
if (!strcmp(h_anchor, "left")) {
|
||||
anchor = DevButtonAttach_::kLeft;
|
||||
@ -418,7 +439,7 @@ void DevConsole::AddButton(const char* label, float x, float y, float width,
|
||||
|
||||
// auto call_obj = PythonRef::Acquired(call);
|
||||
buttons_.emplace_back(std::make_unique<Button_>(
|
||||
label, label_scale, anchor, x, y, width, height, corner_radius,
|
||||
label, label_scale, anchor, x, y, width, height, corner_radius, style_val,
|
||||
[this, call_obj = PythonRef::Acquired(call)] {
|
||||
if (call_obj.Get() != Py_None) {
|
||||
call_obj.Call();
|
||||
@ -430,7 +451,8 @@ void DevConsole::AddPythonTerminal() {
|
||||
float bs = BaseScale();
|
||||
buttons_.emplace_back(std::make_unique<Button_>(
|
||||
"Exec", 0.75f * bs, DevButtonAttach_::kRight, -33.0f * bs, 15.95f * bs,
|
||||
32.0f * bs, 13.0f * bs, 2.0 * bs, [this] { Exec(); }));
|
||||
32.0f * bs, 13.0f * bs, 2.0 * bs, DevButtonStyle_::kNormal,
|
||||
[this] { Exec(); }));
|
||||
python_terminal_visible_ = true;
|
||||
}
|
||||
|
||||
@ -578,53 +600,61 @@ auto DevConsole::HandleKeyPress(const SDL_Keysym* keysym) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The rest of these presses we only handle while active.
|
||||
// Handle some stuff only while active.
|
||||
switch (keysym->sym) {
|
||||
case SDLK_ESCAPE:
|
||||
Dismiss();
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
case SDLK_BACKSPACE:
|
||||
case SDLK_DELETE: {
|
||||
std::vector<uint32_t> unichars =
|
||||
Utils::UnicodeFromUTF8(input_string_, "fjco38");
|
||||
if (!unichars.empty()) {
|
||||
unichars.resize(unichars.size() - 1);
|
||||
input_string_ = Utils::UTF8FromUnicode(unichars);
|
||||
input_text_dirty_ = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDLK_UP:
|
||||
case SDLK_DOWN: {
|
||||
if (input_history_.empty()) {
|
||||
}
|
||||
|
||||
// Handle some stuff only with the Python terminal visible.
|
||||
if (python_terminal_visible_) {
|
||||
switch (keysym->sym) {
|
||||
case SDLK_BACKSPACE:
|
||||
case SDLK_DELETE: {
|
||||
std::vector<uint32_t> unichars =
|
||||
Utils::UnicodeFromUTF8(input_string_, "fjco38");
|
||||
if (!unichars.empty()) {
|
||||
unichars.resize(unichars.size() - 1);
|
||||
input_string_ = Utils::UTF8FromUnicode(unichars);
|
||||
input_text_dirty_ = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (keysym->sym == SDLK_UP) {
|
||||
input_history_position_++;
|
||||
} else {
|
||||
input_history_position_--;
|
||||
}
|
||||
int input_history_position_used =
|
||||
(input_history_position_ - 1)
|
||||
% static_cast<int>(input_history_.size());
|
||||
int j = 0;
|
||||
for (auto& i : input_history_) {
|
||||
if (j == input_history_position_used) {
|
||||
input_string_ = i;
|
||||
input_text_dirty_ = true;
|
||||
case SDLK_UP:
|
||||
case SDLK_DOWN: {
|
||||
if (input_history_.empty()) {
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
if (keysym->sym == SDLK_UP) {
|
||||
input_history_position_++;
|
||||
} else {
|
||||
input_history_position_--;
|
||||
}
|
||||
int input_history_position_used =
|
||||
(input_history_position_ - 1)
|
||||
% static_cast<int>(input_history_.size());
|
||||
int j = 0;
|
||||
for (auto& i : input_history_) {
|
||||
if (j == input_history_position_used) {
|
||||
input_string_ = i;
|
||||
input_text_dirty_ = true;
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDLK_KP_ENTER:
|
||||
case SDLK_RETURN: {
|
||||
Exec();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDLK_KP_ENTER:
|
||||
case SDLK_RETURN: {
|
||||
Exec();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -845,7 +875,7 @@ void DevConsole::Draw(FrameDef* frame_def) {
|
||||
c.SetTexture(g_base->assets->SysTexture(SysTextureID::kSoftRectVertical));
|
||||
{
|
||||
auto scissor = c.ScopedScissor({0.0f, 0.0f, pass->virtual_width(),
|
||||
bottom - (border_height * 0.95f) * bs});
|
||||
bottom - (border_height * 0.75f) * bs});
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(pass->virtual_width() * 0.5f, bottom + 160.0f);
|
||||
c.Scale(pass->virtual_width() * 1.2f, 600.0f);
|
||||
@ -863,13 +893,13 @@ void DevConsole::Draw(FrameDef* frame_def) {
|
||||
SimpleComponent c(pass);
|
||||
c.SetFlatness(1.0f);
|
||||
c.SetTransparent(true);
|
||||
c.SetColor(0.5f, 0.5f, 0.7f, 0.8f);
|
||||
c.SetColor(0.4f, 0.33f, 0.45f, 0.8f);
|
||||
int elem_count = built_text_group_.GetElementCount();
|
||||
for (int e = 0; e < elem_count; e++) {
|
||||
c.SetTexture(built_text_group_.GetElementTexture(e));
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(pass->virtual_width() - 115.0f * bs, bottom + 4.0f,
|
||||
c.Translate(pass->virtual_width() - 115.0f * bs, bottom + 1.9f * bs,
|
||||
kDevConsoleZDepth);
|
||||
c.Scale(0.35f * bs, 0.35f * bs, 1.0f);
|
||||
c.DrawMesh(built_text_group_.GetElementMesh(e));
|
||||
@ -880,7 +910,7 @@ void DevConsole::Draw(FrameDef* frame_def) {
|
||||
c.SetTexture(title_text_group_.GetElementTexture(e));
|
||||
{
|
||||
auto xf = c.ScopedTransform();
|
||||
c.Translate(10.0f * bs, bottom + 4.0f, kDevConsoleZDepth);
|
||||
c.Translate(10.0f * bs, bottom + 1.9f * bs, kDevConsoleZDepth);
|
||||
c.Scale(0.35f * bs, 0.35f * bs, 1.0f);
|
||||
c.DrawMesh(title_text_group_.GetElementMesh(e));
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class DevConsole {
|
||||
|
||||
void AddButton(const char* label, float x, float y, float width, float height,
|
||||
PyObject* call, const char* h_anchor, float label_scale,
|
||||
float corner_radius);
|
||||
float corner_radius, const char* style);
|
||||
void AddPythonTerminal();
|
||||
|
||||
auto Width() -> float;
|
||||
|
||||
@ -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 = 21405;
|
||||
const int kEngineBuildNumber = 21406;
|
||||
const char* kEngineVersion = "1.7.28";
|
||||
const int kEngineApiVersion = 8;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user