Working on messenger in portrait mode

This commit is contained in:
Vladislav Khorev committed 2026-06-26 20:04:08 +03:00
1 parent 0b4df8ab2d
commit 8c42179576
10 files changed
+498 -65

No files matched your search

+31 -1
View File
@@ -10,6 +10,7 @@
#include <string>
#include <memory>
#include "AudioPlayerAsync.h"
#include "render/FrameBuffer.h"
// Forward-declared here to avoid pulling Game.h into MenuManager.h.
namespace ZL { struct SaveSlotInfo; }
@@ -31,6 +32,7 @@ namespace ZL {
public:
UiManager uiManager;
UiManager topUiManager;
UiManager chatUiManager;
MenuManager(Renderer& iRenderer, GameState& gameState, AudioPlayerAsync& audioPlayer);
@@ -96,6 +98,9 @@ namespace ZL {
// Called by Game when the window is resized and orientation has changed.
void onOrientationChanged();
// Called from Game::drawUI() to render chat bubbles through an FBO.
void drawChatFbo(Renderer& renderer);
void saveSettings();
void loadSettings();
@@ -125,11 +130,12 @@ namespace ZL {
void refreshChatUnreadIndicators();
void resetPhoneChatNodes();
void recomputePhoneChatPositions();
void recomputePhoneChatPositionsPortrait();
void openPhoneChatFromList(int chatIndex, std::shared_ptr<UiNode> chatRoot);
void returnToPhoneChatList();
void closePhoneScreenFromChat();
void applyUniIntHud();
void rebuildChatBubblesFromHistory(int chatIndex);
void rebuildChatBubblesFromHistory(int chatIndex, bool isPortrait);
void showModalMenuScreen();
void showAboutScreen();
@@ -210,6 +216,9 @@ namespace ZL {
std::shared_ptr<UiNode> phoneChat1Root;
std::shared_ptr<UiNode> phoneChat2Root;
std::shared_ptr<UiNode> phoneChat3Root;
std::shared_ptr<UiNode> verticalPhoneChat1Root;
std::shared_ptr<UiNode> verticalPhoneChat2Root;
std::shared_ptr<UiNode> verticalPhoneChat3Root;
std::shared_ptr<UiNode> modalMenuRoot;
@@ -253,6 +262,27 @@ namespace ZL {
static constexpr float CHAT_TOP_Y = 610.0f;
static constexpr float CHAT_BOTTOM_Y = 290.0f;
static constexpr float CHAT_SPACING = 10.0f;
static constexpr float P_CHAT_TOP_Y = 610.0f + 246;
static constexpr float P_CHAT_BOTTOM_Y = 290.0f + 126;
// FBO dimensions for chat clipping.
// OFFSET_UP / OFFSET_DOWN = how far the FBO extends above / below screen center.
// Height = UP + DOWN. Quad: y0 = projH/2 - DOWN, y1 = projH/2 + UP.
static constexpr float CHAT_FBO_WIDTH_L = 469.0f;
static constexpr float CHAT_FBO_OFFSET_UP_L = 260.0f;
static constexpr float CHAT_FBO_OFFSET_DOWN_L = 70.0f;
static constexpr float CHAT_FBO_WIDTH_P = 670.0f;
static constexpr float CHAT_FBO_OFFSET_UP_P = 360.0f;
static constexpr float CHAT_FBO_OFFSET_DOWN_P = 70.0f;
std::unique_ptr<FrameBuffer> chatFrameBuffer_;
VertexRenderStruct chatFboQuad_;
float chatFboQuadLastProjW_ = -1.0f;
float chatFboQuadLastProjH_ = -1.0f;
bool chatFboQuadLastPortrait_ = false;
};
} // namespace ZL