126 std::optional<Screen> screen;
131 screen =
state.currentScreen;
133 const unsigned scale = presentation ? 3 : 1;
134 const bool viewChanged = screen != lastScreen_ ||
state.quickHelpVisible != lastQuickHelp_;
141 return std::unexpected(
"sequence command queue cannot fit Options visual transition");
144 std::vector<std::pair<data::DataId, data::LegacyBitmapRGBA8>>
pendingImages;
147 -> std::expected<void, std::string>
149 if (!surfaces_[
index])
165 if (!
font || !
font->ready())
return std::unexpected(
"Options font runtime unavailable");
166 if (
auto selected =
font->restoreSettings(0); !selected)
return std::unexpected(selected.error().detail);
168 const auto resources =
playback.resources();
169 if (!resources)
return std::unexpected(
"Options resources unavailable");
173 return std::unexpected(
sized.error().detail);
174 font->setWeight(700);
178 auto settings =
font->settings(); settings.size *= 3;
179 if (!presentationFont_) presentationFont_ = std::make_shared<fonts::Runtime>();
180 if (!presentationFont_->ready() || presentationFont_->settings().fontPath != settings.fontPath)
181 if (
auto selected = presentationFont_->setFont(settings.fontPath, settings.familyName); !selected)
182 return std::unexpected(selected.error().detail);
183 if (presentationFont_->settings().size != settings.size)
184 if (
auto sized = presentationFont_->setSize(settings.size); !
sized)
185 return std::unexpected(
sized.error().detail);
186 presentationFont_->setWeight(settings.weight);
187 presentationFont_->setItalic(settings.italic);
188 presentationFont_->setUnderline(settings.underline);
189 presentationFont_->setStrikeOut(settings.strikeOut);
195 if (!changed && lastTune_ ==
state.musicTuneIndex)
return {};
200 if (!
text)
return std::unexpected(
text.error());
211 if (!
lines)
return std::unexpected(
lines.error());
212 int y =
lines->size() > 1 ? 0 : 5;
213 for (
const auto& line : *
lines)
228 if (!
image)
return std::unexpected(
image.error().detail);
229 state.musicChoiceRects[
index] = {163,
y, 163 +
static_cast<int>(
image->width),
y +
static_cast<int>(
image->height)};
230 const int height =
static_cast<int>(
image->height);
244 const auto resources =
playback.resources();
245 if (!resources)
return std::unexpected(
"Options credits resources unavailable");
247 if (!credits_ || credits_->dataId !=
id)
249 const auto metadata = resources->data().metadata(
id);
251 const auto bytes = resources->data().load(
id);
252 if (!
bytes)
return std::unexpected(
bytes.error().detail);
254 if (!asset)
return std::unexpected(asset.error().detail);
258 int y =
creditsScrollY(tick >= creditsStart_ ? tick - creditsStart_ : 0);
259 if (
y +
static_cast<int>(credits_->image.height) <= 0)
261 creditsStart_ = tick;
264 if (!changed &&
y == lastCreditY_)
return {};
265 auto image =
blank(
static_cast<int>(credits_->image.width), 486);
274 if (!changed && lastHelpLine_ ==
state.quickHelpFirstLine && !
state.quickHelpLines.empty())
return {};
278 if (
state.quickHelpLines.empty())
282 if (!
lines)
return std::unexpected(
lines.error());
284 state.quickHelpFirstLine = 0;
285 state.quickHelpPageIndex = 0;
286 state.quickHelpPageOffsets.assign(2, 0);
287 state.quickHelpInitialPage =
true;
290 state.quickHelpLines.size(),
state.quickHelpFirstLine,
292 if (
state.quickHelpPageOffsets.size() <
state.quickHelpPageIndex + 2)
293 state.quickHelpPageOffsets.resize(
state.quickHelpPageIndex + 2);
296 for (std::size_t
index =
state.quickHelpFirstLine;
303 constexpr std::array<std::uint32_t, 3>
ids{3170, 3169, 932};
304 constexpr std::array<int, 3>
xs{100, 650, 400};
308 if (!
text)
return std::unexpected(
text.error());
310 if (!
button)
return std::unexpected(
button.error().detail);
312 state.quickHelpLinesPerPage > 0 &&
313 state.quickHelpFirstLine +
state.quickHelpLinesPerPage <
state.quickHelpLines.size());
330 return std::unexpected(
"sequence command queue cannot fit Options visual update");
333 std::optional<std::array<float,4>>
rect;
336 const auto extent =
playback.runtimeBitmaps().extent(
id);
337 rect = std::array<float,4>{0,0,
float(extent->width),
float(extent->height)};
339 if (
auto updated =
playback.runtimeBitmaps().update(
id, std::move(
image),
rect, presentation); !updated)
349 [
id](
const auto&
value) { return value.id == id; });
350 if (
object ==
desired.end())
continue;
358 return std::unexpected(
"sequence command queue cannot fit Options visual objects");
359 std::vector<std::shared_ptr<const sequence::SequenceProgram>>
programs;
360 for (
const auto&
object :
desired)
363 if (!program)
return std::unexpected(program.error().detail);
366 for (
const auto&
object : published_)
368 return std::unexpected(
"validated Options visual stop rejected");
374 return std::unexpected(
"validated Options visual start rejected");
376 published_ = std::move(
desired);
378 lastScreen_ = screen;
379 lastQuickHelp_ =
state.quickHelpVisible;
381 lastTune_ =
state.musicTuneIndex;
382 lastHelpLine_ =
state.quickHelpFirstLine;
LegacyBitmapMetadata metadata
std::vector< std::byte > bytes