123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #ifndef __CCLABEL_ATLAS_H__
- #define __CCLABEL_ATLAS_H__
- #include "2d/CCAtlasNode.h"
- #if CC_LABELATLAS_DEBUG_DRAW
- #include "renderer/CCCustomCommand.h"
- #include "2d/CCDrawNode.h"
- #endif
- NS_CC_BEGIN
- class CC_DLL LabelAtlas : public AtlasNode, public LabelProtocol
- {
- public:
-
- static LabelAtlas* create();
-
-
- static LabelAtlas* create(const std::string& string, const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
-
-
- static LabelAtlas* create(const std::string& string, const std::string& fntFile);
-
- bool initWithString(const std::string& string, const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
-
-
- bool initWithString(const std::string& string, const std::string& fntFile);
-
-
- bool initWithString(const std::string& string, Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
-
- virtual void setString(const std::string &label) override;
- virtual const std::string& getString(void) const override;
- virtual void updateAtlasValues() override;
-
- virtual std::string getDescription() const override;
- #if CC_LABELATLAS_DEBUG_DRAW
- virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
- #endif
- CC_CONSTRUCTOR_ACCESS:
- LabelAtlas()
- :_string("")
- {
- #if CC_LABELATLAS_DEBUG_DRAW
- _debugDrawNode = DrawNode::create();
- addChild(_debugDrawNode);
- #endif
- }
- virtual ~LabelAtlas()
- {
- _string.clear();
- }
-
- protected:
- virtual void updateColor() override;
- #if CC_LABELATLAS_DEBUG_DRAW
- DrawNode *_debugDrawNode;
- #endif
-
- std::string _string;
-
- int _mapStartChar;
- };
- NS_CC_END
- #endif
|