dEngine
Simple 2D C++ game engine
GameSave.h
Go to the documentation of this file.
1 #ifndef DENGINE_GAMESAVE_H
2 #define DENGINE_GAMESAVE_H
3 
4 #include <string>
5 #include "GameLevel.h"
6 
7 namespace dengine{
17  class GameSave{
18  public:
19  GameSave();
21  Objects.clear();
22  }
29  virtual void Write(const std::string filename) = 0;
30 
37  virtual void Read(const std::string filename) = 0;
38 
44  void AddObject(GameObject* object){
45  Objects.push_back(object);
46  }
47 
52  std::vector<GameObject*> GetObjects(){
53  return Objects;
54  }
55  private:
59  std::vector<GameObject*> Objects;
60  };
61 }
62 
63 #endif //DENGINE_GAMESAVE_H
virtual void Read(const std::string filename)=0
Function to read a savegame from disk.
std::vector< GameObject * > Objects
Objects to be saved.
Definition: GameSave.h:59
A GameSave file GameSave is an abstract class that should be overwritten by the Game code...
Definition: GameSave.h:17
A base object for a game The gameobject can be considered the most basic building block of a game...
Definition: GameObject.h:19
virtual void Write(const std::string filename)=0
Function to write the savegame to disk.
void AddObject(GameObject *object)
Add an object to the Objects vector to be saved.
Definition: GameSave.h:44
~GameSave()
Definition: GameSave.h:20
The namespace containing the engine&#39;s code.
Definition: Collider.h:9
std::vector< GameObject * > GetObjects()
Returns a vector containing all currently stored objects.
Definition: GameSave.h:52