Add a read-only native live-ticker demo with finite fixtures (by Codex)

This commit is contained in:
Codex authored and Codex committed 2026-10-27 03:39:32 +01:00
1 parent 0a54b8338e
commit 8e3d9f83e0
17 files changed
+1601 -10

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "modern/ui/catalog.hpp"
#include <cstdint>
namespace bmh::modern_ui {
// A finite, authored presentation recording. No simulation, game state, RNG,
// calendar progression or source mutation is involved in constructing/reading it.
// Only catalogue identities and explicit owner presentation boards are reused.
Json make_demo_live(const Catalog &, const Json &state, uint64_t revision);
// Requests: {kind:"fixture",revision?:uint64}; or
// {kind:"frame",sequence:uint,fixture_id?:string,revision?:uint64}.
Json query_demo_live(const Catalog &, const Json &state, uint64_t revision,
const Json &request);
bool valid_live_fixture(const Json &);
Json live_fixture_frame(const Json &, size_t sequence);
// Playback belongs to the view, never to DataSource or a saved career. Elapsed
// time only reveals the next prerecorded snapshot; it cannot execute an action.
class LivePlayback {
public:
bool open(const Json &fixture, const std::string &owner = {});
void close();
bool next();
bool speed(int value); // 0 = pause, 1..4 = recording playback speed
bool elapse(uint64_t milliseconds);
bool owner(const std::string &id);
bool cycle_owner(int direction);
Json frame() const;
Json status() const;
const Json &fixture() const { return fixture_; }
size_t sequence() const { return sequence_; }
int speed() const { return speed_; }
const std::string &owner() const { return owner_; }
bool available() const { return fixture_.is_object(); }
bool finished() const;
private:
Json fixture_;
size_t sequence_ = 0;
int speed_ = 0;
uint64_t elapsed_ = 0;
std::string owner_;
};
} // namespace bmh::modern_ui