16 constexpr std::array<data::DataTag, 3>
BaseTags{0x01BE, 0x01BD, 0x01B9};
51 if (!amount)
return std::unexpected(amount.error());
61 monetarySystem_ != monetarySystem || edition_ != edition))
64 if (!amount)
return std::unexpected(amount.error());
68 const std::array<bool, 4>
desired{
77 return std::unexpected(
"IBar runtime text transition exceeds command capacity");
79 std::array<std::optional<data::LegacyBitmapRGBA8>, 4>
images;
81 std::array<std::string, 4>
text;
86 for (
const auto& square : game.
squares)
89 text[0] = std::to_string(houses);
text[1] = std::to_string(
hotels);
90 for (std::size_t
i = 0;
i < 2; ++
i)
107 for (std::size_t
i = 0;
i <
desired.size(); ++
i)
112 if (!
font || !
font->ready())
return std::unexpected(
"IBar runtime text requires a ready font");
114 if (
const auto sized =
font->setSize(12); !
sized)
return std::unexpected(
sized.error().detail);
115 font->setWeight(
i == 3 ? 900 : 700);
116 font->setItalic(
false);
font->setUnderline(
false);
font->setStrikeOut(
false);
120 const auto resources =
playback.resources();
121 if (!resources)
return std::unexpected(
"IBar runtime text requires resources");
123 const auto metadata = resources->data().metadata(
id);
125 const auto bytes = resources->data().load(
id);
126 if (!
bytes)
return std::unexpected(
bytes.error().detail);
128 if (!
base)
return std::unexpected(
base.error().detail);
129 image = (*base)->image;
130 if (
i == 2) std::fill(
image.pixels.begin(),
image.pixels.end(), 0);
149 for (std::size_t
i = 0;
i <
desired.size(); ++
i)
159 const auto updated =
playback.runtimeBitmaps().update(
160 surfaces_[
i], std::move(*
images[
i]));
161 if (!updated)
return std::unexpected(updated.error());
173 if (!started)
return started;
178 if (!stopped)
return stopped;
184 monetarySystem_ = monetarySystem; edition_ = edition;
LegacyBitmapMetadata metadata
std::vector< std::byte > bytes
std::expected< void, std::string > sync(const rules::GameState &game, const State &ui, const RuleProjection &projection, bool visible, bool propertyBar, rules::PlayerNumber activePlayer, std::uint64_t tick, int monetarySystem, data::BoardEdition edition, fonts::Runtime *font, engine::SequencePlayback &playback, bool modernPresentation=false)