GAF Library
Generic Animation Format
 All Classes Functions Pages
GAFTextureAtlas.h
1 #pragma once
2 
3 #ifndef __GAF_TEXTURE_ATLAS___
4 #define __GAF_TEXTURE_ATLAS___
5 
8 
10 {
11 public:
12 
13  struct AtlasInfo
14  {
15  struct Source
16  {
17  std::string source;
18  float csf;
19  };
20 
21  typedef std::vector<Source> Sources_t;
22 
23  Sources_t m_sources;
24  unsigned int id;
25  };
26 
27  typedef std::vector<AtlasInfo> AtlasInfos_t;
28  typedef std::map<unsigned int, GAFTextureAtlasElement*> Elements_t;
29 
31 private:
32 
33  float m_scale;
34  AtlasInfos_t m_atlasInfos;
35  Elements_t m_elements;
36 
37  bool _loaded;
38  cocos2d::__Array * _images;
39  cocos2d::__Array * _textures;
40 public:
41  ~GAFTextureAtlas();
42 
43  void pushAtlasInfo(const AtlasInfo& ai);
44  void pushElement(unsigned int idx, GAFTextureAtlasElement* el);
45 
46  void loadImages(const std::string& dir, GAFTextureLoadDelegate* delegate);
47 
48  inline bool loaded() const
49  {
50  return _loaded;
51  }
52 
53  void setScale(float val);
54  float getScale() const;
55 
56  cocos2d::Image * image();
57  cocos2d::__Array * images();
58 
59  cocos2d::Texture2D * texture();
60  cocos2d::__Array * textures();
61 
62  const Elements_t& getElements() const;
63 };
64 
65 #endif // __GAF_TEXTURE_ATLAS___
Definition: GAFTextureAtlas.h:15
Definition: GAFTextureAtlas.h:9
Definition: GAFDelegates.h:20
Definition: GAFTextureAtlasElement.h:6
Definition: GAFTextureAtlas.h:13