Mobile HUD layout: disc widgets, quickslot wheel and belt (mobile step 4)
Native CDisc window for procedural round frames; ui_mobile_widgets (RoundButton, QuickSlotDisc); HUD laid out as the phone plan: player panel, top-right entry row with minimap, left button column, attack disc with two quickslot rings, potion belt on quickslot page 4, exp bar. The PC taskbar and its tooltips are hidden in mobile mode. Adds global quickslot use/add/move for the belt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b79fbce0b0
commit
11bd94d1ce
@@ -1,5 +1,5 @@
|
||||
// Touch mode in the original GameWindow: the mobile HUD must leave the joystick / attack zones and
|
||||
// open world to the touch router, while real UI (taskbar) still takes the finger.
|
||||
// open world to the touch router, while real UI (HUD buttons) still takes the finger.
|
||||
#include "python_runtime.h"
|
||||
#include "python_gameplay_modules.h"
|
||||
#include "app/input/touch_router.h"
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "eter_net/PythonNetworkStream.h"
|
||||
#include <Python.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
@@ -54,7 +55,7 @@ int main(int argc, char** argv) {
|
||||
CGraphicDevice device;
|
||||
device.Init(renderer);
|
||||
runtime.execute(
|
||||
"import app, touch, localeInfo, networkModule, introLoading, net\n"
|
||||
"import app, touch, localeInfo, networkModule, introLoading, net, player\n"
|
||||
"assert app.ENABLE_MOBILE_HUD == 1 and touch.IsEnabled()\n"
|
||||
"net.SendSelectCharacterPacket=lambda slot: None\n"
|
||||
"introLoading.__main__()\n"
|
||||
@@ -81,10 +82,15 @@ int main(int argc, char** argv) {
|
||||
assert(!sink.IsUiAt(W * 0.6f, H * 0.4f));
|
||||
assert(!sink.IsUiAt(160.0f, H - 180.0f));
|
||||
assert(!sink.IsUiAt(layout.attack_x, layout.attack_y));
|
||||
// The taskbar along the bottom edge is real UI.
|
||||
runtime.execute("tb = game.interface.wndTaskBar\n"
|
||||
"touch_tb = tb.GetGlobalPosition()\n"
|
||||
"touch_tb = (touch_tb[0] + tb.GetWidth() / 2, touch_tb[1] + tb.GetHeight() / 2)\n"
|
||||
// Mobile mode hides the PC taskbar; the HUD buttons (here the combat wheel's page button)
|
||||
// are real UI. The quick belt is quickslot page 4 and the minimap sits under the top-right row.
|
||||
runtime.execute("assert not game.interface.wndTaskBar.IsShow()\n"
|
||||
"assert [s.globalIndex for s in hud.quick_slots] == range(24, 32)\n"
|
||||
"mm = game.interface.wndMiniMap\n"
|
||||
"assert mm.GetGlobalPosition()[1] >= hud.drawer.GetGlobalPosition()[1] + hud.drawer.GetRowHeight()\n"
|
||||
"pb = hud.combat_wheel.page_button\n"
|
||||
"touch_tb = pb.GetGlobalPosition()\n"
|
||||
"touch_tb = (touch_tb[0] + pb.GetWidth() / 2, touch_tb[1] + pb.GetHeight() / 2)\n"
|
||||
);
|
||||
PyObject* main = PyImport_AddModule("__main__");
|
||||
PyObject* tb = PyDict_GetItemString(PyModule_GetDict(main), "touch_tb");
|
||||
@@ -110,7 +116,7 @@ int main(int argc, char** argv) {
|
||||
router.FingerUp(1, 160.0f + layout.joy_radius, H - 180.0f, 220);
|
||||
assert(!sink.attack && !ava2::GetPlayerMovementYaw(0.0f, yaw));
|
||||
|
||||
// Taskbar taps go to the window manager, open world taps become world clicks.
|
||||
// HUD button taps go to the window manager, open world taps become world clicks.
|
||||
router.FingerDown(3, tb_x, tb_y, 300);
|
||||
router.FingerUp(3, tb_x, tb_y, 350);
|
||||
assert(sink.ui_downs == 1);
|
||||
@@ -126,12 +132,22 @@ int main(int argc, char** argv) {
|
||||
"safe_hud = ui_mobile_hud.MobileHUD(game.interface)\n"
|
||||
"(ax, ay, ar), joy = touch.GetLayout()\n"
|
||||
"assert (ax, ay, ar) == (1024 - 30 - 120, 768 - 20 - 120, 60), (ax, ay, ar)\n"
|
||||
"assert safe_hud.player_hud.GetGlobalPosition()[0] == 40 + 25\n"
|
||||
"assert safe_hud.player_hud.GetGlobalPosition()[0] == 40 + 12\n"
|
||||
"safe_hud.Hide()\nsafe_hud = None\n");
|
||||
router.SetLayout(layout);
|
||||
|
||||
SDL_FillSurfaceRect(surface, nullptr, 0xff10141e);
|
||||
wm->Render(); SDL_RenderPresent(renderer);
|
||||
// CDisc geometry: the attack disc is dark red between the icon and the rim; empty screen is not.
|
||||
auto pixel = [&](int x, int y) {
|
||||
Uint8 r = 0, g = 0, b = 0, a = 0;
|
||||
SDL_ReadSurfacePixel(surface, x, y, &r, &g, &b, &a);
|
||||
return std::array<int, 3>{r, g, b};
|
||||
};
|
||||
const auto disc = pixel(int(layout.attack_x), int(layout.attack_y) + 45);
|
||||
assert(disc[0] > 80 && disc[0] > disc[2] * 2);
|
||||
const auto empty = pixel(int(W * 0.6f), int(H * 0.4f));
|
||||
assert(empty[0] < 40);
|
||||
if (argc > 3) SDL_SaveBMP(surface, argv[3]);
|
||||
router.SetSink(nullptr);
|
||||
runtime.execute("stream.Destroy()\n");
|
||||
|
||||
Reference in New Issue
Block a user