nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
map.cc
Go to the documentation of this file.
1#include "client/map.h"
2
3#include <imgui.h>
4#include <raylib.h>
5
6#include <algorithm>
7#include <array>
8#include <cfloat>
9#include <cmath>
10#include <cstdint>
11#include <numbers>
12#include <optional>
13#include <string>
14#include <vector>
15
16#include "absl/strings/str_cat.h"
17#include "absl/strings/substitute.h"
18#include "client/atmosphere.h"
19#include "client/ground.h"
20#include "client/names.h"
21#include "client/theme.h"
22#include "client/translations.h"
23#include "extras/IconsFontAwesome6.h"
24
25namespace nanommo {
26
27namespace {
28
29constexpr float kPi = std::numbers::pi_v<float>;
30
31// Deeper than this, in metres, the sea is the deep colour.
32constexpr float kShallow = 1.5f;
33
34// How much the slopes' light and shade show.
35constexpr float kRelief = 1.6f;
36
37// In points, at a scale of one: the minimap's radius, inside its ring, the
38// ring's width, and its margin from the screen's corner.
39constexpr float kRadius = 100.0f;
40constexpr float kRing = 7.0f;
41constexpr float kMargin = 18.0f;
42
43constexpr ImU32 kOutline = IM_COL32(0, 0, 0, 210);
44constexpr ImU32 kPlayer = IM_COL32(150, 200, 255, 255);
45constexpr ImU32 kMonster = IM_COL32(235, 80, 64, 255);
46constexpr ImU32 kNpc = IM_COL32(255, 211, 77, 255);
47
48ImU32 Opaque(Color color) { return IM_COL32(color.r, color.g, color.b, 255); }
49
50ImU32 Sky(int land) {
51 const std::array<float, 3>& sky = kLooks[land].atmosphere.sky;
52 return Opaque(ColorFromNormalized({sky[0], sky[1], sky[2], 1.0f}));
53}
54
55// Where a place goes on the screen, for a view of the land with its middle at
56// centre, where it is on the screen at origin, at scale points to a metre,
57// turned so that the bearing turn is up, which is north when it's zero.
58struct View {
59 Place centre;
60 ImVec2 origin;
61 float scale = 1.0f;
62 float turn = 0.0f;
63
64 // A way on the ground, as a way on the screen, without its scale.
65 ImVec2 Way(float x, float z) const {
66 const float c = std::cos(turn);
67 const float s = std::sin(turn);
68 return {x * c + z * s, -x * s + z * c};
69 }
70
71 ImVec2 operator()(float x, float z) const {
72 const ImVec2 way = Way((x - centre.x) * scale, (z - centre.z) * scale);
73 return {origin.x + way.x, origin.y + way.y};
74 }
75};
76
77void DrawDot(ImDrawList* draw, ImVec2 at, float radius, ImU32 color) {
78 draw->AddCircleFilled(at, radius + Ui(1.2f), kOutline);
79 draw->AddCircleFilled(at, radius, color);
80}
81
82void DrawGlyph(ImDrawList* draw, ImVec2 at, float size, ImU32 color,
83 const char* glyph) {
84 ImFont* font = GetFonts().title;
85 const ImVec2 extent = font->CalcTextSizeA(size, FLT_MAX, 0.0f, glyph);
86 const ImVec2 corner{at.x - extent.x / 2.0f, at.y - extent.y / 2.0f};
87 for (const ImVec2 offset : {ImVec2{-1, 0}, ImVec2{1, 0}, ImVec2{0, -1},
88 ImVec2{0, 1}, ImVec2{1, 1}}) {
89 draw->AddText(font, size, {corner.x + offset.x, corner.y + offset.y},
90 kOutline, glyph);
91 }
92 draw->AddText(font, size, corner, color, glyph);
93}
94
95// Where a mark is on a round map of the radius round the origin: where it is,
96// or, if it's past the rim and it's one to keep, on the rim, the way it is,
97// or none.
98std::optional<ImVec2> OnDisc(ImVec2 at, const View& view, float radius,
99 bool keep) {
100 if (radius <= 0.0f) {
101 return at;
102 }
103 const float dx = at.x - view.origin.x;
104 const float dy = at.y - view.origin.y;
105 const float distance = std::hypot(dx, dy);
106 if (distance <= radius) {
107 return at;
108 }
109 if (!keep) {
110 return std::nullopt;
111 }
112 return ImVec2{view.origin.x + dx / distance * radius,
113 view.origin.y + dy / distance * radius};
114}
115
116// The land's gates, its NPCs, monsters and players, the way you're walking,
117// and you, last, on top, as an arrow the way you face. On a round map, of the
118// radius, what's past its rim is left out, but for the monster you picked and
119// the quests, which wait on the rim.
120void DrawMarkers(ImDrawList* draw, const View& view, int land,
121 const std::vector<Figure>& figures, uint32_t target,
122 std::optional<Vector3> destination, float radius = 0.0f) {
123 const float rim = radius > 0.0f ? radius - Ui(6.0f) : 0.0f;
124 for (const Gate& gate : kGates) {
125 if (gate.land == land) {
126 if (const std::optional<ImVec2> at =
127 OnDisc(view(gate.place.x, gate.place.z), view, rim, false)) {
128 draw->AddCircle(*at, Ui(6.0f), kOutline, 0, Ui(4.0f));
129 draw->AddCircle(*at, Ui(6.0f), Sky(gate.to), 0, Ui(2.0f));
130 }
131 }
132 }
133 const Figure* you = nullptr;
134 for (const Figure& figure : figures) {
135 const ImVec2 where = view(figure.position.x, figure.position.z);
136 if (figure.you) {
137 you = &figure;
138 } else if (figure.npc) {
139 const bool quest = figure.mark != 0;
140 const std::optional<ImVec2> at = OnDisc(where, view, rim, quest);
141 if (!at) {
142 continue;
143 }
144 if (quest) {
145 const char mark[2] = {figure.mark, 0};
146 DrawGlyph(draw, *at, Ui(17.0f), kNpc, mark);
147 } else {
148 DrawDot(draw, *at, Ui(2.8f), kNpc);
149 }
150 } else if (figure.monster) {
151 const bool picked = figure.id == target;
152 const std::optional<ImVec2> at = OnDisc(where, view, rim, picked);
153 if (!at) {
154 continue;
155 }
156 if (figure.to != protocol::MOTION_DEAD) {
157 DrawDot(draw, *at, Ui(2.4f), kMonster);
158 }
159 if (picked) {
160 draw->AddCircle(*at, Ui(5.5f), kOutline, 0, Ui(3.0f));
161 draw->AddCircle(*at, Ui(5.5f), colors::kEmber, 0, Ui(1.6f));
162 }
163 } else if (const std::optional<ImVec2> at =
164 OnDisc(where, view, rim, false)) {
165 DrawDot(draw, *at, Ui(2.8f), kPlayer);
166 }
167 }
168 if (destination) {
169 if (const std::optional<ImVec2> at =
170 OnDisc(view(destination->x, destination->z), view, rim, false)) {
171 const float arm = Ui(4.0f);
172 for (const ImU32 color : {kOutline, colors::kGoldLight}) {
173 const float width = color == kOutline ? Ui(3.5f) : Ui(1.5f);
174 draw->AddLine({at->x - arm, at->y - arm}, {at->x + arm, at->y + arm},
175 color, width);
176 draw->AddLine({at->x - arm, at->y + arm}, {at->x + arm, at->y - arm},
177 color, width);
178 }
179 }
180 }
181 if (you != nullptr) {
182 // A yaw of zero faces along z, which is down the map.
183 const ImVec2 at = view(you->position.x, you->position.z);
184 const ImVec2 ahead = view.Way(std::sin(you->yaw), std::cos(you->yaw));
185 const ImVec2 side{-ahead.y, ahead.x};
186 const auto point = [&](float across, float along) {
187 return ImVec2{at.x + Ui(along * ahead.x + across * side.x),
188 at.y + Ui(along * ahead.y + across * side.y)};
189 };
190 const ImVec2 tip = point(0.0f, 9.0f);
191 const ImVec2 left = point(-6.0f, -6.0f);
192 const ImVec2 notch = point(0.0f, -2.5f);
193 const ImVec2 right = point(6.0f, -6.0f);
194 draw->AddTriangleFilled(tip, left, notch, colors::kGold);
195 draw->AddTriangleFilled(tip, notch, right, colors::kGoldDark);
196 draw->PathLineTo(tip);
197 draw->PathLineTo(right);
198 draw->PathLineTo(notch);
199 draw->PathLineTo(left);
200 draw->PathStroke(kOutline, ImDrawFlags_Closed, Ui(1.5f));
201 }
202}
203
204// The texture, as a disc of the radius round centre on the screen, showing
205// the land round the place, a distance of around from it to the rim, turned
206// as the view is.
207void DrawDisc(ImDrawList* draw, ImTextureID texture, float half,
208 const View& view, float radius, float around) {
209 constexpr int kSegments = 72;
210 const float size = 2.0f * half;
211 const ImVec2 middle{(view.centre.x + half) / size,
212 (view.centre.z + half) / size};
213 draw->PushTexture(texture);
214 draw->PrimReserve(kSegments * 3, kSegments + 1);
215 const unsigned int first = draw->_VtxCurrentIdx;
216 draw->PrimWriteVtx(view.origin, middle, IM_COL32_WHITE);
217 for (int i = 0; i < kSegments; ++i) {
218 const float angle = 2.0f * kPi * static_cast<float>(i) / kSegments;
219 const float across = std::cos(angle);
220 const float down = std::sin(angle);
221 // The way on the ground that this way on the screen shows: the view's turn
222 // the other way round.
223 const float c = std::cos(view.turn);
224 const float s = std::sin(view.turn);
225 const float x = across * c - down * s;
226 const float z = across * s + down * c;
227 draw->PrimWriteVtx(
228 {view.origin.x + across * radius, view.origin.y + down * radius},
229 {middle.x + x * around / size, middle.y + z * around / size},
230 IM_COL32_WHITE);
231 }
232 for (int i = 0; i < kSegments; ++i) {
233 draw->PrimWriteIdx(static_cast<ImDrawIdx>(first));
234 draw->PrimWriteIdx(static_cast<ImDrawIdx>(first + 1 + i));
235 draw->PrimWriteIdx(static_cast<ImDrawIdx>(first + 1 + (i + 1) % kSegments));
236 }
237 draw->PopTexture();
238}
239
240// A round button on the minimap's ring, with an icon.
241bool RingButton(const char* id, ImVec2 centre, const char* icon) {
242 const float radius = Ui(11.0f);
243 ImGui::SetCursorScreenPos({centre.x - radius, centre.y - radius});
244 const bool clicked = ImGui::InvisibleButton(id, {radius * 2, radius * 2});
245 const bool hovered = ImGui::IsItemHovered();
246 ImDrawList* draw = ImGui::GetWindowDrawList();
247 draw->AddCircleFilled(centre, radius + Ui(1.5f), kOutline);
248 draw->AddCircleFilled(centre, radius,
249 hovered ? colors::kCrimson : colors::kWine);
250 draw->AddCircle(centre, radius, hovered ? colors::kGold : colors::kBrass, 0,
251 Ui(1.5f));
252 ImFont* font = GetFonts().text;
253 const float size = Ui(12.0f);
254 const ImVec2 extent = font->CalcTextSizeA(size, FLT_MAX, 0.0f, icon);
255 draw->AddText(font, size,
256 {centre.x - extent.x / 2.0f, centre.y - extent.y / 2.0f},
257 hovered ? colors::kGoldLight : colors::kPaper, icon);
258 return clicked;
259}
260
261} // namespace
262
264 if (texture_.id != 0) {
265 UnloadTexture(texture_);
266 }
267}
268
269Image DrawLand(const Terrain& terrain, int land) {
270 const Look& look = kLooks[land];
271 const float half = terrain.half_size();
272 const int size = static_cast<int>(2.0f * half);
273 Image image = GenImageColor(size, size, BLACK);
274 const Grid<Color> pixels(static_cast<Color*>(image.data), size, size);
275 const float inside = half - 1.01f;
276 const auto height = [&terrain, inside](float x, float z) {
277 return terrain.Height(std::clamp(x, -inside, inside),
278 std::clamp(z, -inside, inside));
279 };
280 for (int down = 0; down < size; ++down) {
281 for (int across = 0; across < size; ++across) {
282 const float x = static_cast<float>(across) + 0.5f - half;
283 const float z = static_cast<float>(down) + 0.5f - half;
284 const float here = height(x, z);
285 Color color;
286 if (here < Terrain::kSeaLevel) {
287 color = here < Terrain::kSeaLevel - kShallow ? look.sea.deep
288 : look.sea.shallow;
289 } else {
290 // The slope across and down, in metres a metre.
291 const float dx = (height(x + 1.0f, z) - height(x - 1.0f, z)) / 2.0f;
292 const float dz = (height(x, z + 1.0f) - height(x, z - 1.0f)) / 2.0f;
293 const float up = 1.0f / std::sqrt(1.0f + dx * dx + dz * dz);
294 color = GroundColor(look, here, up);
295 // Lit from the top left, as maps are: slopes that face it lighter,
296 // and the others darker.
297 const float light =
298 std::clamp(1.0f + (dx + dz) * kRelief * up, 0.55f, 1.35f);
299 color = {static_cast<unsigned char>(std::min(color.r * light, 255.0f)),
300 static_cast<unsigned char>(std::min(color.g * light, 255.0f)),
301 static_cast<unsigned char>(std::min(color.b * light, 255.0f)),
302 255};
303 }
304 color.a = 255;
305 pixels[down, across] = color;
306 }
307 }
308 // Each tree as a dark spot, in the trees' colour.
309 const Color tree = ColorTint({40, 80, 40, 255}, look.trees);
310 for (const Tree& planted : terrain.trees()) {
311 const int across = static_cast<int>(planted.x + half);
312 const int down = static_cast<int>(planted.z + half);
313 for (int j = down - 1; j <= down; ++j) {
314 for (int i = across - 1; i <= across; ++i) {
315 if (i >= 0 && j >= 0 && i < size && j < size) {
316 pixels[j, i] = tree;
317 }
318 }
319 }
320 }
321 return image;
322}
323
324void LandMap::Build(const Terrain& terrain, int land) {
325 land_ = land;
326 half_ = terrain.half_size();
327 Image image = DrawLand(terrain, land);
328 if (texture_.id != 0) {
329 UnloadTexture(texture_);
330 }
331 texture_ = LoadTextureFromImage(image);
332 UnloadImage(image);
333 SetTextureFilter(texture_, TEXTURE_FILTER_BILINEAR);
334 // Past the edge is more sea, rather than the other side of the island.
335 SetTextureWrap(texture_, TEXTURE_WRAP_CLAMP);
336}
337
339 zoom_ = std::clamp(zoom, 0, static_cast<int>(kZooms.size()) - 1);
340}
341
342bool LandMap::DrawMinimap(const std::vector<Figure>& figures, uint32_t target,
343 std::optional<Vector3> destination, float heading,
344 MinimapTurn turn) {
345 const auto you = std::ranges::find_if(figures, &Figure::you);
346 if (texture_.id == 0 || you == figures.end()) {
347 bottom_ = 0.0f;
348 return false;
349 }
350 const ImVec2 screen = ImGui::GetIO().DisplaySize;
351 const float radius = Ui(kRadius);
352 const float ring = Ui(kRing);
353 const float outer = radius + ring;
354 const ImVec2 size{2.0f * outer + Ui(8.0f), 2.0f * outer + Ui(36.0f)};
355 ImGui::SetNextWindowPos({screen.x - Ui(kMargin), Ui(kMargin)},
356 ImGuiCond_Always, {1.0f, 0.0f});
357 ImGui::SetNextWindowSize(size);
358 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {0.0f, 0.0f});
359 ImGui::Begin("Minimap", nullptr,
360 ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
361 ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoNav |
362 ImGuiWindowFlags_NoFocusOnAppearing |
363 ImGuiWindowFlags_NoSavedSettings |
364 ImGuiWindowFlags_NoBringToFrontOnFocus);
365 ImGui::PopStyleVar();
366 ImDrawList* draw = ImGui::GetWindowDrawList();
367 const ImVec2 corner = ImGui::GetWindowPos();
368 const ImVec2 centre{corner.x + size.x / 2.0f, corner.y + Ui(6.0f) + outer};
369 bottom_ = corner.y + size.y;
370
371 // The land round you, in a disc, with a shade inside its rim.
372 const float around = kZooms[zoom_];
373 const View view{.centre = {you->position.x, you->position.z},
374 .origin = centre,
375 .scale = radius / around,
376 .turn = turn == MinimapTurn::kWithCamera ? heading : 0.0f};
377 draw->AddCircleFilled(centre, radius, colors::kNight);
378 DrawDisc(draw, static_cast<ImTextureID>(texture_.id), half_, view, radius,
379 around);
380 for (int i = 0; i < 4; ++i) {
381 draw->AddCircle(centre, radius - Ui(2.0f + 2.5f * i),
382 Faded(IM_COL32_BLACK, 0.22f - 0.05f * i), 0, Ui(3.0f));
383 }
384 DrawMarkers(draw, view, land_, figures, target, destination, radius);
385
386 // The ring: brass, dark at its edges, lit from the top left.
387 draw->AddCircle(centre, radius + ring / 2.0f, colors::kBrass, 0, ring);
388 draw->PathArcTo(centre, radius + ring / 2.0f, kPi * 1.0f, kPi * 1.6f, 24);
389 draw->PathStroke(Faded(colors::kGoldLight, 0.35f), 0, ring * 0.45f);
390 draw->AddCircle(centre, outer, colors::kNight, 0, Ui(1.6f));
391 draw->AddCircle(centre, radius, Faded(colors::kNight, 0.9f), 0, Ui(1.6f));
392 // Notches every quarter, from north, and north's own gem with its letter.
393 for (int quarter = 0; quarter < 4; ++quarter) {
394 const float bearing = static_cast<float>(quarter) * kPi / 2.0f - view.turn;
395 const ImVec2 way{std::sin(bearing), -std::cos(bearing)};
396 if (quarter == 0) {
397 const ImVec2 at{centre.x + way.x * (radius + ring / 2.0f),
398 centre.y + way.y * (radius + ring / 2.0f)};
399 DrawDiamond(draw, at, Ui(10.0f), colors::kWine, colors::kGold);
400 ImFont* font = GetFonts().title;
401 const float letter = Ui(13.0f);
402 const char* north = Tr("compass", "N");
403 const ImVec2 extent = font->CalcTextSizeA(letter, FLT_MAX, 0.0f, north);
404 draw->AddText(font, letter,
405 {at.x - extent.x / 2.0f, at.y - extent.y / 2.0f},
406 colors::kGoldLight, north);
407 continue;
408 }
409 draw->AddLine({centre.x + way.x * radius, centre.y + way.y * radius},
410 {centre.x + way.x * outer, centre.y + way.y * outer},
411 colors::kNight, Ui(2.0f));
412 }
413
414 // Where you are, in metres, under the ring.
415 const std::string place =
416 absl::StrCat(static_cast<int>(std::lround(you->position.x)), ", ",
417 static_cast<int>(std::lround(you->position.z)));
418 ImFont* bold = GetFonts().bold;
419 const float place_size = Ui(13.0f);
420 const ImVec2 place_extent =
421 bold->CalcTextSizeA(place_size, FLT_MAX, 0.0f, place.c_str());
423 draw, bold, place_size,
424 {centre.x - place_extent.x / 2.0f, centre.y + outer + Ui(4.0f)},
425 colors::kMuted, place.c_str());
426
427 // Zoom in and out, and the map, on the ring's lower half.
428 const auto on_ring = [&](float degrees) {
429 const float angle = degrees * kPi / 180.0f;
430 return ImVec2{centre.x + std::cos(angle) * (outer + Ui(2.0f)),
431 centre.y + std::sin(angle) * (outer + Ui(2.0f))};
432 };
433 if (RingButton("##in", on_ring(128.0f), ICON_FA_PLUS)) {
434 set_zoom(zoom_ - 1);
435 }
436 if (RingButton("##out", on_ring(150.0f), ICON_FA_MINUS)) {
437 set_zoom(zoom_ + 1);
438 }
439 const bool map = RingButton("##map", on_ring(45.0f), ICON_FA_MAP);
440 if (ImGui::IsItemHovered()) {
441 ImGui::SetTooltip("%s", Tr("Map (M)"));
442 }
443 // Scrolling over the disc zooms, as it would a map.
444 ImGui::SetCursorScreenPos({centre.x - radius, centre.y - radius});
445 ImGui::InvisibleButton("##disc", {radius * 2.0f, radius * 2.0f});
446 if (ImGui::IsItemHovered() && ImGui::GetIO().MouseWheel != 0.0f) {
447 set_zoom(zoom_ + (ImGui::GetIO().MouseWheel > 0.0f ? -1 : 1));
448 }
449 ImGui::End();
450 return map;
451}
452
453std::optional<Place> LandMap::DrawMap(const std::vector<Figure>& figures,
454 uint32_t target,
455 std::optional<Vector3> destination,
456 bool* open) const {
457 if (texture_.id == 0 || !*open) {
458 return std::nullopt;
459 }
460 const ImVec2 screen = ImGui::GetIO().DisplaySize;
461 const float size = std::min(screen.x, screen.y) * 0.72f;
462 ImGui::SetNextWindowPos({screen.x / 2, screen.y / 2}, ImGuiCond_Always,
463 {0.5f, 0.5f});
464 // Translators: $0 is the land's name, which this makes a title.
465 const std::string title = absl::StrCat(
466 absl::Substitute(Tr("The $0"), LandName(kLands[land_].name)), "###Map");
467 BeginPanel(title.c_str(), open,
468 ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove |
469 ImGuiWindowFlags_NoSavedSettings);
470 ImGui::Image(static_cast<ImTextureID>(texture_.id), {size, size});
471 const ImVec2 min = ImGui::GetItemRectMin();
472 const ImVec2 max = ImGui::GetItemRectMax();
473 const View view{.centre = {0.0f, 0.0f},
474 .origin = {(min.x + max.x) / 2, (min.y + max.y) / 2},
475 .scale = size / (2.0f * half_)};
476 std::optional<Place> clicked;
477 if (ImGui::IsItemHovered()) {
478 ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
479 if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
480 const ImVec2 mouse = ImGui::GetMousePos();
481 clicked = Place{.x = (mouse.x - view.origin.x) / view.scale,
482 .z = (mouse.y - view.origin.y) / view.scale};
483 }
484 }
485 ImDrawList* draw = ImGui::GetWindowDrawList();
486 draw->AddRect(min, max, colors::kBrass, 0.0f, 0, Ui(1.5f));
487 draw->PushClipRect(min, max, true);
488 DrawMarkers(draw, view, land_, figures, target, destination);
489 draw->PopClipRect();
490 EndPanel();
491 return clicked;
492}
493
494} // namespace nanommo
std::optional< Place > DrawMap(const std::vector< Figure > &figures, uint32_t target, std::optional< Vector3 > destination, bool *open) const
Definition map.cc:453
void set_zoom(int zoom)
Definition map.cc:338
void Build(const Terrain &terrain, int land)
Draws the land into the texture, in place of the last one.
Definition map.cc:324
static constexpr std::array< float, 3 > kZooms
In metres from you to the minimap's rim, at each of its zooms.
Definition map.h:33
bool DrawMinimap(const std::vector< Figure > &figures, uint32_t target, std::optional< Vector3 > destination, float heading, MinimapTurn turn)
Definition map.cc:342
int zoom() const
Definition map.h:56
float half_size() const
From the middle to each side of the grid.
Definition terrain.h:88
const std::vector< Tree > & trees() const
Definition terrain.h:75
static constexpr float kSeaLevel
Definition terrain.h:50
float Height(float x, float z) const
On the triangles between the grid's corners, as the client draws them.
Definition terrain.cc:102
Vector3 Place(const Point &point, const Terrain &terrain)
Definition film.cc:212
constexpr ImU32 kEmber
Definition theme.h:19
constexpr ImU32 kCrimson
Definition theme.h:17
constexpr ImU32 kGoldDark
Definition theme.h:23
constexpr ImU32 kGoldLight
Definition theme.h:22
constexpr ImU32 kNight
Definition theme.h:14
constexpr ImU32 kMuted
Definition theme.h:27
constexpr ImU32 kWine
Definition theme.h:16
constexpr ImU32 kPaper
Definition theme.h:26
constexpr ImU32 kBrass
The trim round every panel: gold gone dark with age.
Definition theme.h:25
constexpr ImU32 kGold
Definition theme.h:21
Definition chat.cc:9
bool BeginPanel(const char *name, bool *open, ImGuiWindowFlags flags, float alpha)
Definition theme.cc:320
constexpr std::array< Gate, 4 > kGates
Definition lands.h:45
constexpr std::array< Look, 3 > kLooks
In the order of the lands.
Definition atmosphere.h:164
Image DrawLand(const Terrain &terrain, int land)
Definition map.cc:269
float Ui(float points)
Definition theme.h:67
void EndPanel()
Definition theme.cc:379
const char * Tr(const char *text)
std::string LandName(std::string_view land)
Definition names.cc:92
MinimapTurn
Definition map.h:23
constexpr std::array< Land, 3 > kLands
Definition lands.h:31
Color GroundColor(const Look &look, float height, float up)
The surface's colour in the look.
Definition ground.cc:34
ImU32 Faded(ImU32 color, float share)
The same colour, with its alpha times the share.
Definition theme.cc:59
void DrawDiamond(ImDrawList *draw, ImVec2 centre, float radius, ImU32 fill, ImU32 outline)
A diamond, filled, with an outline.
Definition theme.cc:213
void DrawShadowedText(ImDrawList *draw, ImFont *font, float size, ImVec2 at, ImU32 color, const char *text)
Text with a shadow under it.
Definition theme.cc:272
const Fonts & GetFonts()
Definition theme.cc:66
ImFont * text
Definition theme.h:42
ImFont * bold
Definition theme.h:43
ImFont * title
Definition theme.h:44
A ring of stones in a land, which takes players to another.
Definition lands.h:38
Color deep
Out where it's deep. Its alpha is how much of the ground it hides.
Definition atmosphere.h:48
Color shallow
Where it's shallow, near the shore.
Definition atmosphere.h:50
A land's colours: its atmosphere, and the colours that go into its meshes.
Definition atmosphere.h:69
Color trees
Multiplies the colours of the trees' faces.
Definition atmosphere.h:77
In metres from the middle of a land.
Definition lands.h:13
What the players in a cell get: the players, monsters and NPCs near it.
Definition interest.h:45