Rise
The Vieneo Province
Loading...
Searching...
No Matches
DialogLayout.h
Go to the documentation of this file.
1#pragma once
2
3#include <algorithm>
4#include <array>
5#include <cmath>
6
7namespace DialogLayout
8{
22
23 // Jason's saved layout, 2026-10-07: 3440x1351 game client at 1.1 UI scale.
24 // All dimensions below are logical UI units, including each panel's frame.
25 constexpr float ReferenceWidth = 3440.0f / 1.1f;
26 constexpr float ReferenceHeight = 1351.0f / 1.1f;
27
28 struct Panel
29 {
30 float x = 0, y = 0, width = 0, height = 0;
31 };
32 using Layout = std::array<Panel, Count>;
33
34 inline float Fit(float position, float size, float available)
35 {
36 return (std::max)(0.0f, (std::min)(position, available - size));
37 }
38
39 inline Layout Defaults(float width, float height, Layout panels, float minimumChatWidth)
40 {
41 constexpr float left = 133.0f;
42 constexpr float tabHeight = 16.0f;
43 auto& chat = panels[Communications];
44 auto& players = panels[Players];
45 const float rowWidth = left + panels[Biometer].width + 3.0f + chat.width +
46 players.width + 3.0f + panels[Intermedia].width - 2.0f + panels[ExternalCamera].width;
47 chat.width = std::floor((std::max)(minimumChatWidth, chat.width - (std::max)(0.0f, rowWidth - width)));
48
49 float x = left, rowTop = 0, rowHeight = 0;
50 const auto place = [&](int id, float groupWidth, float topInset)
51 {
52 auto& panel = panels[id];
53 if (x > left && x + groupWidth > width)
54 {
55 x = left;
56 rowTop += rowHeight + 8.0f;
57 rowHeight = 0;
58 }
59 panel.x = Fit(x, groupWidth, width);
60 panel.y = rowTop + topInset;
61 rowHeight = (std::max)(rowHeight, topInset + panel.height);
62 x = panel.x + groupWidth;
63 };
64
65 place(Biometer, panels[Biometer].width, tabHeight);
66 x += 3.0f;
67 // Communications and Players are one group and must never wrap separately.
68 place(Communications, chat.width + players.width, 0);
69 players.x = chat.x + chat.width;
70 players.y = chat.y + tabHeight;
71 rowHeight = (std::max)(rowHeight, tabHeight + players.height);
72 x += 3.0f;
73 place(Intermedia, panels[Intermedia].width, tabHeight);
74 x -= 2.0f; // Preserve the shared frame overlap in the reference layout.
75 place(ExternalCamera, panels[ExternalCamera].width, tabHeight);
76
77 auto& people = panels[People];
78 people.x = 138.0f;
79 people.y = height - (ReferenceHeight - 1018.0f - 184.0f) - people.height;
80 auto& waypoints = panels[Waypoints];
81 waypoints.x = 139.0f;
82 waypoints.y = height - (ReferenceHeight - 1015.0f - 189.0f) - waypoints.height;
83
84 auto& configuration = panels[Configuration];
85 configuration.x = 136.0f;
86 configuration.y = (height - configuration.height) * (317.0f / (ReferenceHeight - 568.0f));
87 auto& information = panels[Information];
88 information.x = (width - information.width) * (712.0f / (ReferenceWidth - 256.0f));
89 information.y = (height - information.height) * (429.0f / (ReferenceHeight - 232.0f));
90
91 for (auto& panel : panels)
92 {
93 panel.x = Fit(panel.x, panel.width, width);
94 panel.y = Fit(panel.y, panel.height, height);
95 }
96 // Clamping a short viewport must not separate the docked pair.
97 chat.y = Fit(chat.y, (std::max)(chat.height, tabHeight + players.height), height);
98 players.y = chat.y + tabHeight;
99 return panels;
100 }
101}
constexpr float ReferenceHeight
Layout Defaults(float width, float height, Layout panels, float minimumChatWidth)
std::array< Panel, Count > Layout
constexpr float ReferenceWidth
float Fit(float position, float size, float available)