staging some future refactoring, .h -> hpp, fix for rendering w/ audio

This commit is contained in:
2026-03-09 23:08:57 -04:00
parent 77f6e65b15
commit 2d27b7e8fb
76 changed files with 0 additions and 0 deletions

71
src/snapshots.hpp Normal file
View File

@@ -0,0 +1,71 @@
#pragma once
#include <deque>
#include <optional>
#include "anm2/anm2.h"
#include "playback.h"
#include "storage.h"
namespace anm2ed::snapshots
{
constexpr auto ACTION = "Action";
constexpr auto MAX = 20;
};
namespace anm2ed
{
class Snapshot
{
public:
Playback playback{};
Storage animation{};
Storage event{};
Storage frames{};
Storage items{};
Storage layer{};
Storage merge{};
Storage null{};
Storage region{};
Storage sound{};
Storage spritesheet{};
anm2::Anm2 anm2{};
anm2::Reference reference{};
float frameTime{};
std::string message = snapshots::ACTION;
};
class SnapshotStack
{
public:
SnapshotStack() = default;
bool is_empty();
void push(const Snapshot&);
std::optional<Snapshot> pop();
void clear();
void trim_to_limit();
static void max_size_set(int);
static int max_size_get();
private:
static int maxSize;
std::deque<Snapshot> stack;
};
class Snapshots
{
public:
SnapshotStack undoStack{};
SnapshotStack redoStack{};
Snapshot current{};
Snapshot* get();
void push(const Snapshot&);
void undo();
void redo();
void reset();
void apply_limit();
};
}