Refine mobile HUD navigation, status readability and bounded chat preview

This commit is contained in:
shen
2026-10-19 12:23:27 -07:00
parent 0fcb0dcaa4
commit 60c66b7ba7
10 changed files with 305 additions and 42 deletions
@@ -1,5 +1,6 @@
#include "StdAfx.h"
#include "PythonChat.h"
#include "../../platform/EterLib/UIRenderCommands.h" // PORT mobile preview scissor, no chat-history changes.
#include "PythonItem.h"
#include "../GameLib/ItemManager.h"
@@ -66,6 +67,22 @@ PyObject * chatRender(PyObject* poSelf, PyObject* poArgs)
return Py_BuildNone();
}
// PORT: draw the existing fading chat through a bounded mobile preview rectangle.
// The chat list, history, text layout and edit/log render paths remain owned by CPythonChat.
PyObject* chatRenderPreview(PyObject*, PyObject* args)
{
int id, x, y, width, height;
if (!PyArg_ParseTuple(args, "iiiii", &id, &x, &y, &width, &height)) return nullptr;
if (width <= 0 || height <= 0 || width > 4096 || height > 4096) {
PyErr_SetString(PyExc_ValueError, "invalid chat preview rectangle");
return nullptr;
}
UIRenderSetClip(float(x), float(y), float(width), float(height));
CPythonChat::Instance().Render(id);
UIRenderRestoreClip();
return Py_BuildNone();
}
PyObject * chatSetBoardState(PyObject* poSelf, PyObject* poArgs)
{
int iID;
@@ -459,6 +476,7 @@ void initChat()
{ "CreateChatSet", chatCreateChatSet, METH_VARARGS },
{ "Update", chatUpdate, METH_VARARGS },
{ "Render", chatRender, METH_VARARGS },
{ "RenderPreview", chatRenderPreview, METH_VARARGS },
{ "SetBoardState", chatSetBoardState, METH_VARARGS },
{ "SetPosition", chatSetPosition, METH_VARARGS },