Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
ModernTokenPreview.hpp
Go to the documentation of this file.
1#pragma once
2#include "LegacyBitmap.hpp"
4#include <array>
5#include <filesystem>
6#include <future>
7#include <memory>
8#include <optional>
9
10namespace monopoly::menu
11{
12 // Optional presentation pixels only; the owning retail CNK supplies clocks.
14 {
15 public:
16 explicit ModernTokenPreview(std::filesystem::path root) : root_(std::move(root)) {}
17 ~ModernTokenPreview() = default; // The sole future joins; its task never captures this.
19 [[nodiscard]] PackState packState(std::uint8_t token) const noexcept;
20 [[nodiscard]] std::shared_ptr<const data::LegacyBitmapRGBA8>
21 image(std::uint8_t token, std::uint8_t frame) noexcept;
22 private:
23 using Pack = std::array<std::shared_ptr<const data::LegacyBitmapRGBA8>, 28>;
24 struct PackResult { Pack frames{}; bool complete{}; };
25 [[nodiscard]] static PackResult loadPack(std::filesystem::path directory) noexcept;
26 [[nodiscard]] static std::shared_ptr<const data::LegacyBitmapRGBA8>
27 decode(const std::filesystem::path& path);
28 std::filesystem::path root_;
29 std::optional<std::uint8_t> activeToken_;
30 Pack frames_{};
31 std::future<PackResult> pending_;
32 std::optional<std::uint8_t> pendingToken_;
33 std::array<bool, data::ModernTokenCount> failedPacks_{}, attemptedThumbnails_{};
34 std::array<std::shared_ptr<const data::LegacyBitmapRGBA8>, data::ModernTokenCount> thumbnails_{};
35 };
36}
std::size_t root
LegacyBitmapRGBA8 image
unsigned index
int token
std::size_t frame
std::filesystem::path directory
std::string path
ModernTokenPreview(std::filesystem::path root)
PackState packState(std::uint8_t token) const noexcept
constexpr std::size_t ModernTokenCount