Update comments.

This commit is contained in:
WenhaiLin 2015-07-08 15:30:34 +08:00
parent 581f1ab42b
commit 8cf27b9174
4 changed files with 25 additions and 24 deletions

View File

@ -43,14 +43,11 @@ NS_CC_BEGIN
const int Label::DistanceFieldFontSize = 50; const int Label::DistanceFieldFontSize = 50;
/**
* LabelLetter used to update the quad in texture atlas without SpriteBatchNode.
*/
class LabelLetter : public Sprite class LabelLetter : public Sprite
{ {
#if CC_SPRITEBATCHNODE_RENDER_SUBPIXEL
#define RENDER_IN_SUBPIXEL
#else
#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
#endif
public: public:
LabelLetter() LabelLetter()
{ {
@ -98,10 +95,10 @@ public:
float dx = x1 * cr - y2 * sr2 + x; float dx = x1 * cr - y2 * sr2 + x;
float dy = x1 * sr + y2 * cr2 + y; float dy = x1 * sr + y2 * cr2 + y;
_quad.bl.vertices.set(RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ); _quad.bl.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(ax), SPRITE_RENDER_IN_SUBPIXEL(ay), _positionZ);
_quad.br.vertices.set(RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ); _quad.br.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(bx), SPRITE_RENDER_IN_SUBPIXEL(by), _positionZ);
_quad.tl.vertices.set(RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ); _quad.tl.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(dx), SPRITE_RENDER_IN_SUBPIXEL(dy), _positionZ);
_quad.tr.vertices.set(RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ); _quad.tr.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(cx), SPRITE_RENDER_IN_SUBPIXEL(cy), _positionZ);
if (_textureAtlas) if (_textureAtlas)
{ {

View File

@ -87,7 +87,7 @@ class Sprite;
class SpriteBatchNode; class SpriteBatchNode;
/** /**
* @brief Label is a subclass of SpriteBatchNode that knows how to render text labels. * @brief Label is a subclass of Node that knows how to render text labels.
* *
* Label can be created with: * Label can be created with:
* - A true type font file. * - A true type font file.
@ -102,7 +102,7 @@ class SpriteBatchNode;
* - http://www.angelcode.com/products/bmfont/ (Free, Windows only) * - http://www.angelcode.com/products/bmfont/ (Free, Windows only)
* @js NA * @js NA
*/ */
class CC_DLL Label : public Node, public LabelProtocol class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol
{ {
public: public:
static const int DistanceFieldFontSize; static const int DistanceFieldFontSize;
@ -438,8 +438,8 @@ public:
FontAtlas* getFontAtlas() { return _fontAtlas; } FontAtlas* getFontAtlas() { return _fontAtlas; }
virtual const BlendFunc& getBlendFunc() const { return _blendFunc; } virtual const BlendFunc& getBlendFunc() const override { return _blendFunc; }
virtual void setBlendFunc(const BlendFunc &blendFunc); virtual void setBlendFunc(const BlendFunc &blendFunc) override;
virtual bool isOpacityModifyRGB() const override; virtual bool isOpacityModifyRGB() const override;
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override; virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override;

View File

@ -43,12 +43,6 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
#if CC_SPRITEBATCHNODE_RENDER_SUBPIXEL
#define RENDER_IN_SUBPIXEL
#else
#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
#endif
// MARK: create, init, dealloc // MARK: create, init, dealloc
Sprite* Sprite::createWithTexture(Texture2D *texture) Sprite* Sprite::createWithTexture(Texture2D *texture)
{ {
@ -626,10 +620,10 @@ void Sprite::updateTransform(void)
float dx = x1 * cr - y2 * sr2 + x; float dx = x1 * cr - y2 * sr2 + x;
float dy = x1 * sr + y2 * cr2 + y; float dy = x1 * sr + y2 * cr2 + y;
_quad.bl.vertices.set(RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ); _quad.bl.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(ax), SPRITE_RENDER_IN_SUBPIXEL(ay), _positionZ);
_quad.br.vertices.set(RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ); _quad.br.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(bx), SPRITE_RENDER_IN_SUBPIXEL(by), _positionZ);
_quad.tl.vertices.set(RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ); _quad.tl.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(dx), SPRITE_RENDER_IN_SUBPIXEL(dy), _positionZ);
_quad.tr.vertices.set(RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ); _quad.tr.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(cx), SPRITE_RENDER_IN_SUBPIXEL(cy), _positionZ);
} }
// MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS // MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS

View File

@ -47,6 +47,16 @@ class Size;
class Texture2D; class Texture2D;
struct transformValues_; struct transformValues_;
#ifdef SPRITE_RENDER_IN_SUBPIXEL
#undef SPRITE_RENDER_IN_SUBPIXEL
#endif
#if CC_SPRITEBATCHNODE_RENDER_SUBPIXEL
#define SPRITE_RENDER_IN_SUBPIXEL
#else
#define SPRITE_RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
#endif
/** /**
* @addtogroup _2d * @addtogroup _2d
* @{ * @{