GAF Library
Generic Animation Format
 All Classes Functions Pages
GAFSprite.h
1 #pragma once
2 
3 #ifndef __GAF_SPRITE__
4 #define __GAF_SPRITE__
5 
6 #include "sprite_nodes/CCSprite.h"
7 #include "cocoa/CCAffineTransform.h"
8 #include <string>
9 
10 typedef struct _gafBlendFuncSeparate
11 {
12  // source blend function
13  GLenum src;
14  // destination blend function
15  GLenum dst;
16  // source alpha channel blend function
17  GLenum srcAlpha;
18  // destination alpha channel blend function
19  GLenum dstAlpha;
20 
22 
23 using namespace cocos2d;
24 
28 
29 class GAFSprite : public CCSprite
30 {
31 public:
32  GAFSprite();
33  void setExternaTransform(const CCAffineTransform& transform);
34  void setChildTransform(const CCAffineTransform& transform);
35  //virtual CCAffineTransform nodeToParentTransform(void);
36  std::string objectId;
37  virtual void draw();
38  virtual void setUniformsForFragmentShader();
39 
40  inline const CCAffineTransform &childTransform() const
41  {
42  return _childTransform;
43  }
44  const CCAffineTransform& getExternalTransform() const
45  {
46  return _externalTransform;
47  }
48  inline void setLocator(bool locator)
49  {
50  _isLocator = locator;
51  }
52  void setAtlasScale(float scale);
53  CCAffineTransform nodeToParentTransform(void);
54  void setTexture(CCTexture2D *texture);
55  bool initWithTexture(CCTexture2D *pTexture, const CCRect& rect, bool rotated);
56 protected:
57  CCAffineTransform _externalTransform;
58  CCAffineTransform _childTransform;
59  void invalidateTransformCache();
60 private:
61  gafBlendFuncSeparate _blendFuncSeparate;
62  bool _useSeparateBlendFunc;
63  bool _isLocator;
64  GLint _blendEquation;
65  float _atlasScale;
66 };
67 
68 
69 #endif // __GAF_SPRITE__
Definition: GAFSprite.h:29
Definition: GAFSprite.h:10