yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
resolved_graphics_context_view.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_RESOLVED_GRAPHICS_CONTEXT_VIEW_H_
2#define YAZE_APP_EDITOR_GRAPHICS_RESOLVED_GRAPHICS_CONTEXT_VIEW_H_
3
4#include "absl/strings/str_format.h"
7
8namespace yaze::editor {
9
10// Copies one resolved graphics context into the inspector snapshot.
12 EditorContextSnapshot& snapshot,
13 const zelda3::ResolvedGraphicsContext& context) {
14 if (!context.graphics_loaded) {
15 snapshot.diagnostics.push_back({
16 .id = "gfx.not_loaded",
18 .message = "Graphics slots are not loaded for this selection yet.",
19 });
20 return;
21 }
22 snapshot.metadata.push_back(
23 {.id = "gfx.project", .label = "Project", .value = context.project_name});
24 snapshot.metadata.push_back({.id = "gfx.rom_sha256",
25 .label = "ROM SHA-256",
26 .value = context.rom_sha256});
27 snapshot.metadata.push_back(
28 {.id = "gfx.revision",
29 .label = "Graphics revision",
30 .value = std::to_string(context.graphics_revision)});
31 snapshot.metadata.push_back({.id = "gfx.fingerprint",
32 .label = "Graphics fingerprint",
33 .value = context.graphics_fingerprint});
34 snapshot.metadata.push_back({.id = "gfx.terrain_catalog",
35 .label = "Terrain catalog",
36 .value = context.terrain_catalog});
37 for (const auto& slot : context.slots) {
38 snapshot.metadata.push_back({
39 .id = absl::StrFormat("gfx.slot.%02d", slot.slot),
40 .label = slot.role,
41 .value = absl::StrFormat("0x%02X %s", slot.sheet_id, slot.source),
42 });
43 }
44 for (const auto& palette : context.palettes) {
45 snapshot.metadata.push_back({
46 .id = absl::StrFormat("gfx.palette.%s", palette.name),
47 .label = palette.name,
48 .value = absl::StrFormat("0x%X %s%s", palette.selector, palette.source,
49 palette.inherited ? " inherited" : ""),
50 });
51 }
52 for (const auto& alternate : context.alternates) {
53 snapshot.metadata.push_back({
54 .id = absl::StrFormat("gfx.alternate.%s", alternate.name),
55 .label = alternate.name,
56 .value = alternate.state,
57 });
58 }
59}
60
61} // namespace yaze::editor
62
63#endif // YAZE_APP_EDITOR_GRAPHICS_RESOLVED_GRAPHICS_CONTEXT_VIEW_H_
Editors are the view controllers for the application.
void AppendResolvedGraphicsContext(EditorContextSnapshot &snapshot, const zelda3::ResolvedGraphicsContext &context)
std::vector< EditorContextDiagnostic > diagnostics
std::vector< EditorContextValue > metadata
std::vector< ResolvedPaletteSource > palettes
std::vector< ResolvedAlternateContext > alternates
std::vector< ResolvedGraphicsSlot > slots