axmol/cocos/2d/CCLabel.h

625 lines
19 KiB
C
Raw Normal View History

2013-07-23 02:17:51 +08:00
/****************************************************************************
Copyright (c) 2013 Zynga Inc.
2015-03-19 10:38:12 +08:00
Copyright (c) 2013-2015 Chukong Technologies Inc.
2013-07-23 02:17:51 +08:00
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef _COCOS2D_CCLABEL_H_
#define _COCOS2D_CCLABEL_H_
2013-07-23 02:17:51 +08:00
#include "2d/CCSpriteBatchNode.h"
2014-04-30 08:37:36 +08:00
#include "renderer/CCCustomCommand.h"
Squashed commit of the following: commit c16dcfaaea0922039aad05bce1f4efed18e04871 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 19:05:18 2014 -0700 more linux fixes commit 1553795976c9090a1b46deb53d12910fe0676008 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 19:04:04 2014 -0700 more linux fixes commit 1e43a8cabff33cbf25aa5eb5412f53a878222d83 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 19:02:07 2014 -0700 fixes linux isuses commit 723a445dd6411f91846da2b801248ad8298174f1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:58:50 2014 -0700 more linux fixes commit 533c8025e794fc76cef02f396b3a93b3d7f4cfc8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:57:33 2014 -0700 more linux fixes commit 4ba1e84959670bcbf044f18d1c0d4b3cb3be4090 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:53:43 2014 -0700 more linux fixes commit 1f8e011f306a47ed4134224e5e349929201f0539 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:49:28 2014 -0700 more linux fixes commit 3e2033100822ff6d532a1b4f012337491dc11920 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:47:43 2014 -0700 more linux fixes commit 2e708863c75fd032f1b2396dfdf1d31f7a62b713 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:46:00 2014 -0700 more linux fixes commit 861b5b92a6efd4de7b926c20d636ce9d749b293f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:43:15 2014 -0700 more linux fixes commit 2a43365a0c1755e9b9cada53301be1a20adb31cf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:36:06 2014 -0700 more fixes for linux commit 7d332bf911892f87c7824d2a5da7bf73ce7ec411 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:35:29 2014 -0700 more fixes for linux commit f1becc17d3316dfe3678c23c9dcedb7a447d9235 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:34:44 2014 -0700 more fixes for linux commit d2e5959bb0dde921dd5e73be1d8acc3b3f50e51d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:33:45 2014 -0700 fixes for linux commit ad9b633c352107cf0e8b060a0e23d6e6a3f5e80f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:16:48 2014 -0700 compiles on Windows commit 4425ee8e5de8f42a2d6050e4470109600dce8b5d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:07:20 2014 -0700 fix builder
2014-05-01 10:09:13 +08:00
#include "2d/CCFontAtlas.h"
2013-07-23 02:17:51 +08:00
NS_CC_BEGIN
2015-03-19 10:38:12 +08:00
/**
2015-03-24 14:12:58 +08:00
* @addtogroup _2d
* @{
*/
2015-03-19 10:38:12 +08:00
/**
* @brief Possible GlyphCollection used by Label.
*
2015-03-25 10:59:04 +08:00
* Specify a collections of characters to be load when Label created.
* Consider using DYNAMIC.
2015-03-19 10:38:12 +08:00
*/
2013-07-23 02:17:51 +08:00
enum class GlyphCollection {
DYNAMIC,
NEHE,
ASCII,
CUSTOM
};
2015-03-19 10:38:12 +08:00
/**
* @brief Possible LabelEffect used by Label.
*
*/
enum class LabelEffect {
NORMAL,
OUTLINE,
SHADOW,
GLOW
};
2015-03-19 10:38:12 +08:00
/**
* @struct TTFConfig
2015-03-25 10:59:04 +08:00
* @see `GlyphCollection`
2015-03-19 10:38:12 +08:00
*/
typedef struct _ttfConfig
{
std::string fontFilePath;
int fontSize;
2015-03-25 10:59:04 +08:00
GlyphCollection glyphs;
const char *customGlyphs;
2015-03-25 10:59:04 +08:00
2014-01-15 17:21:08 +08:00
bool distanceFieldEnabled;
int outlineSize;
_ttfConfig(const char* filePath = "",int size = 12, const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC,
const char *customGlyphCollection = nullptr,bool useDistanceField = false,int outline = 0)
:fontFilePath(filePath)
,fontSize(size)
,glyphs(glyphCollection)
,customGlyphs(customGlyphCollection)
2014-01-15 17:21:08 +08:00
,distanceFieldEnabled(useDistanceField)
,outlineSize(outline)
{
if(outline > 0)
{
distanceFieldEnabled = false;
}
}
}TTFConfig;
2015-03-19 10:38:12 +08:00
/**
* @brief Label is a subclass of SpriteBatchNode that knows how to render text labels.
*
* Label can be created with:
* - A true type font file.
* - A bitmap font file.
* - A char map file.
* - The built in system font.
*
* Bitmap Font supported editors:
* - http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
* - http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
* - http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
* - http://www.angelcode.com/products/bmfont/ (Free, Windows only)
*/
class CC_DLL Label : public SpriteBatchNode, public LabelProtocol
2013-07-23 02:17:51 +08:00
{
public:
2014-03-13 20:52:33 +08:00
static const int DistanceFieldFontSize;
2015-03-19 10:38:12 +08:00
/// @name Creators
/// @{
/**
* Allocates and initializes a Label, with default settings.
*
* @return An automatically released Label object.
*/
static Label* create();
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, base on platform-dependent API.
*
* @param text The initial text.
* @param font A font file or a font family name.
* @param fontSize The font size. This value must be > 0.
* @param dimensions
* @param hAlignment The text horizontal alignment.
* @param vAlignment The text vertical alignment.
*
* @warning It will generate texture by the platform-dependent code.
*
* @return An automatically released Label object.
*/
static Label* createWithSystemFont(const std::string& text, const std::string& font, float fontSize,
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
TextVAlignment vAlignment = TextVAlignment::TOP);
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, base on FreeType2.
*
* @param text The initial text.
* @param fontFilePath A font file.
* @param fontSize The font size. This value must be > 0.
* @param dimensions
* @param hAlignment The text horizontal alignment.
* @param vAlignment The text vertical alignment.
*
* @return An automatically released Label object.
*/
static Label * createWithTTF(const std::string& text, const std::string& fontFilePath, float fontSize,
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
TextVAlignment vAlignment = TextVAlignment::TOP);
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, base on FreeType2.
*
* @param ttfConfig A pointer to a TTFConfig object.
* @param text The initial text.
* @param hAlignment The text horizontal alignment.
* @param maxLineWidth The max line width.
*
* @return An automatically released Label object.
* @see TTFConfig setTTFConfig setMaxLineWidth
*/
static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0);
2013-07-23 05:43:45 +08:00
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, with a bitmap font file.
*
* @param bmfontPath A bitmap font file, it's a FNT format.
* @param text The initial text.
* @param hAlignment Text horizontal alignment.
* @param maxLineWidth The max line width.
* @param imageOffset
*
* @return An automatically released Label object.
* @see setBMFontFilePath setMaxLineWidth
*/
static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text,
const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0,
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
const Vec2& imageOffset = Vec2::ZERO);
2013-07-23 05:43:45 +08:00
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, with char map configuration.
*
* @param charMapFile A char map file, it's a PNG format.
* @param itemWidth The width in points of each element.
* @param itemHeight The height in points of each element.
* @param startCharMap The starting char of the char map.
*
* @return An automatically released Label object.
*/
static Label * createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, with char map configuration.
*
* @param texture A pointer to an existing Texture2D object.
* @param itemWidth The width in points of each element.
* @param itemHeight The height in points of each element.
* @param startCharMap The starting char of the char map.
*
* @return An automatically released Label object.
*/
static Label * createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
2015-03-19 10:38:12 +08:00
/**
* Allocates and initializes a Label, with char map configuration.
*
* @param plistFile A configuration file of char map.
*
* @return An automatically released Label object.
*/
static Label * createWithCharMap(const std::string& plistFile);
2015-03-19 10:38:12 +08:00
// end of creators group
/// @}
/// @{
/// @name Font methods
/**
* Sets a new TTF configuration to Label.
* @see `TTFConfig`
*/
virtual bool setTTFConfig(const TTFConfig& ttfConfig);
2015-03-19 10:38:12 +08:00
/**
* Returns the TTF configuration object used by the Label.
* @see `TTFConfig`
*/
virtual const TTFConfig& getTTFConfig() const { return _fontConfig;}
2015-03-19 10:38:12 +08:00
/** Sets a new bitmap font to Label */
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset = Vec2::ZERO);
2015-03-19 10:38:12 +08:00
/** Returns the bitmap font used by the Label.*/
const std::string& getBMFontFilePath() const { return _bmFontPath;}
2015-03-19 10:38:12 +08:00
/**
* Sets a new char map configuration to Label.
*
* @see `createWithCharMap(const std::string&,int,int,int)`
*/
virtual bool setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
2015-03-19 10:38:12 +08:00
/**
* Sets a new char map configuration to Label.
*
* @see `createWithCharMap(Texture2D*,int,int,int)`
*/
virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
2015-03-19 10:38:12 +08:00
/**
* Sets a new char map configuration to Label.
*
* @see `createWithCharMap(const std::string&)`
*/
virtual bool setCharMap(const std::string& plistFile);
2015-03-19 10:38:12 +08:00
/**
* Sets a new system font to Label.
*
* @param font A font file or a font family name.
* @warning
*/
virtual void setSystemFontName(const std::string& font);
/** Returns the system font used by the Label.*/
virtual const std::string& getSystemFontName() const { return _systemFont;}
2015-03-19 10:38:12 +08:00
/* Sets the system font size of Label.*/
virtual void setSystemFontSize(float fontSize);
2015-03-19 10:38:12 +08:00
/** Returns the bitmap font path used by the Label.*/
virtual float getSystemFontSize() const { return _systemFontSize;}
2015-03-19 10:38:12 +08:00
/**
* @warning This method is not recommended for game developers.
*/
2014-10-09 18:28:09 +08:00
virtual void requestSystemFontRefresh() { _systemFontDirty = true;}
2015-03-19 10:38:12 +08:00
// end of font methods
/// @}
/** Sets the text that this Label is to display.*/
virtual void setString(const std::string& text) override;
2015-03-19 10:38:12 +08:00
/** Return the text the Label is displaying.*/
virtual const std::string& getString() const override { return _originalUTF8String; }
2015-03-19 10:38:12 +08:00
int getStringNumLines() const;
int getStringLength() const;
/**
* Sets the text color of Label.
*
* The text color is different from the color of Node.
*
* @warning Limiting use to only when the Label created with true type font or system font.
*/
virtual void setTextColor(const Color4B &color);
2015-03-19 10:38:12 +08:00
/** Returns the text color of the Label.*/
const Color4B& getTextColor() const { return _textColor;}
/**
2015-03-19 10:38:12 +08:00
* Enable shadow effect to Label.
*
2015-03-19 10:38:12 +08:00
* @todo Support blur for shadow effect.
*/
virtual void enableShadow(const Color4B& shadowColor = Color4B::BLACK,const Size &offset = Size(2,-2), int blurRadius = 0);
2015-03-19 10:38:12 +08:00
/**
* Enable outline effect to Label.
* @warning Limiting use to only when the Label created with true type font or system font.
*/
virtual void enableOutline(const Color4B& outlineColor,int outlineSize = -1);
2015-03-19 10:38:12 +08:00
/**
* Enable glow effect to Label.
* @warning Limiting use to only when the Label created with true type font.
*/
virtual void enableGlow(const Color4B& glowColor);
2015-03-19 10:38:12 +08:00
/**
* Disable all effect to Label.
*/
virtual void disableEffect();
2015-03-19 10:38:12 +08:00
/** Sets the Label's text horizontal alignment.*/
2014-03-10 20:35:36 +08:00
void setAlignment(TextHAlignment hAlignment) { setAlignment(hAlignment,_vAlignment);}
2015-03-19 10:38:12 +08:00
/** Returns the Label's text horizontal alignment.*/
TextHAlignment getTextAlignment() const { return _hAlignment;}
2015-03-19 10:38:12 +08:00
/** Sets the Label's text alignment.*/
void setAlignment(TextHAlignment hAlignment,TextVAlignment vAlignment);
2015-03-19 10:38:12 +08:00
/** Sets the Label's text horizontal alignment.*/
2014-03-10 20:35:36 +08:00
void setHorizontalAlignment(TextHAlignment hAlignment) { setAlignment(hAlignment,_vAlignment); }
2015-03-19 10:38:12 +08:00
/** Returns the Label's text horizontal alignment.*/
TextHAlignment getHorizontalAlignment() const { return _hAlignment; }
2015-03-19 10:38:12 +08:00
/** Sets the Label's text vertical alignment.*/
2014-03-10 20:35:36 +08:00
void setVerticalAlignment(TextVAlignment vAlignment) { setAlignment(_hAlignment,vAlignment); }
2015-03-19 10:38:12 +08:00
/** Returns the Label's text vertical alignment.*/
TextVAlignment getVerticalAlignment() const { return _vAlignment; }
2015-03-19 10:38:12 +08:00
/**
* Specify what happens when a line is too long for Label.
*
* @param breakWithoutSpace Lines are automatically broken between words if this value is false.
*/
void setLineBreakWithoutSpace(bool breakWithoutSpace);
2013-08-13 07:16:34 +08:00
2015-03-19 10:38:12 +08:00
/**
* Makes the Label at most this line untransformed width.
* The Label's max line width be used for force line breaks if the value not equal zero.
*/
void setMaxLineWidth(float maxLineWidth);
float getMaxLineWidth() { return _maxLineWidth; }
2015-03-19 10:38:12 +08:00
/**
* Makes the Label exactly this untransformed width.
*
* The Label's width be used for text align if the value not equal zero.
*/
void setWidth(float width) { setDimensions(width,_labelHeight);}
float getWidth() const { return _labelWidth; }
2015-03-19 10:38:12 +08:00
/**
* Makes the Label exactly this untransformed height.
*
* The Label's height be used for text align if the value not equal zero.
* The text will display of incomplete when the size of Label not enough to support display all text.
*/
void setHeight(float height){ setDimensions(_labelWidth, height); }
float getHeight() const { return _labelHeight; }
2015-03-19 10:38:12 +08:00
/** Sets the untransformed size of the Label in a more efficient way. */
void setDimensions(float width, float height);
const Size& getDimensions() const{ return _labelDimensions;}
2015-03-19 10:38:12 +08:00
/** Update content immediately.*/
virtual void updateContent();
2015-03-19 10:38:12 +08:00
/**
* Provides a way to treats each character like a Sprite.
* @warning No support system font.
*/
virtual Sprite * getLetter(int lettetIndex);
2015-03-19 10:38:12 +08:00
/** Makes the Label to clip upper and lower margin for reduce height of Label.*/
void setClipMarginEnabled(bool clipEnabled) { _clipEnabled = clipEnabled; }
2015-03-19 10:38:12 +08:00
2014-03-25 16:37:34 +08:00
bool isClipMarginEnabled() const { return _clipEnabled; }
2015-03-19 10:38:12 +08:00
/** Sets the line height of the Label.
* @warning Not support system font.
* @since v3.2.0
*/
void setLineHeight(float height);
2015-03-19 10:38:12 +08:00
/**
* Returns the line height of this Label.
* @warning Not support system font.
* @since v3.2.0
*/
float getLineHeight() const;
2015-03-19 10:38:12 +08:00
/**
* Sets the additional kerning of the Label.
*
* @warning Not support system font.
* @since v3.2.0
*/
void setAdditionalKerning(float space);
2015-03-19 10:38:12 +08:00
/**
* Returns the additional kerning of the Label.
*
* @warning Not support system font.
* @since v3.2.0
*/
float getAdditionalKerning() const;
FontAtlas* getFontAtlas() { return _fontAtlas; }
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
virtual bool isOpacityModifyRGB() const override;
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override;
virtual void updateDisplayedColor(const Color3B& parentColor) override;
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
virtual void setScale(float scale) override;
virtual void setScaleX(float scaleX) override;
virtual void setScaleY(float scaleY) override;
virtual float getScaleX() const override;
virtual float getScaleY() const override;
virtual void addChild(Node * child, int zOrder=0, int tag=0) override;
virtual void sortAllChildren() override;
virtual std::string getDescription() const override;
virtual const Size& getContentSize() const override;
virtual Rect getBoundingBox() const override;
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
2015-03-16 17:11:17 +08:00
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
2015-03-16 15:31:29 +08:00
CC_DEPRECATED_ATTRIBUTE static Label* create(const std::string& text, const std::string& font, float fontSize,
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
TextVAlignment vAlignment = TextVAlignment::TOP);
CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition);
CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; }
2015-03-19 10:38:12 +08:00
/**
* @deprecated Use `getLineHeight` instead.
*/
2014-10-23 17:54:15 +08:00
CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return (int)getLineHeight();}
CC_CONSTRUCTOR_ACCESS:
/**
2015-03-19 10:38:12 +08:00
* Constructor of Label.
* @js NA
*/
Label(FontAtlas *atlas = nullptr, TextHAlignment hAlignment = TextHAlignment::LEFT,
TextVAlignment vAlignment = TextVAlignment::TOP,bool useDistanceField = false,bool useA8Shader = false);
2015-03-19 10:38:12 +08:00
/**
2015-03-19 10:38:12 +08:00
* Destructor of Label.
* @js NA
* @lua NA
*/
virtual ~Label();
protected:
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
void onDraw(const Mat4& transform, bool transformUpdated);
struct LetterInfo
{
FontLetterDefinition def;
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 position;
Size contentSize;
int atlasIndex;
};
enum class LabelType {
2014-03-10 20:35:36 +08:00
TTF,
BMFONT,
CHARMAP,
STRING_TEXTURE
};
2014-03-13 20:52:33 +08:00
virtual void setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled = false, bool useA8Shader = false);
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
bool recordLetterInfo(const cocos2d::Vec2& point,const FontLetterDefinition& letterDef, int spriteIndex);
bool recordPlaceholderInfo(int spriteIndex);
void setFontScale(float fontScale);
virtual void alignText();
bool computeHorizontalKernings(const std::u16string& stringToRender);
2014-05-08 21:30:12 +08:00
void computeStringNumLines();
void updateQuads();
virtual void updateColor() override;
2014-03-13 21:00:36 +08:00
virtual void updateShaderProgram();
void drawShadowWithoutBlur();
void drawTextSprite(Renderer *renderer, uint32_t parentFlags);
void createSpriteWithFontDefinition();
void updateFont();
void reset();
std::string _bmFontPath;
bool _isOpacityModifyRGB;
bool _contentDirty;
2014-05-08 21:30:12 +08:00
bool _systemFontDirty;
std::string _systemFont;
float _systemFontSize;
2014-03-10 20:35:36 +08:00
LabelType _currentLabelType;
std::vector<SpriteBatchNode*> _batchNodes;
FontAtlas * _fontAtlas;
std::vector<LetterInfo> _lettersInfo;
TTFConfig _fontConfig;
//compatibility with older LabelTTF
Sprite* _textSprite;
FontDefinition _fontDefinition;
2014-04-14 13:42:37 +08:00
bool _compatibleMode;
//! used for optimization
Sprite *_reusedLetter;
Rect _reusedRect;
int _limitShowCount;
2014-01-15 17:21:08 +08:00
float _additionalKerning;
float _commonLineHeight;
bool _lineBreakWithoutSpaces;
int * _horizontalKernings;
float _maxLineWidth;
Size _labelDimensions;
float _labelWidth;
float _labelHeight;
TextHAlignment _hAlignment;
TextVAlignment _vAlignment;
int _currNumLines;
std::u16string _currentUTF16String;
std::string _originalUTF8String;
float _fontScale;
bool _useDistanceField;
bool _useA8Shader;
LabelEffect _currLabelEffect;
Color4B _effectColor;
Color4F _effectColorF;
GLuint _uniformEffectColor;
GLuint _uniformTextColor;
CustomCommand _customCommand;
bool _shadowDirty;
bool _shadowEnabled;
Size _shadowOffset;
int _shadowBlurRadius;
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Mat4 _shadowTransform;
Color3B _shadowColor;
float _shadowOpacity;
2014-03-31 11:47:28 +08:00
Sprite* _shadowNode;
int _outlineSize;
Color4B _textColor;
Color4F _textColorF;
bool _clipEnabled;
2014-03-31 15:45:06 +08:00
bool _blendFuncDirty;
2015-03-19 10:38:12 +08:00
/// whether or not the sprite was inside bounds the previous frame
bool _insideBounds;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Label);
friend class LabelTextFormatter;
2013-07-23 02:17:51 +08:00
};
2015-03-19 10:38:12 +08:00
// end group
/// @}
2013-07-23 02:17:51 +08:00
NS_CC_END
#endif /*__COCOS2D_CCLABEL_H */