mirror of https://github.com/axmolengine/axmol.git
issue #2430:move enum in ccTypes.h class
This commit is contained in:
parent
acdd1cfe9d
commit
2293630335
|
@ -114,8 +114,16 @@ const int kCCParticleStartRadiusEqualToEndRadius = ParticleSystem::START_RADIUS_
|
|||
const int kCCParticleModeGravity = ParticleSystem::MODE_GRAVITY;
|
||||
const int kCCParticleModeRadius = ParticleSystem::MODE_RADIUS;
|
||||
|
||||
const int kCCPositionTypeFree = ParticleSystem::FREE;
|
||||
const int kCCPositionTypeRelative = ParticleSystem::RELATIVE;
|
||||
const int kCCPositionTypeGrouped = ParticleSystem::GROUPED;
|
||||
const int kCCPositionTypeFree = ParticleSystem::POSITION_TYPE_FREE;
|
||||
const int kCCPositionTypeRelative = ParticleSystem::POSITION_TYPE_RELATIVE;
|
||||
const int kCCPositionTypeGrouped = ParticleSystem::POSITION_TYPE_GROUPED;
|
||||
|
||||
const int kCCVerticalTextAlignmentTop = Label::VERTICAL_TEXT_ALIGNMENT_TOP;
|
||||
const int kCCVerticalTextAlignmentCenter = Label::VERTICAL_TEXT_ALIGNMENT_CENTER;
|
||||
const int kCCVerticalTextAlignmentBottom = Label::VERTICAL_TEXT_ALIGNMENT_BOTTOM;
|
||||
|
||||
const int kCCTextAlignmentLeft = Label::TEXT_ALIGNMENT_LEFT;
|
||||
const int kCCTextAlignmentCenter = Label::TEXT_ALIGNMENT_CENTER;
|
||||
const int kCCTextAlignmentRight = Label::TEXT_ALIGNMENT_RIGHT;
|
||||
|
||||
NS_CC_END
|
|
@ -789,8 +789,8 @@ CC_DEPRECATED_ATTRIBUTE typedef FontShadow ccFontShadow;
|
|||
CC_DEPRECATED_ATTRIBUTE typedef FontStroke ccFontStroke;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef FontDefinition ccFontDefinition;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE typedef VerticalTextAlignment CCVerticalTextAlignment;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef TextAlignment CCTextAlignment;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Label::VerticalTextAlignment CCVerticalTextAlignment;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Label::TextAlignment CCTextAlignment;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ProgressTimer::Type CCProgressTimerType;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE typedef void* CCZone;
|
||||
|
@ -858,14 +858,13 @@ CC_DEPRECATED_ATTRIBUTE extern const int ConfigurationDouble;
|
|||
CC_DEPRECATED_ATTRIBUTE extern const int ConfigurationBoolean;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef enum Configuration::Type ccConfigurationType;
|
||||
|
||||
#define kCCVerticalTextAlignmentTop kVerticalTextAlignmentTop
|
||||
#define kCCVerticalTextAlignmentCenter kVerticalTextAlignmentCenter
|
||||
#define kCCVerticalTextAlignmentBottom kVerticalTextAlignmentBottom
|
||||
|
||||
#define kCCTextAlignmentLeft kTextAlignmentLeft
|
||||
#define kCCTextAlignmentCenter kTextAlignmentCenter
|
||||
#define kCCTextAlignmentRight kTextAlignmentRight
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCVerticalTextAlignmentTop;
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCVerticalTextAlignmentCenter;
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCVerticalTextAlignmentBottom;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCTextAlignmentLeft;
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCTextAlignmentCenter;
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCTextAlignmentRight;
|
||||
|
||||
#define kCCTexture2DPixelFormat_RGBA8888 kTexture2DPixelFormat_RGBA8888
|
||||
#define kCCTexture2DPixelFormat_RGB888 kTexture2DPixelFormat_RGB888
|
||||
|
@ -877,7 +876,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum Configuration::Type ccConfigurationType;
|
|||
#define kCCTexture2DPixelFormat_RGB5A1 kTexture2DPixelFormat_RGB5A1
|
||||
#define kCCTexture2DPixelFormat_PVRTC4 kTexture2DPixelFormat_PVRTC4
|
||||
#define kCCTexture2DPixelFormat_PVRTC2 kTexture2DPixelFormat_PVRTC2
|
||||
#define kCCTexture2DPixelFormat_Default kTexture2DPixelFormat_Default
|
||||
#define kCCTexture2DPixelFormat_Default kTexture2DPixelFormat_Default
|
||||
|
||||
#define kCCLabelAutomaticWidth kLabelAutomaticWidth
|
||||
|
||||
|
|
|
@ -304,23 +304,27 @@ struct BlendFunc
|
|||
const static BlendFunc BLEND_FUNC_DISABLE;
|
||||
};
|
||||
|
||||
// XXX: If any of these enums are edited and/or reordered, update Texture2D.m
|
||||
//! Vertical text alignment type
|
||||
typedef enum
|
||||
class Label
|
||||
{
|
||||
kVerticalTextAlignmentTop,
|
||||
kVerticalTextAlignmentCenter,
|
||||
kVerticalTextAlignmentBottom,
|
||||
} VerticalTextAlignment;
|
||||
public:
|
||||
// XXX: If any of these enums are edited and/or reordered, update Texture2D.m
|
||||
//! Vertical text alignment type
|
||||
enum VerticalTextAlignment
|
||||
{
|
||||
VERTICAL_TEXT_ALIGNMENT_TOP,
|
||||
VERTICAL_TEXT_ALIGNMENT_CENTER,
|
||||
VERTICAL_TEXT_ALIGNMENT_BOTTOM,
|
||||
};
|
||||
|
||||
// XXX: If any of these enums are edited and/or reordered, update Texture2D.m
|
||||
//! Horizontal text alignment type
|
||||
typedef enum
|
||||
{
|
||||
kTextAlignmentLeft,
|
||||
kTextAlignmentCenter,
|
||||
kTextAlignmentRight,
|
||||
} TextAlignment;
|
||||
// XXX: If any of these enums are edited and/or reordered, update Texture2D.m
|
||||
//! Horizontal text alignment type
|
||||
enum TextAlignment
|
||||
{
|
||||
TEXT_ALIGNMENT_LEFT,
|
||||
TEXT_ALIGNMENT_CENTER,
|
||||
TEXT_ALIGNMENT_RIGHT,
|
||||
};
|
||||
};
|
||||
|
||||
// types for animation in particle systems
|
||||
|
||||
|
@ -345,8 +349,6 @@ struct AnimationFrameData
|
|||
Size size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
types used for defining fonts properties (i.e. font name, size, stroke or shadow)
|
||||
*/
|
||||
|
@ -398,8 +400,8 @@ struct FontDefinition
|
|||
public:
|
||||
|
||||
FontDefinition():_fontSize(0),
|
||||
_alignment(kTextAlignmentCenter),
|
||||
_vertAlignment(kVerticalTextAlignmentTop),
|
||||
_alignment(Label::TEXT_ALIGNMENT_CENTER),
|
||||
_vertAlignment(Label::VERTICAL_TEXT_ALIGNMENT_TOP),
|
||||
_fontFillColor(Color3B::WHITE)
|
||||
{ _dimensions = Size(0,0); }
|
||||
|
||||
|
@ -408,9 +410,9 @@ public:
|
|||
// font size
|
||||
int _fontSize;
|
||||
// horizontal alignment
|
||||
TextAlignment _alignment;
|
||||
Label::Label::Label::TextAlignment _alignment;
|
||||
// vertical alignment
|
||||
VerticalTextAlignment _vertAlignment;
|
||||
Label::Label::Label::VerticalTextAlignment _vertAlignment;
|
||||
// renering box
|
||||
Size _dimensions;
|
||||
// font color
|
||||
|
|
|
@ -430,23 +430,23 @@ LabelBMFont * LabelBMFont::create()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LabelBMFont * LabelBMFont::create(const char *str, const char *fntFile, float width, TextAlignment alignment)
|
||||
LabelBMFont * LabelBMFont::create(const char *str, const char *fntFile, float width, Label::TextAlignment alignment)
|
||||
{
|
||||
return LabelBMFont::create(str, fntFile, width, alignment, Point::ZERO);
|
||||
}
|
||||
|
||||
LabelBMFont * LabelBMFont::create(const char *str, const char *fntFile, float width)
|
||||
{
|
||||
return LabelBMFont::create(str, fntFile, width, kTextAlignmentLeft, Point::ZERO);
|
||||
return LabelBMFont::create(str, fntFile, width, Label::TEXT_ALIGNMENT_LEFT, Point::ZERO);
|
||||
}
|
||||
|
||||
LabelBMFont * LabelBMFont::create(const char *str, const char *fntFile)
|
||||
{
|
||||
return LabelBMFont::create(str, fntFile, kLabelAutomaticWidth, kTextAlignmentLeft, Point::ZERO);
|
||||
return LabelBMFont::create(str, fntFile, kLabelAutomaticWidth, Label::TEXT_ALIGNMENT_LEFT, Point::ZERO);
|
||||
}
|
||||
|
||||
//LabelBMFont - Creation & Init
|
||||
LabelBMFont *LabelBMFont::create(const char *str, const char *fntFile, float width/* = kLabelAutomaticWidth*/, TextAlignment alignment/* = kTextAlignmentLeft*/, Point imageOffset/* = Point::ZERO*/)
|
||||
LabelBMFont *LabelBMFont::create(const char *str, const char *fntFile, float width/* = kLabelAutomaticWidth*/, Label::TextAlignment alignment/* = Label::TEXT_ALIGNMENT_LEFT*/, Point imageOffset/* = Point::ZERO*/)
|
||||
{
|
||||
LabelBMFont *pRet = new LabelBMFont();
|
||||
if(pRet && pRet->initWithString(str, fntFile, width, alignment, imageOffset))
|
||||
|
@ -460,10 +460,10 @@ LabelBMFont *LabelBMFont::create(const char *str, const char *fntFile, float wid
|
|||
|
||||
bool LabelBMFont::init()
|
||||
{
|
||||
return initWithString(NULL, NULL, kLabelAutomaticWidth, kTextAlignmentLeft, Point::ZERO);
|
||||
return initWithString(NULL, NULL, kLabelAutomaticWidth, Label::TEXT_ALIGNMENT_LEFT, Point::ZERO);
|
||||
}
|
||||
|
||||
bool LabelBMFont::initWithString(const char *theString, const char *fntFile, float width/* = kLabelAutomaticWidth*/, TextAlignment alignment/* = kTextAlignmentLeft*/, Point imageOffset/* = Point::ZERO*/)
|
||||
bool LabelBMFont::initWithString(const char *theString, const char *fntFile, float width/* = kLabelAutomaticWidth*/, Label::TextAlignment alignment/* = Label::TEXT_ALIGNMENT_LEFT*/, Point imageOffset/* = Point::ZERO*/)
|
||||
{
|
||||
CCASSERT(!_configuration, "re-init is no longer supported");
|
||||
CCASSERT( (theString && fntFile) || (theString==NULL && fntFile==NULL), "Invalid params for LabelBMFont");
|
||||
|
@ -530,7 +530,7 @@ bool LabelBMFont::initWithString(const char *theString, const char *fntFile, flo
|
|||
LabelBMFont::LabelBMFont()
|
||||
: _string(NULL)
|
||||
, _initialString(NULL)
|
||||
, _alignment(kTextAlignmentCenter)
|
||||
, _alignment(Label::TEXT_ALIGNMENT_CENTER)
|
||||
, _width(-1.0f)
|
||||
, _configuration(NULL)
|
||||
, _lineBreakWithoutSpaces(false)
|
||||
|
@ -1094,7 +1094,7 @@ void LabelBMFont::updateLabel()
|
|||
}
|
||||
|
||||
// Step 2: Make alignment
|
||||
if (_alignment != kTextAlignmentLeft)
|
||||
if (_alignment != Label::TEXT_ALIGNMENT_LEFT)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -1125,10 +1125,10 @@ void LabelBMFont::updateLabel()
|
|||
float shift = 0;
|
||||
switch (_alignment)
|
||||
{
|
||||
case kTextAlignmentCenter:
|
||||
case Label::TEXT_ALIGNMENT_CENTER:
|
||||
shift = getContentSize().width/2.0f - lineWidth/2.0f;
|
||||
break;
|
||||
case kTextAlignmentRight:
|
||||
case Label::TEXT_ALIGNMENT_RIGHT:
|
||||
shift = getContentSize().width - lineWidth;
|
||||
break;
|
||||
default:
|
||||
|
@ -1160,7 +1160,7 @@ void LabelBMFont::updateLabel()
|
|||
}
|
||||
|
||||
// LabelBMFont - Alignment
|
||||
void LabelBMFont::setAlignment(TextAlignment alignment)
|
||||
void LabelBMFont::setAlignment(Label::TextAlignment alignment)
|
||||
{
|
||||
this->_alignment = alignment;
|
||||
updateLabel();
|
||||
|
|
|
@ -192,9 +192,9 @@ public:
|
|||
static void purgeCachedData();
|
||||
|
||||
/** creates a bitmap font atlas with an initial string and the FNT file */
|
||||
static LabelBMFont * create(const char *str, const char *fntFile, float width, TextAlignment alignment, Point imageOffset);
|
||||
static LabelBMFont * create(const char *str, const char *fntFile, float width, Label::TextAlignment alignment, Point imageOffset);
|
||||
|
||||
static LabelBMFont * create(const char *str, const char *fntFile, float width, TextAlignment alignment);
|
||||
static LabelBMFont * create(const char *str, const char *fntFile, float width, Label::TextAlignment alignment);
|
||||
|
||||
static LabelBMFont * create(const char *str, const char *fntFile, float width);
|
||||
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
|
||||
bool init();
|
||||
/** init a bitmap font atlas with an initial string and the FNT file */
|
||||
bool initWithString(const char *str, const char *fntFile, float width = kLabelAutomaticWidth, TextAlignment alignment = kTextAlignmentLeft, Point imageOffset = Point::ZERO);
|
||||
bool initWithString(const char *str, const char *fntFile, float width = kLabelAutomaticWidth, Label::TextAlignment alignment = Label::TEXT_ALIGNMENT_LEFT, Point imageOffset = Point::ZERO);
|
||||
|
||||
/** updates the font chars based on the string to render */
|
||||
void createFontChars();
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
virtual void setCString(const char *label);
|
||||
virtual void setAnchorPoint(const Point& var);
|
||||
virtual void updateLabel();
|
||||
virtual void setAlignment(TextAlignment alignment);
|
||||
virtual void setAlignment(Label::TextAlignment alignment);
|
||||
virtual void setWidth(float width);
|
||||
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||
virtual void setScale(float scale);
|
||||
|
@ -265,7 +265,7 @@ protected:
|
|||
std::string _initialStringUTF8;
|
||||
|
||||
// alignment of all lines
|
||||
TextAlignment _alignment;
|
||||
Label::TextAlignment _alignment;
|
||||
// max width until a line break is added
|
||||
float _width;
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ NS_CC_BEGIN
|
|||
//CCLabelTTF
|
||||
//
|
||||
LabelTTF::LabelTTF()
|
||||
: _alignment(kTextAlignmentCenter)
|
||||
, _vAlignment(kVerticalTextAlignmentTop)
|
||||
: _alignment(Label::TEXT_ALIGNMENT_CENTER)
|
||||
, _vAlignment(Label::VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
, _fontName(NULL)
|
||||
, _fontSize(0.0)
|
||||
, _string("")
|
||||
|
@ -73,18 +73,18 @@ LabelTTF * LabelTTF::create()
|
|||
LabelTTF * LabelTTF::create(const char *string, const char *fontName, float fontSize)
|
||||
{
|
||||
return LabelTTF::create(string, fontName, fontSize,
|
||||
Size::ZERO, kTextAlignmentCenter, kVerticalTextAlignmentTop);
|
||||
Size::ZERO, Label::TEXT_ALIGNMENT_CENTER, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
}
|
||||
|
||||
LabelTTF * LabelTTF::create(const char *string, const char *fontName, float fontSize,
|
||||
const Size& dimensions, TextAlignment hAlignment)
|
||||
const Size& dimensions, Label::TextAlignment hAlignment)
|
||||
{
|
||||
return LabelTTF::create(string, fontName, fontSize, dimensions, hAlignment, kVerticalTextAlignmentTop);
|
||||
return LabelTTF::create(string, fontName, fontSize, dimensions, hAlignment, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
}
|
||||
|
||||
LabelTTF* LabelTTF::create(const char *string, const char *fontName, float fontSize,
|
||||
const Size &dimensions, TextAlignment hAlignment,
|
||||
VerticalTextAlignment vAlignment)
|
||||
const Size &dimensions, Label::TextAlignment hAlignment,
|
||||
Label::VerticalTextAlignment vAlignment)
|
||||
{
|
||||
LabelTTF *pRet = new LabelTTF();
|
||||
if(pRet && pRet->initWithString(string, fontName, fontSize, dimensions, hAlignment, vAlignment))
|
||||
|
@ -114,20 +114,20 @@ bool LabelTTF::init()
|
|||
}
|
||||
|
||||
bool LabelTTF::initWithString(const char *label, const char *fontName, float fontSize,
|
||||
const Size& dimensions, TextAlignment alignment)
|
||||
const Size& dimensions, Label::TextAlignment alignment)
|
||||
{
|
||||
return this->initWithString(label, fontName, fontSize, dimensions, alignment, kVerticalTextAlignmentTop);
|
||||
return this->initWithString(label, fontName, fontSize, dimensions, alignment, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
}
|
||||
|
||||
bool LabelTTF::initWithString(const char *label, const char *fontName, float fontSize)
|
||||
{
|
||||
return this->initWithString(label, fontName, fontSize,
|
||||
Size::ZERO, kTextAlignmentLeft, kVerticalTextAlignmentTop);
|
||||
Size::ZERO, Label::TEXT_ALIGNMENT_LEFT, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
}
|
||||
|
||||
bool LabelTTF::initWithString(const char *string, const char *fontName, float fontSize,
|
||||
const cocos2d::Size &dimensions, TextAlignment hAlignment,
|
||||
VerticalTextAlignment vAlignment)
|
||||
const cocos2d::Size &dimensions, Label::TextAlignment hAlignment,
|
||||
Label::VerticalTextAlignment vAlignment)
|
||||
{
|
||||
if (Sprite::init())
|
||||
{
|
||||
|
@ -193,12 +193,12 @@ const char* LabelTTF::description() const
|
|||
return String::createWithFormat("<LabelTTF | FontName = %s, FontSize = %.1f>", _fontName->c_str(), _fontSize)->getCString();
|
||||
}
|
||||
|
||||
TextAlignment LabelTTF::getHorizontalAlignment() const
|
||||
Label::TextAlignment LabelTTF::getHorizontalAlignment() const
|
||||
{
|
||||
return _alignment;
|
||||
}
|
||||
|
||||
void LabelTTF::setHorizontalAlignment(TextAlignment alignment)
|
||||
void LabelTTF::setHorizontalAlignment(Label::TextAlignment alignment)
|
||||
{
|
||||
if (alignment != _alignment)
|
||||
{
|
||||
|
@ -212,12 +212,12 @@ void LabelTTF::setHorizontalAlignment(TextAlignment alignment)
|
|||
}
|
||||
}
|
||||
|
||||
VerticalTextAlignment LabelTTF::getVerticalAlignment() const
|
||||
Label::VerticalTextAlignment LabelTTF::getVerticalAlignment() const
|
||||
{
|
||||
return _vAlignment;
|
||||
}
|
||||
|
||||
void LabelTTF::setVerticalAlignment(VerticalTextAlignment verticalAlignment)
|
||||
void LabelTTF::setVerticalAlignment(Label::VerticalTextAlignment verticalAlignment)
|
||||
{
|
||||
if (verticalAlignment != _vAlignment)
|
||||
{
|
||||
|
|
|
@ -48,9 +48,9 @@ NS_CC_BEGIN
|
|||
* Custom ttf file can be put in assets/ or external storage that the Application can access.
|
||||
* @code
|
||||
* LabelTTF *label1 = LabelTTF::create("alignment left", "A Damn Mess", fontSize, blockSize,
|
||||
* kTextAlignmentLeft, kVerticalTextAlignmentCenter);
|
||||
* Label::TEXT_ALIGNMENT_LEFT, Label::VERTICAL_TEXT_ALIGNMENT_CENTER);
|
||||
* LabelTTF *label2 = LabelTTF::create("alignment right", "/mnt/sdcard/Scissor Cuts.ttf", fontSize, blockSize,
|
||||
* kTextAlignmentLeft, kVerticalTextAlignmentCenter);
|
||||
* Label::TEXT_ALIGNMENT_LEFT, Label::VERTICAL_TEXT_ALIGNMENT_CENTER);
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
|
@ -70,14 +70,14 @@ public:
|
|||
@since v2.0.1
|
||||
*/
|
||||
static LabelTTF * create(const char *string, const char *fontName, float fontSize,
|
||||
const Size& dimensions, TextAlignment hAlignment);
|
||||
const Size& dimensions, Label::TextAlignment hAlignment);
|
||||
|
||||
/** creates a Label from a fontname, alignment, dimension in points and font size in points
|
||||
@since v2.0.1
|
||||
*/
|
||||
static LabelTTF * create(const char *string, const char *fontName, float fontSize,
|
||||
const Size& dimensions, TextAlignment hAlignment,
|
||||
VerticalTextAlignment vAlignment);
|
||||
const Size& dimensions, Label::TextAlignment hAlignment,
|
||||
Label::VerticalTextAlignment vAlignment);
|
||||
|
||||
|
||||
/** Create a lable with string and a font definition*/
|
||||
|
@ -88,12 +88,12 @@ public:
|
|||
|
||||
/** initializes the LabelTTF with a font name, alignment, dimension and font size */
|
||||
bool initWithString(const char *string, const char *fontName, float fontSize,
|
||||
const Size& dimensions, TextAlignment hAlignment);
|
||||
const Size& dimensions, Label::TextAlignment hAlignment);
|
||||
|
||||
/** initializes the LabelTTF with a font name, alignment, dimension and font size */
|
||||
bool initWithString(const char *string, const char *fontName, float fontSize,
|
||||
const Size& dimensions, TextAlignment hAlignment,
|
||||
VerticalTextAlignment vAlignment);
|
||||
const Size& dimensions, Label::TextAlignment hAlignment,
|
||||
Label::VerticalTextAlignment vAlignment);
|
||||
|
||||
/** initializes the LabelTTF with a font name, alignment, dimension and font size */
|
||||
bool initWithStringAndTextDefinition(const char *string, FontDefinition &textDefinition);
|
||||
|
@ -136,11 +136,11 @@ public:
|
|||
virtual void setString(const char *label);
|
||||
virtual const char* getString(void) const;
|
||||
|
||||
TextAlignment getHorizontalAlignment() const;
|
||||
void setHorizontalAlignment(TextAlignment alignment);
|
||||
Label::TextAlignment getHorizontalAlignment() const;
|
||||
void setHorizontalAlignment(Label::TextAlignment alignment);
|
||||
|
||||
VerticalTextAlignment getVerticalAlignment() const;
|
||||
void setVerticalAlignment(VerticalTextAlignment verticalAlignment);
|
||||
Label::VerticalTextAlignment getVerticalAlignment() const;
|
||||
void setVerticalAlignment(Label::VerticalTextAlignment verticalAlignment);
|
||||
|
||||
const Size& getDimensions() const;
|
||||
void setDimensions(const Size &dim);
|
||||
|
@ -162,9 +162,9 @@ protected:
|
|||
/** Dimensions of the label in Points */
|
||||
Size _dimensions;
|
||||
/** The alignment of the label */
|
||||
TextAlignment _alignment;
|
||||
Label::TextAlignment _alignment;
|
||||
/** The vertical alignment of the label */
|
||||
VerticalTextAlignment _vAlignment;
|
||||
Label::VerticalTextAlignment _vAlignment;
|
||||
/** Font name used in the label */
|
||||
std::string * _fontName;
|
||||
/** Font size of the label */
|
||||
|
|
|
@ -112,7 +112,7 @@ ParticleSystem::ParticleSystem()
|
|||
, _texture(NULL)
|
||||
, _opacityModifyRGB(false)
|
||||
, _isBlendAdditive(false)
|
||||
, _positionType(PositionType::FREE)
|
||||
, _positionType(POSITION_TYPE_FREE)
|
||||
, _isAutoRemoveOnFinish(false)
|
||||
, _emitterMode(MODE_GRAVITY)
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ bool ParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
|
|||
_blendFunc.dst = CC_BLEND_DST;
|
||||
|
||||
// default movement type;
|
||||
_positionType = PositionType::FREE;
|
||||
_positionType = POSITION_TYPE_FREE;
|
||||
|
||||
// by default be in mode A:
|
||||
_emitterMode = MODE_GRAVITY;
|
||||
|
@ -520,11 +520,11 @@ void ParticleSystem::initParticle(tParticle* particle)
|
|||
particle->deltaRotation = (endA - startA) / particle->timeToLive;
|
||||
|
||||
// position
|
||||
if (_positionType == PositionType::FREE)
|
||||
if (_positionType == POSITION_TYPE_FREE)
|
||||
{
|
||||
particle->startPos = this->convertToWorldSpace(Point::ZERO);
|
||||
}
|
||||
else if (_positionType == PositionType::RELATIVE)
|
||||
else if (_positionType == POSITION_TYPE_RELATIVE)
|
||||
{
|
||||
particle->startPos = _position;
|
||||
}
|
||||
|
@ -628,11 +628,11 @@ void ParticleSystem::update(float dt)
|
|||
_particleIdx = 0;
|
||||
|
||||
Point currentPosition = Point::ZERO;
|
||||
if (_positionType == PositionType::FREE)
|
||||
if (_positionType == POSITION_TYPE_FREE)
|
||||
{
|
||||
currentPosition = this->convertToWorldSpace(Point::ZERO);
|
||||
}
|
||||
else if (_positionType == PositionType::RELATIVE)
|
||||
else if (_positionType == POSITION_TYPE_RELATIVE)
|
||||
{
|
||||
currentPosition = _position;
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ void ParticleSystem::update(float dt)
|
|||
|
||||
Point newPos;
|
||||
|
||||
if (_positionType == PositionType::FREE || _positionType == PositionType::RELATIVE)
|
||||
if (_positionType == POSITION_TYPE_FREE || _positionType == POSITION_TYPE_RELATIVE)
|
||||
{
|
||||
Point diff = currentPosition - p->startPos;
|
||||
newPos = p->pos - diff;
|
||||
|
|
|
@ -139,15 +139,15 @@ public:
|
|||
enum PositionType
|
||||
{
|
||||
/** Living particles are attached to the world and are unaffected by emitter repositioning. */
|
||||
FREE,
|
||||
POSITION_TYPE_FREE,
|
||||
|
||||
/** Living particles are attached to the world but will follow the emitter repositioning.
|
||||
Use case: Attach an emitter to an sprite, and you want that the emitter follows the sprite.
|
||||
*/
|
||||
RELATIVE,
|
||||
POSITION_TYPE_RELATIVE,
|
||||
|
||||
/** Living particles are attached to the emitter and are translated along with it. */
|
||||
GROUPED,
|
||||
POSITION_TYPE_GROUPED,
|
||||
};
|
||||
|
||||
//* @enum
|
||||
|
|
|
@ -70,7 +70,7 @@ TextFieldTTF::~TextFieldTTF()
|
|||
// static constructor
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const Size& dimensions, TextAlignment alignment, const char *fontName, float fontSize)
|
||||
TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const Size& dimensions, Label::TextAlignment alignment, const char *fontName, float fontSize)
|
||||
{
|
||||
TextFieldTTF *pRet = new TextFieldTTF();
|
||||
if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
|
||||
|
@ -106,7 +106,7 @@ TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, c
|
|||
// initialize
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TextFieldTTF::initWithPlaceHolder(const char *placeholder, const Size& dimensions, TextAlignment alignment, const char *fontName, float fontSize)
|
||||
bool TextFieldTTF::initWithPlaceHolder(const char *placeholder, const Size& dimensions, Label::TextAlignment alignment, const char *fontName, float fontSize)
|
||||
{
|
||||
if (placeholder)
|
||||
{
|
||||
|
|
|
@ -103,11 +103,11 @@ public:
|
|||
//char * description();
|
||||
|
||||
/** creates a TextFieldTTF from a fontname, alignment, dimension and font size */
|
||||
static TextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const Size& dimensions, TextAlignment alignment, const char *fontName, float fontSize);
|
||||
static TextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const Size& dimensions, Label::TextAlignment alignment, const char *fontName, float fontSize);
|
||||
/** creates a LabelTTF from a fontname and font size */
|
||||
static TextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
|
||||
/** initializes the TextFieldTTF with a font name, alignment, dimension and font size */
|
||||
bool initWithPlaceHolder(const char *placeholder, const Size& dimensions, TextAlignment alignment, const char *fontName, float fontSize);
|
||||
bool initWithPlaceHolder(const char *placeholder, const Size& dimensions, Label::TextAlignment alignment, const char *fontName, float fontSize);
|
||||
/** initializes the TextFieldTTF with a font name and font size */
|
||||
bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ bool Texture2D::initPremultipliedATextureWithImage(Image *image, unsigned int wi
|
|||
}
|
||||
|
||||
// implementation Texture2D (Text)
|
||||
bool Texture2D::initWithString(const char *text, const char *fontName, float fontSize, const Size& dimensions/* = Size(0, 0)*/, TextAlignment hAlignment/* = kTextAlignmentCenter */, VerticalTextAlignment vAlignment/* = kVerticalTextAlignmentTop */)
|
||||
bool Texture2D::initWithString(const char *text, const char *fontName, float fontSize, const Size& dimensions/* = Size(0, 0)*/, Label::TextAlignment hAlignment/* = Label::TEXT_ALIGNMENT_CENTER */, Label::VerticalTextAlignment vAlignment/* = Label::VERTICAL_TEXT_ALIGNMENT_TOP */)
|
||||
{
|
||||
FontDefinition tempDef;
|
||||
|
||||
|
@ -461,20 +461,20 @@ bool Texture2D::initWithString(const char *text, const FontDefinition& textDefin
|
|||
bool bRet = false;
|
||||
Image::ETextAlign eAlign;
|
||||
|
||||
if (kVerticalTextAlignmentTop == textDefinition._vertAlignment)
|
||||
if (Label::VERTICAL_TEXT_ALIGNMENT_TOP == textDefinition._vertAlignment)
|
||||
{
|
||||
eAlign = (kTextAlignmentCenter == textDefinition._alignment) ? Image::kAlignTop
|
||||
: (kTextAlignmentLeft == textDefinition._alignment) ? Image::kAlignTopLeft : Image::kAlignTopRight;
|
||||
eAlign = (Label::TEXT_ALIGNMENT_CENTER == textDefinition._alignment) ? Image::kAlignTop
|
||||
: (Label::TEXT_ALIGNMENT_LEFT == textDefinition._alignment) ? Image::kAlignTopLeft : Image::kAlignTopRight;
|
||||
}
|
||||
else if (kVerticalTextAlignmentCenter == textDefinition._vertAlignment)
|
||||
else if (Label::VERTICAL_TEXT_ALIGNMENT_CENTER == textDefinition._vertAlignment)
|
||||
{
|
||||
eAlign = (kTextAlignmentCenter == textDefinition._alignment) ? Image::kAlignCenter
|
||||
: (kTextAlignmentLeft == textDefinition._alignment) ? Image::kAlignLeft : Image::kAlignRight;
|
||||
eAlign = (Label::TEXT_ALIGNMENT_CENTER == textDefinition._alignment) ? Image::kAlignCenter
|
||||
: (Label::TEXT_ALIGNMENT_LEFT == textDefinition._alignment) ? Image::kAlignLeft : Image::kAlignRight;
|
||||
}
|
||||
else if (kVerticalTextAlignmentBottom == textDefinition._vertAlignment)
|
||||
else if (Label::VERTICAL_TEXT_ALIGNMENT_BOTTOM == textDefinition._vertAlignment)
|
||||
{
|
||||
eAlign = (kTextAlignmentCenter == textDefinition._alignment) ? Image::kAlignBottom
|
||||
: (kTextAlignmentLeft == textDefinition._alignment) ? Image::kAlignBottomLeft : Image::kAlignBottomRight;
|
||||
eAlign = (Label::TEXT_ALIGNMENT_CENTER == textDefinition._alignment) ? Image::kAlignBottom
|
||||
: (Label::TEXT_ALIGNMENT_LEFT == textDefinition._alignment) ? Image::kAlignBottomLeft : Image::kAlignBottomRight;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
bool initWithImage(Image * uiImage);
|
||||
|
||||
/** Initializes a texture from a string with dimensions, alignment, font name and font size */
|
||||
bool initWithString(const char *text, const char *fontName, float fontSize, const Size& dimensions = Size(0, 0), TextAlignment hAlignment = kTextAlignmentCenter, VerticalTextAlignment vAlignment = kVerticalTextAlignmentTop);
|
||||
bool initWithString(const char *text, const char *fontName, float fontSize, const Size& dimensions = Size(0, 0), Label::TextAlignment hAlignment = Label::TEXT_ALIGNMENT_CENTER, Label::VerticalTextAlignment vAlignment = Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
/** Initializes a texture from a string using a text definition*/
|
||||
bool initWithString(const char *text, const FontDefinition& textDefinition);
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ void LabelTTFLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, co
|
|||
|
||||
void LabelTTFLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_HORIZONTALALIGNMENT) == 0) {
|
||||
((LabelTTF *)pNode)->setHorizontalAlignment(TextAlignment(pIntegerLabeled));
|
||||
((LabelTTF *)pNode)->setHorizontalAlignment(Label::TextAlignment(pIntegerLabeled));
|
||||
} else if(strcmp(pPropertyName, PROPERTY_VERTICALALIGNMENT) == 0) {
|
||||
((LabelTTF *)pNode)->setVerticalAlignment(VerticalTextAlignment(pIntegerLabeled));
|
||||
((LabelTTF *)pNode)->setVerticalAlignment(Label::VerticalTextAlignment(pIntegerLabeled));
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ SocketIOTestLayer::SocketIOTestLayer(void)
|
|||
menuRequest->addChild(itemTestEndpointDisconnect);
|
||||
|
||||
// Sahred Status Label
|
||||
_sioClientStatus = LabelTTF::create("Not connected...", "Arial", 14, Size(320, 100), kTextAlignmentLeft);
|
||||
_sioClientStatus = LabelTTF::create("Not connected...", "Arial", 14, Size(320, 100), Label::TEXT_ALIGNMENT_LEFT);
|
||||
_sioClientStatus->setAnchorPoint(Point(0, 0));
|
||||
_sioClientStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y));
|
||||
this->addChild(_sioClientStatus);
|
||||
|
|
|
@ -49,19 +49,19 @@ WebSocketTestLayer::WebSocketTestLayer()
|
|||
|
||||
|
||||
// Send Text Status Label
|
||||
_sendTextStatus = LabelTTF::create("Send Text WS is waiting...", "Arial", 14, Size(160, 100), kTextAlignmentCenter, kVerticalTextAlignmentTop);
|
||||
_sendTextStatus = LabelTTF::create("Send Text WS is waiting...", "Arial", 14, Size(160, 100), Label::TEXT_ALIGNMENT_CENTER, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
_sendTextStatus->setAnchorPoint(Point(0, 0));
|
||||
_sendTextStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y + 25));
|
||||
this->addChild(_sendTextStatus);
|
||||
|
||||
// Send Binary Status Label
|
||||
_sendBinaryStatus = LabelTTF::create("Send Binary WS is waiting...", "Arial", 14, Size(160, 100), kTextAlignmentCenter, kVerticalTextAlignmentTop);
|
||||
_sendBinaryStatus = LabelTTF::create("Send Binary WS is waiting...", "Arial", 14, Size(160, 100), Label::TEXT_ALIGNMENT_CENTER, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
_sendBinaryStatus->setAnchorPoint(Point(0, 0));
|
||||
_sendBinaryStatus->setPosition(Point(VisibleRect::left().x + 160, VisibleRect::rightBottom().y + 25));
|
||||
this->addChild(_sendBinaryStatus);
|
||||
|
||||
// Error Label
|
||||
_errorStatus = LabelTTF::create("Error WS is waiting...", "Arial", 14, Size(160, 100), kTextAlignmentCenter, kVerticalTextAlignmentTop);
|
||||
_errorStatus = LabelTTF::create("Error WS is waiting...", "Arial", 14, Size(160, 100), Label::TEXT_ALIGNMENT_CENTER, Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
_errorStatus->setAnchorPoint(Point(0, 0));
|
||||
_errorStatus->setPosition(Point(VisibleRect::left().x + 320, VisibleRect::rightBottom().y + 25));
|
||||
this->addChild(_errorStatus);
|
||||
|
|
|
@ -39,11 +39,11 @@ static std::string fontList[] =
|
|||
static int fontCount = sizeof(fontList) / sizeof(*fontList);
|
||||
|
||||
static int vAlignIdx = 0;
|
||||
static VerticalTextAlignment verticalAlignment[] =
|
||||
static Label::VerticalTextAlignment verticalAlignment[] =
|
||||
{
|
||||
kVerticalTextAlignmentTop,
|
||||
kVerticalTextAlignmentCenter,
|
||||
kVerticalTextAlignmentBottom,
|
||||
Label::VERTICAL_TEXT_ALIGNMENT_TOP,
|
||||
Label::VERTICAL_TEXT_ALIGNMENT_CENTER,
|
||||
Label::VERTICAL_TEXT_ALIGNMENT_BOTTOM,
|
||||
};
|
||||
static int vAlignCount = sizeof(verticalAlignment) / sizeof(*verticalAlignment);
|
||||
|
||||
|
@ -99,11 +99,11 @@ void FontTest::showFont(const char *pFont)
|
|||
|
||||
LabelTTF *top = LabelTTF::create(pFont, pFont, 24);
|
||||
LabelTTF *left = LabelTTF::create("alignment left", pFont, fontSize,
|
||||
blockSize, kTextAlignmentLeft, verticalAlignment[vAlignIdx]);
|
||||
blockSize, Label::TEXT_ALIGNMENT_LEFT, verticalAlignment[vAlignIdx]);
|
||||
LabelTTF *center = LabelTTF::create("alignment center", pFont, fontSize,
|
||||
blockSize, kTextAlignmentCenter, verticalAlignment[vAlignIdx]);
|
||||
blockSize, Label::TEXT_ALIGNMENT_CENTER, verticalAlignment[vAlignIdx]);
|
||||
LabelTTF *right = LabelTTF::create("alignment right", pFont, fontSize,
|
||||
blockSize, kTextAlignmentRight, verticalAlignment[vAlignIdx]);
|
||||
blockSize, Label::TEXT_ALIGNMENT_RIGHT, verticalAlignment[vAlignIdx]);
|
||||
|
||||
LayerColor *leftColor = LayerColor::create(Color4B(100, 100, 100, 255), blockSize.width, blockSize.height);
|
||||
LayerColor *centerColor = LayerColor::create(Color4B(200, 100, 100, 255), blockSize.width, blockSize.height);
|
||||
|
|
|
@ -348,19 +348,19 @@ LabelTTFAlignment::LabelTTFAlignment()
|
|||
Size s = Director::getInstance()->getWinSize();
|
||||
|
||||
LabelTTF* ttf0 = LabelTTF::create("Alignment 0\nnew line", "Helvetica", 12,
|
||||
Size(256, 32), kTextAlignmentLeft);
|
||||
Size(256, 32), Label::TEXT_ALIGNMENT_LEFT);
|
||||
ttf0->setPosition(Point(s.width/2,(s.height/6)*2));
|
||||
ttf0->setAnchorPoint(Point(0.5f,0.5f));
|
||||
this->addChild(ttf0);
|
||||
|
||||
LabelTTF* ttf1 = LabelTTF::create("Alignment 1\nnew line", "Helvetica", 12,
|
||||
Size(245, 32), kTextAlignmentCenter);
|
||||
Size(245, 32), Label::TEXT_ALIGNMENT_CENTER);
|
||||
ttf1->setPosition(Point(s.width/2,(s.height/6)*3));
|
||||
ttf1->setAnchorPoint(Point(0.5f,0.5f));
|
||||
this->addChild(ttf1);
|
||||
|
||||
LabelTTF* ttf2 = LabelTTF::create("Alignment 2\nnew line", "Helvetica", 12,
|
||||
Size(245, 32), kTextAlignmentRight);
|
||||
Size(245, 32), Label::TEXT_ALIGNMENT_RIGHT);
|
||||
ttf2->setPosition(Point(s.width/2,(s.height/6)*4));
|
||||
ttf2->setAnchorPoint(Point(0.5f,0.5f));
|
||||
this->addChild(ttf2);
|
||||
|
@ -953,8 +953,8 @@ LabelTTFTest::LabelTTFTest()
|
|||
this->addChild(menu);
|
||||
|
||||
_plabel = NULL;
|
||||
_horizAlign = kTextAlignmentLeft;
|
||||
_vertAlign = kVerticalTextAlignmentTop;
|
||||
_horizAlign = Label::TEXT_ALIGNMENT_LEFT;
|
||||
_vertAlign = Label::VERTICAL_TEXT_ALIGNMENT_TOP;
|
||||
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
@ -988,37 +988,37 @@ void LabelTTFTest::updateAlignment()
|
|||
|
||||
void LabelTTFTest::setAlignmentLeft(Object* pSender)
|
||||
{
|
||||
_horizAlign = kTextAlignmentLeft;
|
||||
_horizAlign = Label::TEXT_ALIGNMENT_LEFT;
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
||||
void LabelTTFTest::setAlignmentCenter(Object* pSender)
|
||||
{
|
||||
_horizAlign = kTextAlignmentCenter;
|
||||
_horizAlign = Label::TEXT_ALIGNMENT_CENTER;
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
||||
void LabelTTFTest::setAlignmentRight(Object* pSender)
|
||||
{
|
||||
_horizAlign = kTextAlignmentRight;
|
||||
_horizAlign = Label::TEXT_ALIGNMENT_RIGHT;
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
||||
void LabelTTFTest::setAlignmentTop(Object* pSender)
|
||||
{
|
||||
_vertAlign = kVerticalTextAlignmentTop;
|
||||
_vertAlign = Label::VERTICAL_TEXT_ALIGNMENT_TOP;
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
||||
void LabelTTFTest::setAlignmentMiddle(Object* pSender)
|
||||
{
|
||||
_vertAlign = kVerticalTextAlignmentCenter;
|
||||
_vertAlign = Label::VERTICAL_TEXT_ALIGNMENT_CENTER;
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
||||
void LabelTTFTest::setAlignmentBottom(Object* pSender)
|
||||
{
|
||||
_vertAlign = kVerticalTextAlignmentBottom;
|
||||
_vertAlign = Label::VERTICAL_TEXT_ALIGNMENT_BOTTOM;
|
||||
this->updateAlignment();
|
||||
}
|
||||
|
||||
|
@ -1027,24 +1027,24 @@ const char* LabelTTFTest::getCurrentAlignment()
|
|||
const char* vertical = NULL;
|
||||
const char* horizontal = NULL;
|
||||
switch (_vertAlign) {
|
||||
case kVerticalTextAlignmentTop:
|
||||
case Label::VERTICAL_TEXT_ALIGNMENT_TOP:
|
||||
vertical = "Top";
|
||||
break;
|
||||
case kVerticalTextAlignmentCenter:
|
||||
case Label::VERTICAL_TEXT_ALIGNMENT_CENTER:
|
||||
vertical = "Middle";
|
||||
break;
|
||||
case kVerticalTextAlignmentBottom:
|
||||
case Label::VERTICAL_TEXT_ALIGNMENT_BOTTOM:
|
||||
vertical = "Bottom";
|
||||
break;
|
||||
}
|
||||
switch (_horizAlign) {
|
||||
case kTextAlignmentLeft:
|
||||
case Label::TEXT_ALIGNMENT_LEFT:
|
||||
horizontal = "Left";
|
||||
break;
|
||||
case kTextAlignmentCenter:
|
||||
case Label::TEXT_ALIGNMENT_CENTER:
|
||||
horizontal = "Center";
|
||||
break;
|
||||
case kTextAlignmentRight:
|
||||
case Label::TEXT_ALIGNMENT_RIGHT:
|
||||
horizontal = "Right";
|
||||
break;
|
||||
}
|
||||
|
@ -1070,8 +1070,8 @@ LabelTTFMultiline::LabelTTFMultiline()
|
|||
"Paint Boy",
|
||||
32,
|
||||
Size(s.width/2,200),
|
||||
kTextAlignmentCenter,
|
||||
kVerticalTextAlignmentTop);
|
||||
Label::TEXT_ALIGNMENT_CENTER,
|
||||
Label::VERTICAL_TEXT_ALIGNMENT_TOP);
|
||||
|
||||
center->setPosition(Point(s.width / 2, 150));
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
|
|||
Size size = Director::getInstance()->getWinSize();
|
||||
|
||||
// create and initialize a Label
|
||||
this->_labelShouldRetain = LabelBMFont::create(LongSentencesExample, "fonts/markerFelt.fnt", size.width/1.5, kTextAlignmentCenter);
|
||||
this->_labelShouldRetain = LabelBMFont::create(LongSentencesExample, "fonts/markerFelt.fnt", size.width/1.5, Label::TEXT_ALIGNMENT_CENTER);
|
||||
this->_labelShouldRetain->retain();
|
||||
|
||||
this->_arrowsBarShouldRetain = Sprite::create("Images/arrowsBar.png");
|
||||
|
@ -1250,13 +1250,13 @@ void BitmapFontMultiLineAlignment::alignmentChanged(cocos2d::Object *sender)
|
|||
switch(item->getTag())
|
||||
{
|
||||
case LeftAlign:
|
||||
this->_labelShouldRetain->setAlignment(kTextAlignmentLeft);
|
||||
this->_labelShouldRetain->setAlignment(Label::TEXT_ALIGNMENT_LEFT);
|
||||
break;
|
||||
case CenterAlign:
|
||||
this->_labelShouldRetain->setAlignment(kTextAlignmentCenter);
|
||||
this->_labelShouldRetain->setAlignment(Label::TEXT_ALIGNMENT_CENTER);
|
||||
break;
|
||||
case RightAlign:
|
||||
this->_labelShouldRetain->setAlignment(kTextAlignmentRight);
|
||||
this->_labelShouldRetain->setAlignment(Label::TEXT_ALIGNMENT_RIGHT);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1348,11 +1348,11 @@ BMFontOneAtlas::BMFontOneAtlas()
|
|||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label1 = LabelBMFont::create("This is Helvetica", "fonts/helvetica-32.fnt", kLabelAutomaticWidth, kTextAlignmentLeft, Point::ZERO);
|
||||
auto label1 = LabelBMFont::create("This is Helvetica", "fonts/helvetica-32.fnt", kLabelAutomaticWidth, Label::TEXT_ALIGNMENT_LEFT, Point::ZERO);
|
||||
addChild(label1);
|
||||
label1->setPosition(Point(s.width/2, s.height/3*2));
|
||||
|
||||
auto label2 = LabelBMFont::create("And this is Geneva", "fonts/geneva-32.fnt", kLabelAutomaticWidth, kTextAlignmentLeft, Point(0, 128));
|
||||
auto label2 = LabelBMFont::create("And this is Geneva", "fonts/geneva-32.fnt", kLabelAutomaticWidth, Label::TEXT_ALIGNMENT_LEFT, Point(0, 128));
|
||||
addChild(label2);
|
||||
label2->setPosition(Point(s.width/2, s.height/3*1));
|
||||
}
|
||||
|
@ -1379,7 +1379,7 @@ BMFontUnicode::BMFontUnicode()
|
|||
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label1 = LabelBMFont::create(spanish, "fonts/arial-unicode-26.fnt", 200, kTextAlignmentLeft);
|
||||
auto label1 = LabelBMFont::create(spanish, "fonts/arial-unicode-26.fnt", 200, Label::TEXT_ALIGNMENT_LEFT);
|
||||
addChild(label1);
|
||||
label1->setPosition(Point(s.width/2, s.height/5*4));
|
||||
|
||||
|
|
|
@ -191,8 +191,8 @@ private:
|
|||
const char* getCurrentAlignment();
|
||||
private:
|
||||
LabelTTF* _plabel;
|
||||
TextAlignment _horizAlign;
|
||||
VerticalTextAlignment _vertAlign;
|
||||
Label::TextAlignment _horizAlign;
|
||||
Label::VerticalTextAlignment _vertAlign;
|
||||
};
|
||||
|
||||
class LabelTTFMultiline : public AtlasDemo
|
||||
|
|
|
@ -1157,12 +1157,12 @@ void ParticleDemo::toggleCallback(Object* pSender)
|
|||
{
|
||||
if (_emitter != NULL)
|
||||
{
|
||||
if (_emitter->getPositionType() == ParticleSystem::GROUPED)
|
||||
_emitter->setPositionType(ParticleSystem::FREE);
|
||||
else if (_emitter->getPositionType() == ParticleSystem::FREE)
|
||||
_emitter->setPositionType(ParticleSystem::RELATIVE);
|
||||
else if (_emitter->getPositionType() == ParticleSystem::RELATIVE)
|
||||
_emitter->setPositionType(ParticleSystem::GROUPED );
|
||||
if (_emitter->getPositionType() == ParticleSystem::POSITION_TYPE_GROUPED)
|
||||
_emitter->setPositionType(ParticleSystem::POSITION_TYPE_FREE);
|
||||
else if (_emitter->getPositionType() == ParticleSystem::POSITION_TYPE_FREE)
|
||||
_emitter->setPositionType(ParticleSystem::POSITION_TYPE_RELATIVE);
|
||||
else if (_emitter->getPositionType() == ParticleSystem::POSITION_TYPE_RELATIVE)
|
||||
_emitter->setPositionType(ParticleSystem::POSITION_TYPE_GROUPED );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ void MultipleParticleSystems::onEnter()
|
|||
|
||||
particleSystem->setPosition(Point(i*50 ,i*50));
|
||||
|
||||
particleSystem->setPositionType(ParticleSystem::GROUPED);
|
||||
particleSystem->setPositionType(ParticleSystem::POSITION_TYPE_GROUPED);
|
||||
addChild(particleSystem);
|
||||
}
|
||||
|
||||
|
@ -1564,7 +1564,7 @@ void MultipleParticleSystemsBatched::onEnter()
|
|||
|
||||
ParticleSystemQuad *particleSystem = ParticleSystemQuad::create("Particles/SpinningPeas.plist");
|
||||
|
||||
particleSystem->setPositionType(ParticleSystem::GROUPED);
|
||||
particleSystem->setPositionType(ParticleSystem::POSITION_TYPE_GROUPED);
|
||||
particleSystem->setPosition(Point(i*50 ,i*50));
|
||||
|
||||
batchNode->setTexture(particleSystem->getTexture());
|
||||
|
@ -1627,7 +1627,7 @@ void AddAndDeleteParticleSystems::onEnter()
|
|||
ParticleSystemQuad *particleSystem = ParticleSystemQuad::create("Particles/Spiral.plist");
|
||||
_batchNode->setTexture(particleSystem->getTexture());
|
||||
|
||||
particleSystem->setPositionType(ParticleSystem::GROUPED);
|
||||
particleSystem->setPositionType(ParticleSystem::POSITION_TYPE_GROUPED);
|
||||
particleSystem->setTotalParticles(200);
|
||||
|
||||
particleSystem->setPosition(Point(i*15 +100,i*15+100));
|
||||
|
@ -1654,7 +1654,7 @@ void AddAndDeleteParticleSystems::removeSystem(float dt)
|
|||
ParticleSystemQuad *particleSystem = ParticleSystemQuad::create("Particles/Spiral.plist");
|
||||
//add new
|
||||
|
||||
particleSystem->setPositionType(ParticleSystem::GROUPED);
|
||||
particleSystem->setPositionType(ParticleSystem::POSITION_TYPE_GROUPED);
|
||||
particleSystem->setTotalParticles(200);
|
||||
|
||||
particleSystem->setPosition(Point(rand() % 300 ,rand() % 400));
|
||||
|
@ -1781,7 +1781,7 @@ void ReorderParticleSystems::onEnter()
|
|||
|
||||
|
||||
_batchNode->addChild(particleSystem);
|
||||
particleSystem->setPositionType(ParticleSystem::FREE);
|
||||
particleSystem->setPositionType(ParticleSystem::POSITION_TYPE_FREE);
|
||||
|
||||
particleSystem->release();
|
||||
|
||||
|
|
|
@ -2232,8 +2232,8 @@ JSBool jsval_to_FontDefinition( JSContext *cx, jsval vp, FontDefinition *out )
|
|||
// defaul values
|
||||
const char * defautlFontName = "Arial";
|
||||
const int defaultFontSize = 32;
|
||||
TextAlignment defaultTextAlignment = kTextAlignmentLeft;
|
||||
VerticalTextAlignment defaultTextVAlignment = kVerticalTextAlignmentTop;
|
||||
Label::TextAlignment defaultTextAlignment = Label::TEXT_ALIGNMENT_LEFT;
|
||||
Label::VerticalTextAlignment defaultTextVAlignment = Label::VERTICAL_TEXT_ALIGNMENT_TOP;
|
||||
|
||||
// by default shadow and stroke are off
|
||||
out->_shadow._shadowEnabled = false;
|
||||
|
@ -2278,7 +2278,7 @@ JSBool jsval_to_FontDefinition( JSContext *cx, jsval vp, FontDefinition *out )
|
|||
JS_GetProperty(cx, jsobj, "fontAlignmentH", &jsr);
|
||||
double fontAlign = 0.0;
|
||||
JS_ValueToNumber(cx, jsr, &fontAlign);
|
||||
out->_alignment = (TextAlignment)(int)fontAlign;
|
||||
out->_alignment = (Label::TextAlignment)(int)fontAlign;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2292,7 +2292,7 @@ JSBool jsval_to_FontDefinition( JSContext *cx, jsval vp, FontDefinition *out )
|
|||
JS_GetProperty(cx, jsobj, "fontAlignmentV", &jsr);
|
||||
double fontAlign = 0.0;
|
||||
JS_ValueToNumber(cx, jsr, &fontAlign);
|
||||
out->_vertAlignment = (VerticalTextAlignment)(int)fontAlign;
|
||||
out->_vertAlignment = (Label::VerticalTextAlignment)(int)fontAlign;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
fe5cebe3d29124b8f96f14c8f048f35450a2b30e
|
||||
ff394f08219b7b2b4684dc07e14812540b28cd6e
|
Loading…
Reference in New Issue