All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IconSet.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "IconDefinition.h"
7 #include "AsyncTexturing.h"
8 #include <vector>
9 #include <string>
10 
11 namespace Eegeo
12 {
13  namespace Icons
14  {
16  {
17  IconSetTexturePageInfo(const std::string& fileName, int width, int height)
18  : textureFileName(fileName)
19  , textureWidth(width)
20  , textureHeight(height)
21  {}
22 
23  std::string textureFileName;
24  int textureWidth;
25  int textureHeight;
26  };
27 
28  class IconSet : private Eegeo::NonCopyable
29  {
30  public:
31 
32  typedef std::string TIdType;
33  typedef std::vector<Rendering::AsyncTexturing::IAsyncTexture*> TTextureList;
34  typedef std::vector<IconSetTexturePageInfo> TTexturePageInfoList;
35 
36  IconSet(const TIdType& id,
37  IconDefinitionRepository* pIconDefinitions,
38  const TTexturePageInfoList& texturePageInfoList,
40  ~IconSet();
41 
42  const TIdType& GetId() const { return m_id; }
43  bool HasIconDefinition(const IconDefinition::IdType& key) const;
44  const IconDefinition& GetIconDefinition(const IconDefinition::IdType& key) const;
45  const TTextureList& GetTextureList() const { return m_textureList; }
46  const TTexturePageInfoList& GetTexturePageInfoList() const { return m_texturePageInfoList; }
47 
48  private:
49 
50  void UnloadTextures();
51  void ClearDefinitions();
52 
53  void Validate(int textureCount);
54  void LoadIconSetPageTextures(Rendering::AsyncTexturing::IAsyncTextureRequestor& asyncTextureRequestor,
55  const TTexturePageInfoList& textureNames);
56 
57  TIdType m_id;
58  IconDefinitionRepository* m_pIconDefinitions;
59  TTextureList m_textureList;
60  TTexturePageInfoList m_texturePageInfoList;
61 
62  };
63  }
64 }