20 constexpr std::uint32_t
White = 0x00FFFFFFU;
21 constexpr std::uint32_t
Black = 0x00000000U;
38 result.pixels.assign(
static_cast<std::size_t
>(
width) *
height * 4U, 0
U);
45 std::string_view
text,
49 if (
text.empty())
return {};
59 std::string_view
text,
63 if (
text.empty())
return {};
74 if (!resources)
return std::unexpected(
"auction text has no resource snapshot");
75 const auto language =
resources->language();
76 if (!language || !language->catalog)
77 return std::unexpected(
"auction text has no language catalog");
79 if (!
text)
return std::unexpected(
text.error().detail);
84 std::expected<void, std::string> TextPlayback::ensureSurfaces(
89 -> std::expected<void, std::string>
120 std::vector<Published>
desired;
122 std::vector<std::pair<data::DataId, data::LegacyBitmapRGBA8>>
pendingImages;
129 if (currentObjects_.empty())
return {};
134 return std::unexpected(
"auction text player count exceeds retail maximum");
136 return std::unexpected(
"auction text font runtime is unavailable");
140 const auto resources =
playback.resources();
141 if (!resources)
return std::unexpected(
"auction text has no resources");
142 const auto edition = resources->context().board;
144 if (!currentBidLabel_)
147 if (!
label)
return std::unexpected(
label.error());
148 currentBidLabel_ = *
label;
151 state.highestBid, monetarySystem,
true, edition);
152 if (!amount)
return std::unexpected(amount.error());
158 if (!currentBidCache_ || *currentBidCache_ !=
currentKey)
171 desired.push_back({*currentBidSurface_,
175 const auto count = std::min<rules::PlayerNumber>(
180 const auto index =
static_cast<std::size_t
>(player);
181 const auto priority =
static_cast<std::uint16_t
>(
183 const int center =
state.backdropCenterX[
index];
200 state.bids[
index], monetarySystem,
false, edition);
201 if (!
bid)
return std::unexpected(
bid.error());
214 monetarySystem,
true, edition);
215 if (!cash)
return std::unexpected(cash.error());
216 if (!cashCache_[
index] || *cashCache_[
index] != *cash)
238 return std::unexpected(
"sequence command queue cannot fit auction text update");
240 if (
auto updated =
playback.runtimeBitmaps().update(
id, std::move(
image)); !updated)
247 if (
desired == currentObjects_)
252 [
id](
const auto&
value) { return value.id == id; });
253 if (
object ==
desired.end())
continue;
260 std::vector<std::shared_ptr<const sequence::SequenceProgram>>
programs;
262 for (
const auto&
object :
desired)
266 if (!program)
return std::unexpected(program.error().detail);
267 programs.push_back(std::move(*program));
273 return std::unexpected(
"sequence command queue cannot fit auction text transition");
275 for (
const auto&
object : currentObjects_)
278 object.id,
object.
priority,
false}))
279 return std::unexpected(
"validated auction text stop rejected");
285 programs[index], object.priority, {},
287 return std::unexpected(
"validated auction text start rejected");
289 currentObjects_ = std::move(
desired);
295 currentBidSurface_.reset();
296 nameSurfaces_.fill(std::nullopt);
297 bidSurfaces_.fill(std::nullopt);
298 cashSurfaces_.fill(std::nullopt);
299 currentObjects_.clear();
300 currentBidCache_.reset();
301 nameCache_.fill(std::nullopt);
302 bidCache_.fill(std::nullopt);
303 cashCache_.fill(std::nullopt);
304 currentBidLabel_.reset();
std::expected< void, std::string > sync(const State &state, const rules::GameState &gameState, display::Screen2D desiredView, int monetarySystem, fonts::Runtime *fontRuntime, engine::SequencePlayback &playback)
static constexpr std::size_t Capacity
static std::expected< std::shared_ptr< const SequenceProgram >, RuntimeError > rawBitmap(data::DataId id, data::LegacyDataType sourceType, DescriptionLimits limits={})
constexpr std::uint16_t AuctionPropertyPriority
constexpr int BackdropSmallWidth
constexpr std::uint16_t AuctionBasePriority
constexpr std::int32_t AuctionBidTextWidth
bool playerPanelWanted(const State &state, rules::PlayerNumber numberOfPlayers, display::Screen2D desiredView, rules::PlayerNumber player) noexcept
constexpr std::int32_t AuctionBidTextHeight
constexpr std::int32_t AuctionBidTextY
std::expected< std::string, Error > transcodeUtf8(std::u16string_view text)
std::expected< std::string, std::string > format(std::int64_t defaultValue, int monetarySystem, bool printSymbol, data::BoardEdition edition)
std::uint8_t PlayerNumber
constexpr PlayerNumber MaxPlayers
SequenceTransform moveXYTransform(std::int32_t x, std::int32_t y) noexcept
std::shared_ptr< const data::ResourceSnapshot > resources() noexcept