Game Develop C++ Platform: RessourcesLoader.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
RessourcesLoader.h
Go to the documentation of this file.
1
6 #if defined(GD_IDE_ONLY)
7 #include "GDCore/PlatformDefinition/RessourcesLoader.h"
8 #else
9 //Use a custom implementation at Runtime.
10
11 #ifndef RESSOURCESLOADER_H
12 #define RESSOURCESLOADER_H
13
14 #include "GDCpp/DatFile.h"
15 class Music;
16 #include <SFML/Graphics.hpp>
17 #include <SFML/Audio.hpp>
18 #include <string>
19 #undef LoadImage //Undef macro from windows.h
20
21 namespace gd
22 {
23
29 class GD_API RessourcesLoader
30 {
31 public:
32
36 sf::Texture * LoadSFMLTexture( const std::string & filename );
37
41 sf::Font * LoadFont( const std::string & filename );
42
46 sf::SoundBuffer LoadSoundBuffer( const std::string & filename );
47
51 std::string LoadPlainText( const std::string & filename );
52
58 char* LoadBinaryFile( const std::string & filename );
59
63 long int GetBinaryFileSize( const std::string & filename);
64
69 bool HasFile(const std::string & filename);
70
75 bool SetResourceFile( const string & filename );
76
77 static RessourcesLoader *GetInstance()
78 {
79 if ( NULL == _singleton )
80 {
81 _singleton = new RessourcesLoader;
82 }
83
84 return ( static_cast<RessourcesLoader*>( _singleton ) );
85 }
86
87 static void DestroySingleton()
88 {
89 if ( NULL != _singleton )
90 {
91 delete _singleton;
92 _singleton = NULL;
93 }
94 }
95 private:
96 RessourcesLoader() {};
97 virtual ~RessourcesLoader() {};
98
99 DatFile resFile;
100
101 static RessourcesLoader *_singleton;
102 };
103
104 }
105
106 #endif // RESSOURCESLOADER_H
107
108 #endif