123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- #ifndef __CCBITMAP_FONT_ATLAS_H__
- #define __CCBITMAP_FONT_ATLAS_H__
- #include "2d/CCLabel.h"
- #if CC_LABELBMFONT_DEBUG_DRAW
- #include "renderer/CCCustomCommand.h"
- #include "2d/CCDrawNode.h"
- #endif
- NS_CC_BEGIN
- #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- #elif _MSC_VER >= 1400
- #pragma warning (push)
- #pragma warning (disable: 4996)
- #endif
- class CC_DLL CC_DEPRECATED_ATTRIBUTE LabelBMFont : public Node, public LabelProtocol, public BlendProtocol
- {
- public:
-
- LabelBMFont();
-
- virtual ~LabelBMFont();
-
- static LabelBMFont * create(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Vec2& imageOffset = Vec2::ZERO);
-
- static LabelBMFont * create();
-
- bool initWithString(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Vec2& imageOffset = Vec2::ZERO);
-
- virtual void setString(const std::string& newString) override;
- virtual const std::string& getString() const override;
- virtual void setAlignment(TextHAlignment alignment);
- virtual void setWidth(float width);
- virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
-
-
- virtual bool isOpacityModifyRGB() const override;
- virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override;
- void setFntFile(const std::string& fntFile, const Vec2& imageOffset = Vec2::ZERO);
- const std::string& getFntFile() const;
- virtual void setBlendFunc(const BlendFunc &blendFunc) override;
- virtual const BlendFunc &getBlendFunc() const override;
- virtual Sprite * getLetter(int ID);
- virtual Node * getChildByTag(int tag) const override;
- virtual void setColor(const Color3B& color) override;
- virtual const Size& getContentSize() const override;
- virtual Rect getBoundingBox() const override;
- virtual std::string getDescription() const override;
- #if CC_LABELBMFONT_DEBUG_DRAW
- virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
- #endif
- private:
- #if CC_LABELBMFONT_DEBUG_DRAW
- DrawNode *_debugDrawNode;
- #endif
-
-
- std::string _fntFile;
- Label* _label;
- };
- #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
- #pragma GCC diagnostic warning "-Wdeprecated-declarations"
- #elif _MSC_VER >= 1400
- #pragma warning (pop)
- #endif
- NS_CC_END
- #endif
|