dEngine
Simple 2D C++ game engine
Public Member Functions | Private Attributes | List of all members
dengine::GameSave Class Referenceabstract

A GameSave file GameSave is an abstract class that should be overwritten by the Game code. The purpose of gamesave is to provide a method of saving a game. This used in combination with a GameLevel's Serialize and Deserialize functions should allow for an easy method of saving and loading. More...

#include <GameSave.h>

Public Member Functions

 GameSave ()
 
 ~GameSave ()
 
virtual void Write (const std::string filename)=0
 Function to write the savegame to disk. More...
 
virtual void Read (const std::string filename)=0
 Function to read a savegame from disk. More...
 
void AddObject (GameObject *object)
 Add an object to the Objects vector to be saved. More...
 
std::vector< GameObject * > GetObjects ()
 Returns a vector containing all currently stored objects. More...
 

Private Attributes

std::vector< GameObject * > Objects
 Objects to be saved. More...
 

Detailed Description

A GameSave file GameSave is an abstract class that should be overwritten by the Game code. The purpose of gamesave is to provide a method of saving a game. This used in combination with a GameLevel's Serialize and Deserialize functions should allow for an easy method of saving and loading.

Deprecated:
Marking this as deprecated because as mentioned in the Serializer documentation, I wasn't able to get the save/load system working quite right. If I happen to shift my attention back here and get it working we may keep it but may not. As such, don't count on it being here in the future.

Constructor & Destructor Documentation

◆ GameSave()

dengine::GameSave::GameSave ( )

◆ ~GameSave()

dengine::GameSave::~GameSave ( )
inline

Member Function Documentation

◆ AddObject()

void dengine::GameSave::AddObject ( GameObject object)
inline

Add an object to the Objects vector to be saved.

Parameters
objectObject to be saved
See also
Objects

◆ GetObjects()

std::vector<GameObject*> dengine::GameSave::GetObjects ( )
inline

Returns a vector containing all currently stored objects.

Returns
Vector with all stored objects

◆ Read()

virtual void dengine::GameSave::Read ( const std::string  filename)
pure virtual

Function to read a savegame from disk.

Read is an abstruct funtion that has to be overwritten. This function is to read a save from disk into memory.

Parameters
filenameThe filename

Referenced by ~GameSave().

◆ Write()

virtual void dengine::GameSave::Write ( const std::string  filename)
pure virtual

Function to write the savegame to disk.

Write is an abstruct funtion that has to be overwritten. This function is to write a save to disk.

Parameters
filenameThe filename

Referenced by ~GameSave().

Member Data Documentation

◆ Objects

std::vector<GameObject*> dengine::GameSave::Objects
private

Objects to be saved.

Referenced by AddObject(), GetObjects(), and ~GameSave().