Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
texture_manager.h
Go to the documentation of this file.
1 #ifndef TEXTURE_MANAGER_H
2 #define TEXTURE_MANAGER_H
3 #include <map>
4 #include <memory>
5 #include <string>
7 //= SCRIPTABLE
8 
9 namespace Graphics {
14  private:
15  std::map<std::string, std::shared_ptr<BaseTexture>> textures_to_names;
16  public:
25 
26  //= BEGIN SCRIPTABLE
27 
35  bool loadTexture(const std::string& path);
36 
44  std::shared_ptr<BaseTexture> operator[](const std::string& name) const;
52  std::shared_ptr<BaseTexture> getTexture(const std::string& name) const;
53 
61  bool textureExists(const std::string& name) const noexcept;
62  //= END SCRIPTABLE
63 
71  static std::string getNameFromPath(const std::string& path) noexcept;
72  };
73 }
74 
75 #endif
std::shared_ptr< BaseTexture > operator[](const std::string &name) const
Get's texture with name.
Definition: texture_manager.cpp:34
Class for texture manager.
Definition: texture_manager.h:13
bool textureExists(const std::string &name) const noexcept
Function to see if texture with name exists.
Definition: texture_manager.cpp:45
bool loadTexture(const std::string &path)
Loads a texture.
Definition: texture_manager.cpp:21
~TextureManager()
Destroys the object.
Definition: texture_manager.cpp:17
static std::string getNameFromPath(const std::string &path) noexcept
Gets the name from path.
Definition: texture_manager.cpp:52
std::shared_ptr< BaseTexture > getTexture(const std::string &name) const
Gets the texture.
Definition: texture_manager.cpp:38
TextureManager()
TextureManager constructor.
Definition: texture_manager.cpp:13