EreliaStudio / SparkleOld

Graphical library for game development
MIT License
4 stars 0 forks source link

Creating Memento class #29

Closed EreliaStudio closed 1 year ago

EreliaStudio commented 1 year ago

The Memento is a templated class that must allow user to take "snapshot" of the template type, and must allow the user to "load" those snapshot back. The idea is to create a system allowing rewind of a set of event.

Interface proposition:

template <typename TType>
class Memento
{
public:
    class Snapshot
    {
    public:
        void save(const TType* p_objectToCapture) = 0;
        void load(TType* p_objectToRestore) = 0;
    };
private:

public:
    Snapshot* takeSnapshot();
    void restoreSnapshot(const Snapshot* p_snapshot);
};
EreliaStudio commented 1 year ago

Pull request accepted, we can close this Issue