Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
OptionsVisualPlayback.hpp
Go to the documentation of this file.
1#pragma once
2#include "OptionsUI.hpp"
4#include <optional>
5#include <string_view>
6#include <vector>
7namespace monopoly::fonts { class Runtime; }
9{
10 inline constexpr std::array<std::uint32_t, 9> OptionLabelTextIds{
11 3191, 3209, 3192, 3210, 3211, 3212, 3193, 3194, 3195};
12 inline constexpr std::array<std::string_view, 5> MusicNames{
13 "Let's Play Monopoly!", "Railroad Serenade", "Take a Chance", "Park Place Stroll", "C Notes"};
15 {
17 edition == data::BoardEdition::Usa ? 0x07FB : 0x0989);
18 }
19 [[nodiscard]] constexpr int creditsScrollY(std::uint64_t elapsedTicks) noexcept
20 { return 486 - static_cast<int>((elapsedTicks / 5U) * 2U); }
21
22 // UDStats_GetCharsFromString/PrintString: control bytes end a line, LF is
23 // consumed without a row, other controls consume an empty row.
24 [[nodiscard]] std::expected<std::vector<std::string>, std::string> wrapOptionsText(
25 fonts::Runtime& font, std::string_view text, int width, bool replaceUnderscores);
26
28 {
29 public:
30 // Modern text uses3x AA; Help/Credits render on foreground layer11.
31 // Fixed-profile refreshes retain roots. Changing this profile may restart
32 // foreground UI roots; native layout and Credits scroll cadence remain fixed.
33 [[nodiscard]] std::expected<void, std::string> sync(State& state,
34 display::Screen2D view, std::uint64_t tick, fonts::Runtime* fontRuntime,
36 void reset() noexcept;
37 private:
38 struct Object
39 {
40 data::DataId id{};
41 std::uint16_t priority{};
42 int x{}, y{};
43 bool operator==(const Object&) const = default;
44 };
45 std::array<std::optional<data::DataId>, 19> surfaces_{};
46 std::vector<Object> published_;
47 std::optional<Screen> lastScreen_;
48 bool lastQuickHelp_{};
49 bool lastPresentation_{};
50 std::shared_ptr<fonts::Runtime> presentationFont_;
51 int lastTune_{-1};
52 std::size_t lastHelpLine_{static_cast<std::size_t>(-1)};
53 std::uint64_t creditsStart_{};
54 int lastCreditY_{-1};
55 std::shared_ptr<const data::BitmapRuntimeAsset> credits_;
56 data::BitmapRuntimeCache bitmapCache_;
57 };
58}
std::string_view text
fonts::Runtime & font
std::uint16_t priority
std::uint32_t width
unsigned state
unsigned index
std::expected< void, std::string > sync(State &state, display::Screen2D view, std::uint64_t tick, fonts::Runtime *fontRuntime, engine::SequencePlayback &playback, bool modernPresentation=false)
std::uint32_t DataId
Definition DataBanks.hpp:10
constexpr DataId packDataId(std::uint16_t group, DataTag tag) noexcept
Definition DataBanks.hpp:39
constexpr std::array< std::string_view, 5 > MusicNames
constexpr int creditsScrollY(std::uint64_t elapsedTicks) noexcept
constexpr std::array< std::uint32_t, 9 > OptionLabelTextIds
std::expected< std::vector< std::string >, std::string > wrapOptionsText(fonts::Runtime &font, std::string_view text, int width, bool replaceUnderscores)
constexpr data::DataId creditsBitmap(data::BoardEdition edition) noexcept