YAPOG  0.0.1
Yet Another Pokemon Online Game
ContentManager.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_CONTENTMANAGER_HPP
2 # define YAPOG_CONTENTMANAGER_HPP
3 
4 # include <SFML/Graphics/Image.hpp>
5 # include <SFML/Graphics/Texture.hpp>
6 # include <SFML/Graphics/Font.hpp>
7 # include <SFML/Audio/SoundBuffer.hpp>
8 # include <SFML/Audio/Music.hpp>
9 
10 # include "YAPOG/Macros.hpp"
11 # include "YAPOG/System/String.hpp"
12 # include "YAPOG/Collection/Map.hpp"
13 # include "YAPOG/System/Path.hpp"
14 # include "YAPOG/System/IOStream.hpp"
15 
16 namespace yap
17 {
18  class ID;
19 
21  {
23 
24  public:
25 
26  static ContentManager& Instance ();
27 
28  void Init (const Path& rootPath);
29  const Path& GetContentPath () const;
30 
31  void SetImagePath (const Path& path);
32  void SetTexturePath (const Path& path);
33  void SetFontPath (const Path& path);
34  void SetSoundBufferPath (const Path& path);
35  void SetMusicPath (const Path& path);
36 
37  sf::Image& LoadImage (const String& name);
38  sf::Texture& LoadTexture (const String& name);
39  sf::Font& LoadFont (const String& name);
40  sf::SoundBuffer& LoadSoundBuffer (const String& name);
41  sf::Music& LoadMusic (const String& name);
42 
43  void UnloadImage (const String& name);
44  void UnloadTexture (const String& name);
45  void UnloadFont (const String& name);
46  void UnloadSoundBuffer (const String& name);
47  void UnloadMusic (const String& name);
48 
49  IFStream& LoadFile (const String& name, IFStream& iFStream);
50  IFStream& LoadFile (
51  const Path& rootPath,
52  const ID& id,
53  IFStream& iFStream);
54 
55  private:
56 
57  ContentManager (const Path& rootPath);
58  ~ContentManager ();
59 
60  static const Path DEFAULT_ROOT_PATH;
61  static const Path DEFAULT_IMAGE_PATH;
62  static const Path DEFAULT_TEXTURE_PATH;
63  static const Path DEFAULT_FONT_PATH;
65  static const Path DEFAULT_MUSIC_PATH;
66 
68 
70 
76 
82  };
83 } // namespace yap
84 
85 #endif // YAPOG_CONTENTMANAGER_HPP