mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' into develop_nutty_modify_framework_fixedupdatebugs
This commit is contained in:
commit
602133a071
3
AUTHORS
3
AUTHORS
|
@ -719,6 +719,9 @@ Developers:
|
||||||
Pisces000221
|
Pisces000221
|
||||||
Corrected a few mistakes in the README file of project-creator.
|
Corrected a few mistakes in the README file of project-creator.
|
||||||
|
|
||||||
|
hbbalfred
|
||||||
|
Fixed a bug that crash if file doesn't exist when using FileUtils::getStringFromFile.
|
||||||
|
|
||||||
Retired Core Developers:
|
Retired Core Developers:
|
||||||
WenSheng Yang
|
WenSheng Yang
|
||||||
Author of windows port, CCTextField,
|
Author of windows port, CCTextField,
|
||||||
|
|
17
CHANGELOG
17
CHANGELOG
|
@ -1,13 +1,26 @@
|
||||||
cocos2d-x-3.0final ?.? ?
|
cocos2d-x-3.0final ?.? ?
|
||||||
[All]
|
[All]
|
||||||
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
|
||||||
[NEW] DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
[NEW] DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
||||||
|
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
||||||
|
[NEW] GLCache: glActiveTexture() is cached with GL::activeTexture(). All code MUST call the cached version in order to work correctly
|
||||||
|
[NEW] Label: Uses a struct of TTF configuration for Label::createWithTTF to reduce parameters and make this interface more easily to use.
|
||||||
|
[NEW] Renderer: Added BatchCommand. This command is not "batchable" with other commands, but improves performance in about 10%
|
||||||
|
|
||||||
|
[FIX] CocoStudio: TestColliderDetector in ArmatureTest can't work.
|
||||||
|
[FIX] Crash if file doesn't exist when using FileUtils::getStringFromFile.
|
||||||
|
[FIX] If setting a shorter string than before while using LabelAtlas, the effect will be wrong.
|
||||||
|
[FIX] Label: Crash when using unknown characters.
|
||||||
|
[FIX] Console: log(format, va_args) is private to prevent possible resolution errors
|
||||||
[FIX] Configuration: dumpInfo() -> getInfo()
|
[FIX] Configuration: dumpInfo() -> getInfo()
|
||||||
[FIX] ControlSlider doesn't support to set selected thumb sprite.
|
[FIX] ControlSlider doesn't support to set selected thumb sprite.
|
||||||
[FIX] ControlButton doesn't support to set scale ratio of touchdown state.
|
[FIX] ControlButton doesn't support to set scale ratio of touchdown state.
|
||||||
[FIX] Particles: Crash was triggered if there is not `textureFileName`section in particle plist file.
|
[FIX] Particles: Crash was triggered if there is not `textureFileName`section in particle plist file.
|
||||||
|
[FIX] Renderer: QuadCommand::init() does not copy the Quads, it only store a reference making the code faster
|
||||||
|
[FIX] Renderer: Performance improved in Sprite and SpriteBatchNode (and subclasses) sprites in about 20%
|
||||||
|
[FIX] Renderer: When note using VAO, call glBufferData() instead of glBufferSubData().
|
||||||
|
[FIX] Sprite: removed _hasChildren optimization. It uses !_children.empty() now which is super fast as well
|
||||||
[FIX] Tests: TestCpp works with CMake on Windows.
|
[FIX] Tests: TestCpp works with CMake on Windows.
|
||||||
[FIX] Tests: Sprites Performance Test has 3 new tests
|
[FIX] Tests: Sprites Performance Test has 4 new tests
|
||||||
[FIX] TextureCache: getTextureForKey and removeTextureForKey work as expected
|
[FIX] TextureCache: getTextureForKey and removeTextureForKey work as expected
|
||||||
[FIX] TextureCache: dumpCachedTextureInfo() -> getCachedTextureInfo()
|
[FIX] TextureCache: dumpCachedTextureInfo() -> getCachedTextureInfo()
|
||||||
[FIX] Websocket doesn't support send/receive data which larger than 4096 bytes.
|
[FIX] Websocket doesn't support send/receive data which larger than 4096 bytes.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3d6ada05d55194dd8e4c10ed8316add7c0d8705c
|
88c095bbe123ab56df3f7870692c6631f4464c8d
|
|
@ -1 +1 @@
|
||||||
2efefc01ff97bda1498d1d4a850ea1881f751f7c
|
1fa58d8cba77ef923c83d2860d5511d28dad6c27
|
|
@ -122,6 +122,7 @@ renderer/CCFrustum.cpp \
|
||||||
renderer/CCGroupCommand.cpp \
|
renderer/CCGroupCommand.cpp \
|
||||||
renderer/CCMaterialManager.cpp \
|
renderer/CCMaterialManager.cpp \
|
||||||
renderer/CCQuadCommand.cpp \
|
renderer/CCQuadCommand.cpp \
|
||||||
|
renderer/CCBatchCommand.cpp \
|
||||||
renderer/CCRenderCommand.cpp \
|
renderer/CCRenderCommand.cpp \
|
||||||
renderer/CCRenderer.cpp \
|
renderer/CCRenderer.cpp \
|
||||||
renderer/CCRenderMaterial.cpp \
|
renderer/CCRenderMaterial.cpp \
|
||||||
|
|
|
@ -158,7 +158,7 @@ void AtlasNode::draw(void)
|
||||||
shader,
|
shader,
|
||||||
_blendFunc,
|
_blendFunc,
|
||||||
_textureAtlas->getQuads(),
|
_textureAtlas->getQuads(),
|
||||||
_textureAtlas->getTotalQuads(),
|
_quadsToDraw,
|
||||||
_modelViewTransform);
|
_modelViewTransform);
|
||||||
|
|
||||||
Director::getInstance()->getRenderer()->addCommand(&_quadCommand);
|
Director::getInstance()->getRenderer()->addCommand(&_quadCommand);
|
||||||
|
|
|
@ -100,6 +100,7 @@ bool FontAtlas::getLetterDefinitionForChar(unsigned short letteCharUTF16, FontL
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
outDefinition.validDefinition = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,84 +32,74 @@
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
Label* Label::createWithTTF(const std::string& label, const std::string& fontFilePath, int fontSize, int lineSize, TextHAlignment alignment, GlyphCollection glyphs, const char *customGlyphs, bool useDistanceField)
|
Label* Label::create()
|
||||||
{
|
{
|
||||||
FontAtlas *tmpAtlas = nullptr;
|
Label *ret = new Label();
|
||||||
if(useDistanceField)
|
|
||||||
tmpAtlas = FontAtlasCache::getFontAtlasTTF(fontFilePath.c_str(), DISTANCEFIELD_ATLAS_FONTSIZE, glyphs, customGlyphs,true);
|
|
||||||
else
|
|
||||||
tmpAtlas = FontAtlasCache::getFontAtlasTTF(fontFilePath.c_str(), fontSize, glyphs, customGlyphs,false);
|
|
||||||
|
|
||||||
if (!tmpAtlas)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
// create the actual label
|
|
||||||
Label* templabel = Label::createWithAtlas(tmpAtlas, alignment, lineSize, useDistanceField,true);
|
|
||||||
|
|
||||||
if (templabel)
|
|
||||||
{
|
|
||||||
if(useDistanceField)
|
|
||||||
templabel->setFontSize(fontSize);
|
|
||||||
templabel->setText(label, lineSize, alignment, false);
|
|
||||||
return templabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Label* Label::createWithBMFont(const std::string& label, const std::string& bmfontFilePath, TextHAlignment alignment, int lineSize)
|
|
||||||
{
|
|
||||||
|
|
||||||
FontAtlas *tmpAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath.c_str());
|
|
||||||
|
|
||||||
if (!tmpAtlas)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Label* templabel = Label::createWithAtlas(tmpAtlas, alignment, lineSize);
|
|
||||||
|
|
||||||
if (templabel)
|
|
||||||
{
|
|
||||||
templabel->setText(label, lineSize, alignment, false);
|
|
||||||
return templabel;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Label* Label::createWithAtlas(FontAtlas *atlas, TextHAlignment alignment, int lineSize, bool useDistanceField,bool useA8Shader)
|
|
||||||
{
|
|
||||||
Label *ret = new Label(atlas, alignment, useDistanceField,useA8Shader);
|
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if( ret->init() )
|
ret->autorelease();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment /* = TextHAlignment::CENTER */, int lineSize /* = 0 */)
|
||||||
|
{
|
||||||
|
Label *ret = new Label();
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (ret->setTTFConfig(ttfConfig))
|
||||||
{
|
{
|
||||||
|
if(ttfConfig.distanceFieldEnabled)
|
||||||
|
ret->setFontSize(ttfConfig.fontSize);
|
||||||
|
ret->setString(text,alignment,lineSize);
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete ret;
|
delete ret;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
Label* Label::createWithTTF(const std::string& text, const std::string& fontFilePath, int fontSize, int lineSize /* = 0 */, TextHAlignment alignment /* = TextHAlignment::CENTER */, GlyphCollection glyphs /* = GlyphCollection::NEHE */, const char *customGlyphs /* = 0 */, bool useDistanceField /* = false */)
|
||||||
|
{
|
||||||
|
TTFConfig ttfConfig(fontFilePath.c_str(),fontSize,glyphs,customGlyphs,useDistanceField);
|
||||||
|
return createWithTTF(ttfConfig,text,alignment,lineSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment /* = TextHAlignment::CENTER */, int lineSize /* = 0 */)
|
||||||
|
{
|
||||||
|
Label *ret = new Label();
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (ret->setBMFontFilePath(bmfontFilePath))
|
||||||
|
{
|
||||||
|
ret->setString(text,alignment,lineSize);
|
||||||
|
ret->autorelease();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete ret;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,bool useA8Shader)
|
Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,bool useA8Shader)
|
||||||
: _reusedLetter(nullptr)
|
: _reusedLetter(nullptr)
|
||||||
, _multilineEnable(true)
|
|
||||||
, _commonLineHeight(0.0f)
|
, _commonLineHeight(0.0f)
|
||||||
, _lineBreakWithoutSpaces(false)
|
, _lineBreakWithoutSpaces(false)
|
||||||
, _width(0.0f)
|
, _width(0.0f)
|
||||||
, _alignment(alignment)
|
, _alignment(alignment)
|
||||||
, _currentUTF16String(0)
|
, _currentUTF16String(nullptr)
|
||||||
, _originalUTF16String(0)
|
, _originalUTF16String(nullptr)
|
||||||
, _advances(nullptr)
|
, _advances(nullptr)
|
||||||
, _fontAtlas(atlas)
|
, _fontAtlas(atlas)
|
||||||
, _isOpacityModifyRGB(true)
|
, _isOpacityModifyRGB(true)
|
||||||
|
@ -118,6 +108,7 @@ Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,b
|
||||||
, _fontSize(0)
|
, _fontSize(0)
|
||||||
, _uniformEffectColor(0)
|
, _uniformEffectColor(0)
|
||||||
{
|
{
|
||||||
|
_cascadeColorEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label::~Label()
|
Label::~Label()
|
||||||
|
@ -137,10 +128,13 @@ bool Label::init()
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
if(_fontAtlas)
|
if(_fontAtlas)
|
||||||
{
|
{
|
||||||
_reusedLetter = Sprite::createWithTexture(&_fontAtlas->getTexture(0));
|
if (_reusedLetter == nullptr)
|
||||||
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
|
{
|
||||||
ret = SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), 30);
|
_reusedLetter = Sprite::createWithTexture(&_fontAtlas->getTexture(0));
|
||||||
_reusedLetter->retain();
|
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||||
|
_reusedLetter->retain();
|
||||||
|
}
|
||||||
|
ret = SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), 30);
|
||||||
}
|
}
|
||||||
if (_useDistanceField)
|
if (_useDistanceField)
|
||||||
setLabelEffect(LabelEffect::NORMAL,Color3B::BLACK);
|
setLabelEffect(LabelEffect::NORMAL,Color3B::BLACK);
|
||||||
|
@ -148,46 +142,94 @@ bool Label::init()
|
||||||
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR));
|
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR));
|
||||||
else
|
else
|
||||||
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::setString(const std::string &stringToRender)
|
bool Label::initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false */, bool useA8Shader /* = false */)
|
||||||
{
|
{
|
||||||
_multilineEnable = true;
|
FontAtlas *oldAtlas = _fontAtlas;
|
||||||
setText(stringToRender, _width, TextHAlignment::CENTER, false);
|
bool oldDistanceFieldEnable = _useDistanceField;
|
||||||
|
bool oldA8ShaderEnabel = _useA8Shader;
|
||||||
|
|
||||||
|
_fontAtlas = atlas;
|
||||||
|
_useDistanceField = distanceFieldEnabled;
|
||||||
|
_useA8Shader = useA8Shader;
|
||||||
|
|
||||||
|
bool ret = Label::init();
|
||||||
|
if (oldAtlas)
|
||||||
|
{
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
FontAtlasCache::releaseFontAtlas(oldAtlas);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_fontAtlas = oldAtlas;
|
||||||
|
_useDistanceField = oldDistanceFieldEnable;
|
||||||
|
_useA8Shader = oldA8ShaderEnabel;
|
||||||
|
Label::init();
|
||||||
|
|
||||||
|
FontAtlasCache::releaseFontAtlas(atlas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_fontAtlas)
|
||||||
|
{
|
||||||
|
_commonLineHeight = _fontAtlas->getCommonLineHeight();
|
||||||
|
if (_currentUTF16String)
|
||||||
|
{
|
||||||
|
alignText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::setString(const std::string &stringToRender,bool multilineEnable)
|
bool Label::setTTFConfig(const TTFConfig& ttfConfig)
|
||||||
{
|
{
|
||||||
_multilineEnable = multilineEnable;
|
FontAtlas *newAtlas = nullptr;
|
||||||
setText(stringToRender, _width, TextHAlignment::CENTER, false);
|
if(ttfConfig.distanceFieldEnabled)
|
||||||
|
newAtlas = FontAtlasCache::getFontAtlasTTF(ttfConfig.fontFilePath, DISTANCEFIELD_ATLAS_FONTSIZE, ttfConfig.glyphs, ttfConfig.customGlyphs,true);
|
||||||
|
else
|
||||||
|
newAtlas = FontAtlasCache::getFontAtlasTTF(ttfConfig.fontFilePath, ttfConfig.fontSize, ttfConfig.glyphs, ttfConfig.customGlyphs,false);
|
||||||
|
|
||||||
|
if (!newAtlas)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return initWithFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Label::setText(const std::string& stringToRender, float lineWidth, TextHAlignment alignment, bool lineBreakWithoutSpaces)
|
bool Label::setBMFontFilePath(const std::string& bmfontFilePath)
|
||||||
{
|
{
|
||||||
if (!_fontAtlas)
|
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath);
|
||||||
|
|
||||||
|
if (!newAtlas)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return initWithFontAtlas(newAtlas);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Label::setString(const std::string& text, const TextHAlignment& alignment /* = TextHAlignment::CENTER */, float lineWidth /* = -1 */, bool lineBreakWithoutSpaces /* = false */)
|
||||||
|
{
|
||||||
|
if (!_fontAtlas || _commonLineHeight <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// carloX
|
// carloX
|
||||||
// reset the string
|
// reset the string
|
||||||
resetCurrentString();
|
resetCurrentString();
|
||||||
|
|
||||||
_width = lineWidth;
|
if(lineWidth >= 0)
|
||||||
|
{
|
||||||
|
_width = lineWidth;
|
||||||
|
}
|
||||||
_alignment = alignment;
|
_alignment = alignment;
|
||||||
_lineBreakWithoutSpaces = lineBreakWithoutSpaces;
|
_lineBreakWithoutSpaces = lineBreakWithoutSpaces;
|
||||||
|
|
||||||
// store locally common line height
|
unsigned short* utf16String = cc_utf8_to_utf16(text.c_str());
|
||||||
_commonLineHeight = _fontAtlas->getCommonLineHeight();
|
|
||||||
if (_commonLineHeight <= 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// int numLetter = 0;
|
|
||||||
unsigned short* utf16String = cc_utf8_to_utf16(stringToRender.c_str());
|
|
||||||
if(!utf16String)
|
if(!utf16String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_cascadeColorEnabled = true;
|
|
||||||
|
|
||||||
setCurrentString(utf16String);
|
setCurrentString(utf16String);
|
||||||
setOriginalString(utf16String);
|
setOriginalString(utf16String);
|
||||||
|
|
||||||
|
@ -299,7 +341,7 @@ void Label::alignText()
|
||||||
_textureAtlas->removeAllQuads();
|
_textureAtlas->removeAllQuads();
|
||||||
_fontAtlas->prepareLetterDefinitions(_currentUTF16String);
|
_fontAtlas->prepareLetterDefinitions(_currentUTF16String);
|
||||||
LabelTextFormatter::createStringSprites(this);
|
LabelTextFormatter::createStringSprites(this);
|
||||||
if(_multilineEnable && LabelTextFormatter::multilineText(this) )
|
if(_width > 0 && LabelTextFormatter::multilineText(this) )
|
||||||
LabelTextFormatter::createStringSprites(this);
|
LabelTextFormatter::createStringSprites(this);
|
||||||
|
|
||||||
LabelTextFormatter::alignText(this);
|
LabelTextFormatter::alignText(this);
|
||||||
|
|
|
@ -54,23 +54,43 @@ enum class LabelEffect {
|
||||||
struct FontLetterDefinition;
|
struct FontLetterDefinition;
|
||||||
class FontAtlas;
|
class FontAtlas;
|
||||||
|
|
||||||
|
typedef struct _ttfConfig
|
||||||
|
{
|
||||||
|
std::string fontFilePath;
|
||||||
|
int fontSize;
|
||||||
|
GlyphCollection glyphs;
|
||||||
|
const char *customGlyphs;
|
||||||
|
bool distanceFieldEnabled;
|
||||||
|
|
||||||
|
_ttfConfig(const char* filePath,int fontSize = 36, const GlyphCollection& glyphs = GlyphCollection::NEHE,
|
||||||
|
const char *customGlyphs = nullptr,bool useDistanceField = false)
|
||||||
|
:fontFilePath(filePath)
|
||||||
|
,fontSize(fontSize)
|
||||||
|
,glyphs(glyphs)
|
||||||
|
,customGlyphs(customGlyphs)
|
||||||
|
,distanceFieldEnabled(useDistanceField)
|
||||||
|
{}
|
||||||
|
}TTFConfig;
|
||||||
|
|
||||||
class CC_DLL Label : public SpriteBatchNode, public LabelProtocol, public LabelTextFormatProtocol
|
class CC_DLL Label : public SpriteBatchNode, public LabelTextFormatProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static Label* create();
|
||||||
|
|
||||||
// static create
|
CC_DEPRECATED_ATTRIBUTE static Label* createWithTTF(const std::string& label, const std::string& fontFilePath, int fontSize, int lineSize = 0, TextHAlignment alignment = TextHAlignment::CENTER, GlyphCollection glyphs = GlyphCollection::NEHE, const char *customGlyphs = 0, bool useDistanceField = false);
|
||||||
static Label* createWithTTF(const std::string& label, const std::string& fontFilePath, int fontSize, int lineSize = 0, TextHAlignment alignment = TextHAlignment::CENTER, GlyphCollection glyphs = GlyphCollection::NEHE, const char *customGlyphs = 0, bool useDistanceField = false);
|
static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment = TextHAlignment::CENTER, int lineWidth = 0);
|
||||||
|
|
||||||
static Label* createWithBMFont(const std::string& label, const std::string& bmfontFilePath, TextHAlignment alignment = TextHAlignment::CENTER, int lineSize = 0);
|
static Label* createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment = TextHAlignment::CENTER, int lineWidth = 0);
|
||||||
|
|
||||||
bool setText(const std::string& stringToRender, float lineWidth, TextHAlignment alignment = TextHAlignment::LEFT, bool lineBreakWithoutSpaces = false);
|
bool setTTFConfig(const TTFConfig& ttfConfig);
|
||||||
|
|
||||||
|
bool setBMFontFilePath(const std::string& bmfontFilePath);
|
||||||
|
|
||||||
|
bool setString(const std::string& text, const TextHAlignment& alignment = TextHAlignment::CENTER, float lineWidth = -1, bool lineBreakWithoutSpaces = false);
|
||||||
|
|
||||||
|
//only support for TTF
|
||||||
void setLabelEffect(LabelEffect effect,const Color3B& effectColor);
|
void setLabelEffect(LabelEffect effect,const Color3B& effectColor);
|
||||||
|
|
||||||
virtual void setString(const std::string &stringToRender) override;
|
|
||||||
void setString(const std::string &stringToRender,bool multilineEnable);
|
|
||||||
virtual void setAlignment(TextHAlignment alignment);
|
virtual void setAlignment(TextHAlignment alignment);
|
||||||
virtual void setWidth(float width);
|
virtual void setWidth(float width);
|
||||||
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||||
|
@ -116,7 +136,7 @@ public:
|
||||||
virtual void setLabelContentSize(const Size &newSize) override;
|
virtual void setLabelContentSize(const Size &newSize) override;
|
||||||
|
|
||||||
// carloX
|
// carloX
|
||||||
virtual const std::string& getString() const override { static std::string _ret("not implemented"); return _ret; }
|
virtual const std::string& getString() const { static std::string _ret("not implemented"); return _ret; }
|
||||||
void addChild(Node * child, int zOrder=0, int tag=0) override;
|
void addChild(Node * child, int zOrder=0, int tag=0) override;
|
||||||
|
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
@ -127,14 +147,14 @@ private:
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField = false,bool useA8Shader = false);
|
Label(FontAtlas *atlas = nullptr, TextHAlignment alignment = TextHAlignment::CENTER, bool useDistanceField = false,bool useA8Shader = false);
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
~Label();
|
~Label();
|
||||||
|
|
||||||
static Label* createWithAtlas(FontAtlas *atlas, TextHAlignment alignment = TextHAlignment::LEFT, int lineSize = 0, bool useDistanceField = false,bool useA8Shader = false);
|
bool initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled = false, bool useA8Shader = false);
|
||||||
|
|
||||||
void setFontSize(int fontSize);
|
void setFontSize(int fontSize);
|
||||||
|
|
||||||
|
@ -151,12 +171,10 @@ private:
|
||||||
|
|
||||||
virtual void updateColor() override;
|
virtual void updateColor() override;
|
||||||
|
|
||||||
|
|
||||||
//! used for optimization
|
//! used for optimization
|
||||||
Sprite *_reusedLetter;
|
Sprite *_reusedLetter;
|
||||||
std::vector<LetterInfo> _lettersInfo;
|
std::vector<LetterInfo> _lettersInfo;
|
||||||
|
|
||||||
bool _multilineEnable;
|
|
||||||
float _commonLineHeight;
|
float _commonLineHeight;
|
||||||
bool _lineBreakWithoutSpaces;
|
bool _lineBreakWithoutSpaces;
|
||||||
float _width;
|
float _width;
|
||||||
|
|
|
@ -275,8 +275,7 @@ std::set<unsigned int>* CCBMFontConfiguration::parseBinaryConfigFile(unsigned ch
|
||||||
|
|
||||||
unsigned long remains = size;
|
unsigned long remains = size;
|
||||||
|
|
||||||
unsigned char version = pData[3];
|
CCASSERT(pData[3] == 3, "Only version 3 is supported");
|
||||||
CCASSERT(version == 3, "Only version 3 is supported");
|
|
||||||
|
|
||||||
pData += 4; remains -= 4;
|
pData += 4; remains -= 4;
|
||||||
|
|
||||||
|
@ -343,8 +342,7 @@ std::set<unsigned int>* CCBMFontConfiguration::parseBinaryConfigFile(unsigned ch
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *value = (const char *)pData;
|
const char *value = (const char *)pData;
|
||||||
size_t len = strlen(value);
|
CCASSERT(strlen(value) < blockSize, "Block size should be less then string");
|
||||||
CCASSERT(len < blockSize, "Block size should be less then string");
|
|
||||||
|
|
||||||
_atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(value, controlFile);
|
_atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(value, controlFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,15 +68,19 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
|
||||||
while (info->def.validDefinition == false)
|
while (info->def.validDefinition == false)
|
||||||
{
|
{
|
||||||
justSkipped++;
|
justSkipped++;
|
||||||
info = &leterInfo->at( j+skip+justSkipped );
|
tIndex = j+skip+justSkipped;
|
||||||
|
if(tIndex < strLen)
|
||||||
|
info = &leterInfo->at( tIndex );
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
skip += justSkipped;
|
skip += justSkipped;
|
||||||
tIndex = j + skip;
|
tIndex = j + skip;
|
||||||
|
|
||||||
if (i >= stringLength)
|
if (tIndex >= stringLength)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
unsigned short character = strWhole[i];
|
unsigned short character = strWhole[tIndex];
|
||||||
|
|
||||||
if (!isStartOfWord)
|
if (!isStartOfWord)
|
||||||
{
|
{
|
||||||
|
@ -241,8 +245,6 @@ bool LabelTextFormatter::alignText(LabelTextFormatProtocol *theLabel)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int index = static_cast<int>(i + lineLength - 1 + lineNumber);
|
int index = static_cast<int>(i + lineLength - 1 + lineNumber);
|
||||||
if(currentChar == 0)
|
|
||||||
index -= 1;
|
|
||||||
if (index < 0) continue;
|
if (index < 0) continue;
|
||||||
|
|
||||||
LetterInfo* info = &leterInfo->at( index );
|
LetterInfo* info = &leterInfo->at( index );
|
||||||
|
|
|
@ -382,26 +382,14 @@ void ParticleBatchNode::draw(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CC_NODE_DRAW_SETUP();
|
_batchCommand.init(0,
|
||||||
//
|
_vertexZ,
|
||||||
// GL::blendFunc( _blendFunc.src, _blendFunc.dst );
|
_textureAtlas->getTexture()->getName(),
|
||||||
//
|
_shaderProgram,
|
||||||
// _textureAtlas->drawQuads();
|
_blendFunc,
|
||||||
|
_textureAtlas,
|
||||||
auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP);
|
_modelViewTransform);
|
||||||
|
Director::getInstance()->getRenderer()->addCommand(&_batchCommand);
|
||||||
kmMat4 mv;
|
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &mv);
|
|
||||||
|
|
||||||
_quadCommand.init(0,
|
|
||||||
_vertexZ,
|
|
||||||
_textureAtlas->getTexture()->getName(),
|
|
||||||
shader,
|
|
||||||
_blendFunc,
|
|
||||||
_textureAtlas->getQuads(),
|
|
||||||
_textureAtlas->getTotalQuads(),
|
|
||||||
mv);
|
|
||||||
Director::getInstance()->getRenderer()->addCommand(&_quadCommand);
|
|
||||||
CC_PROFILER_STOP("CCParticleBatchNode - draw");
|
CC_PROFILER_STOP("CCParticleBatchNode - draw");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "CCNode.h"
|
#include "CCNode.h"
|
||||||
#include "CCProtocols.h"
|
#include "CCProtocols.h"
|
||||||
#include "renderer/CCQuadCommand.h"
|
#include "renderer/CCBatchCommand.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ private:
|
||||||
/** the blend function used for drawing the quads */
|
/** the blend function used for drawing the quads */
|
||||||
BlendFunc _blendFunc;
|
BlendFunc _blendFunc;
|
||||||
// quad command
|
// quad command
|
||||||
QuadCommand _quadCommand;
|
BatchCommand _batchCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of particle_nodes group
|
// end of particle_nodes group
|
||||||
|
|
|
@ -243,8 +243,6 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
||||||
// zwoptex default values
|
// zwoptex default values
|
||||||
_offsetPosition = Point::ZERO;
|
_offsetPosition = Point::ZERO;
|
||||||
|
|
||||||
_hasChildren = false;
|
|
||||||
|
|
||||||
// clean the Quad
|
// clean the Quad
|
||||||
memset(&_quad, 0, sizeof(_quad));
|
memset(&_quad, 0, sizeof(_quad));
|
||||||
|
|
||||||
|
@ -767,7 +765,6 @@ void Sprite::addChild(Node *child, int zOrder, int tag)
|
||||||
}
|
}
|
||||||
//CCNode already sets isReorderChildDirty_ so this needs to be after batchNode check
|
//CCNode already sets isReorderChildDirty_ so this needs to be after batchNode check
|
||||||
Node::addChild(child, zOrder, tag);
|
Node::addChild(child, zOrder, tag);
|
||||||
_hasChildren = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::reorderChild(Node *child, int zOrder)
|
void Sprite::reorderChild(Node *child, int zOrder)
|
||||||
|
@ -813,8 +810,6 @@ void Sprite::removeAllChildrenWithCleanup(bool cleanup)
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::removeAllChildrenWithCleanup(cleanup);
|
Node::removeAllChildrenWithCleanup(cleanup);
|
||||||
|
|
||||||
_hasChildren = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::sortAllChildren()
|
void Sprite::sortAllChildren()
|
||||||
|
@ -882,27 +877,24 @@ void Sprite::setDirtyRecursively(bool bValue)
|
||||||
{
|
{
|
||||||
_recursiveDirty = bValue;
|
_recursiveDirty = bValue;
|
||||||
setDirty(bValue);
|
setDirty(bValue);
|
||||||
// recursively set dirty
|
|
||||||
if (_hasChildren)
|
for(const auto &child: _children) {
|
||||||
{
|
Sprite* sp = dynamic_cast<Sprite*>(child);
|
||||||
for(const auto &child: _children) {
|
if (sp)
|
||||||
Sprite* sp = dynamic_cast<Sprite*>(child);
|
{
|
||||||
if (sp)
|
sp->setDirtyRecursively(true);
|
||||||
{
|
|
||||||
sp->setDirtyRecursively(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX HACK: optimization
|
// XXX HACK: optimization
|
||||||
#define SET_DIRTY_RECURSIVELY() { \
|
#define SET_DIRTY_RECURSIVELY() { \
|
||||||
if (! _recursiveDirty) { \
|
if (! _recursiveDirty) { \
|
||||||
_recursiveDirty = true; \
|
_recursiveDirty = true; \
|
||||||
setDirty(true); \
|
setDirty(true); \
|
||||||
if ( _hasChildren) \
|
if (!_children.empty()) \
|
||||||
setDirtyRecursively(true); \
|
setDirtyRecursively(true); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::setPosition(const Point& pos)
|
void Sprite::setPosition(const Point& pos)
|
||||||
|
|
|
@ -538,7 +538,6 @@ protected:
|
||||||
|
|
||||||
bool _dirty; /// Whether the sprite needs to be updated
|
bool _dirty; /// Whether the sprite needs to be updated
|
||||||
bool _recursiveDirty; /// Whether all of the sprite's children needs to be updated
|
bool _recursiveDirty; /// Whether all of the sprite's children needs to be updated
|
||||||
bool _hasChildren; /// Whether the sprite contains children
|
|
||||||
bool _shouldBeHidden; /// should not be drawn because one of the ancestors is not visible
|
bool _shouldBeHidden; /// should not be drawn because one of the ancestors is not visible
|
||||||
kmMat4 _transformToBatch;
|
kmMat4 _transformToBatch;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool SpriteBatchNode::initWithTexture(Texture2D *tex, ssize_t capacity)
|
||||||
|
|
||||||
_descendants.reserve(capacity);
|
_descendants.reserve(capacity);
|
||||||
|
|
||||||
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,18 +356,14 @@ void SpriteBatchNode::draw()
|
||||||
for(const auto &child: _children)
|
for(const auto &child: _children)
|
||||||
child->updateTransform();
|
child->updateTransform();
|
||||||
|
|
||||||
kmMat4 mv;
|
_batchCommand.init(0,
|
||||||
kmGLGetMatrix(KM_GL_MODELVIEW, &mv);
|
_vertexZ,
|
||||||
|
_textureAtlas->getTexture()->getName(),
|
||||||
_quadCommand.init(0,
|
_shaderProgram,
|
||||||
_vertexZ,
|
_blendFunc,
|
||||||
_textureAtlas->getTexture()->getName(),
|
_textureAtlas,
|
||||||
_shaderProgram,
|
_modelViewTransform);
|
||||||
_blendFunc,
|
Director::getInstance()->getRenderer()->addCommand(&_batchCommand);
|
||||||
_textureAtlas->getQuads(),
|
|
||||||
_textureAtlas->getTotalQuads(),
|
|
||||||
mv);
|
|
||||||
Director::getInstance()->getRenderer()->addCommand(&_quadCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatchNode::increaseAtlasCapacity(void)
|
void SpriteBatchNode::increaseAtlasCapacity(void)
|
||||||
|
|
|
@ -35,7 +35,7 @@ THE SOFTWARE.
|
||||||
#include "CCProtocols.h"
|
#include "CCProtocols.h"
|
||||||
#include "CCTextureAtlas.h"
|
#include "CCTextureAtlas.h"
|
||||||
#include "ccMacros.h"
|
#include "ccMacros.h"
|
||||||
#include "renderer/CCQuadCommand.h"
|
#include "renderer/CCBatchCommand.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ protected:
|
||||||
|
|
||||||
TextureAtlas *_textureAtlas;
|
TextureAtlas *_textureAtlas;
|
||||||
BlendFunc _blendFunc;
|
BlendFunc _blendFunc;
|
||||||
QuadCommand _quadCommand; // quad command
|
BatchCommand _batchCommand; // render command
|
||||||
|
|
||||||
// all descendants: children, grand children, etc...
|
// all descendants: children, grand children, etc...
|
||||||
// There is not need to retain/release these objects, since they are already retained by _children
|
// There is not need to retain/release these objects, since they are already retained by _children
|
||||||
|
|
|
@ -144,6 +144,7 @@ set(COCOS2D_SRC
|
||||||
renderer/CCGroupCommand.cpp
|
renderer/CCGroupCommand.cpp
|
||||||
renderer/CCMaterialManager.cpp
|
renderer/CCMaterialManager.cpp
|
||||||
renderer/CCQuadCommand.cpp
|
renderer/CCQuadCommand.cpp
|
||||||
|
renderer/CCBatchCommand.cpp
|
||||||
renderer/CCRenderCommand.cpp
|
renderer/CCRenderCommand.cpp
|
||||||
renderer/CCRenderer.cpp
|
renderer/CCRenderer.cpp
|
||||||
renderer/CCRenderMaterial.cpp
|
renderer/CCRenderMaterial.cpp
|
||||||
|
|
|
@ -73,7 +73,7 @@ void ccArrayEnsureExtraCapacity(ccArray *arr, ssize_t extra)
|
||||||
{
|
{
|
||||||
while (arr->max < arr->num + extra)
|
while (arr->max < arr->num + extra)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: ccCArray: resizing ccArray capacity from [%d] to [%d].",
|
CCLOGINFO("cocos2d: ccCArray: resizing ccArray capacity from [%d] to [%d].",
|
||||||
static_cast<int>(arr->max),
|
static_cast<int>(arr->max),
|
||||||
static_cast<int>(arr->max*2));
|
static_cast<int>(arr->max*2));
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ namespace
|
||||||
static bool s_vertexAttribColor = false;
|
static bool s_vertexAttribColor = false;
|
||||||
static bool s_vertexAttribTexCoords = false;
|
static bool s_vertexAttribTexCoords = false;
|
||||||
|
|
||||||
|
|
||||||
#if CC_ENABLE_GL_STATE_CACHE
|
#if CC_ENABLE_GL_STATE_CACHE
|
||||||
|
|
||||||
#define kMaxActiveTexture 16
|
#define kMaxActiveTexture 16
|
||||||
|
@ -55,6 +54,8 @@ namespace
|
||||||
static GLenum s_blendingDest = -1;
|
static GLenum s_blendingDest = -1;
|
||||||
static int s_GLServerState = 0;
|
static int s_GLServerState = 0;
|
||||||
static GLuint s_VAO = 0;
|
static GLuint s_VAO = 0;
|
||||||
|
static GLenum s_activeTexture = -1;
|
||||||
|
|
||||||
#endif // CC_ENABLE_GL_STATE_CACHE
|
#endif // CC_ENABLE_GL_STATE_CACHE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ void bindTexture2DN(GLuint textureUnit, GLuint textureId)
|
||||||
if (s_currentBoundTexture[textureUnit] != textureId)
|
if (s_currentBoundTexture[textureUnit] != textureId)
|
||||||
{
|
{
|
||||||
s_currentBoundTexture[textureUnit] = textureId;
|
s_currentBoundTexture[textureUnit] = textureId;
|
||||||
glActiveTexture(GL_TEXTURE0 + textureUnit);
|
activeTexture(GL_TEXTURE0 + textureUnit);
|
||||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -186,6 +187,18 @@ void deleteTextureN(GLuint textureUnit, GLuint textureId)
|
||||||
glDeleteTextures(1, &textureId);
|
glDeleteTextures(1, &textureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void activeTexture(GLenum texture)
|
||||||
|
{
|
||||||
|
#if CC_ENABLE_GL_STATE_CACHE
|
||||||
|
if(s_activeTexture != texture) {
|
||||||
|
s_activeTexture = texture;
|
||||||
|
glActiveTexture(s_activeTexture);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
glActiveTexture(texture);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void bindVAO(GLuint vaoId)
|
void bindVAO(GLuint vaoId)
|
||||||
{
|
{
|
||||||
if (Configuration::getInstance()->supportsShareableVAO())
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
|
|
|
@ -129,6 +129,12 @@ void CC_DLL deleteTexture(GLuint textureId);
|
||||||
*/
|
*/
|
||||||
void CC_DLL deleteTextureN(GLuint textureUnit, GLuint textureId);
|
void CC_DLL deleteTextureN(GLuint textureUnit, GLuint textureId);
|
||||||
|
|
||||||
|
/** Select active texture unit.
|
||||||
|
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.
|
||||||
|
@since v3.0
|
||||||
|
*/
|
||||||
|
void CC_DLL activeTexture(GLenum texture);
|
||||||
|
|
||||||
/** If the vertex array is not already bound, it binds it.
|
/** If the vertex array is not already bound, it binds it.
|
||||||
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
|
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
|
||||||
@since v2.0.0
|
@since v2.0.0
|
||||||
|
|
|
@ -279,7 +279,7 @@ cc_utf8_get_char (const char * p)
|
||||||
|
|
||||||
unsigned short* cc_utf8_to_utf16(const char* str_old, int length/* = -1 */, int* rUtf16Size/* = nullptr */)
|
unsigned short* cc_utf8_to_utf16(const char* str_old, int length/* = -1 */, int* rUtf16Size/* = nullptr */)
|
||||||
{
|
{
|
||||||
unsigned short len = cc_utf8_strlen(str_old, length);
|
long len = cc_utf8_strlen(str_old, length);
|
||||||
if (rUtf16Size != nullptr) {
|
if (rUtf16Size != nullptr) {
|
||||||
*rUtf16Size = len;
|
*rUtf16Size = len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,6 +317,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
<ClCompile Include="platform\win32\CCFileUtilsWin32.cpp" />
|
<ClCompile Include="platform\win32\CCFileUtilsWin32.cpp" />
|
||||||
<ClCompile Include="platform\win32\CCImage.cpp" />
|
<ClCompile Include="platform\win32\CCImage.cpp" />
|
||||||
<ClCompile Include="platform\win32\CCStdC.cpp" />
|
<ClCompile Include="platform\win32\CCStdC.cpp" />
|
||||||
|
<ClCompile Include="renderer\CCBatchCommand.cpp" />
|
||||||
<ClCompile Include="renderer\CCCustomCommand.cpp" />
|
<ClCompile Include="renderer\CCCustomCommand.cpp" />
|
||||||
<ClCompile Include="renderer\CCFrustum.cpp" />
|
<ClCompile Include="renderer\CCFrustum.cpp" />
|
||||||
<ClCompile Include="renderer\CCGroupCommand.cpp" />
|
<ClCompile Include="renderer\CCGroupCommand.cpp" />
|
||||||
|
@ -521,6 +522,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
<ClInclude Include="platform\win32\CCGL.h" />
|
<ClInclude Include="platform\win32\CCGL.h" />
|
||||||
<ClInclude Include="platform\win32\CCPlatformDefine.h" />
|
<ClInclude Include="platform\win32\CCPlatformDefine.h" />
|
||||||
<ClInclude Include="platform\win32\CCStdC.h" />
|
<ClInclude Include="platform\win32\CCStdC.h" />
|
||||||
|
<ClInclude Include="renderer\CCBatchCommand.h" />
|
||||||
<ClInclude Include="renderer\CCCustomCommand.h" />
|
<ClInclude Include="renderer\CCCustomCommand.h" />
|
||||||
<ClInclude Include="renderer\CCFrustum.h" />
|
<ClInclude Include="renderer\CCFrustum.h" />
|
||||||
<ClInclude Include="renderer\CCGroupCommand.h" />
|
<ClInclude Include="renderer\CCGroupCommand.h" />
|
||||||
|
|
|
@ -598,6 +598,9 @@
|
||||||
<ClCompile Include="renderer\CCRenderMaterial.cpp">
|
<ClCompile Include="renderer\CCRenderMaterial.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="renderer\CCBatchCommand.cpp">
|
||||||
|
<Filter>renderer</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||||
|
@ -1207,5 +1210,8 @@
|
||||||
<ClInclude Include="renderer\CCRenderMaterial.h">
|
<ClInclude Include="renderer\CCRenderMaterial.h">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="renderer\CCBatchCommand.h">
|
||||||
|
<Filter>renderer</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -547,6 +547,8 @@ static Data getData(const std::string& filename, bool forString)
|
||||||
std::string FileUtils::getStringFromFile(const std::string& filename)
|
std::string FileUtils::getStringFromFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
Data data = getData(filename, true);
|
Data data = getData(filename, true);
|
||||||
|
if (data.isNull())
|
||||||
|
return "";
|
||||||
std::string ret((const char*)data.getBytes());
|
std::string ret((const char*)data.getBytes());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,38 +89,43 @@ public class Cocos2dxHelper {
|
||||||
jobs.add(r);
|
jobs.add(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean sInited = false;
|
||||||
public static void init(final Activity activity) {
|
public static void init(final Activity activity) {
|
||||||
final ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
if (!sInited) {
|
||||||
|
final ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||||
|
|
||||||
initListener();
|
initListener();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get the lib_name from AndroidManifest.xml metadata
|
// Get the lib_name from AndroidManifest.xml metadata
|
||||||
ActivityInfo ai =
|
ActivityInfo ai =
|
||||||
activity.getPackageManager().getActivityInfo(activity.getIntent().getComponent(), PackageManager.GET_META_DATA);
|
activity.getPackageManager().getActivityInfo(activity.getIntent().getComponent(), PackageManager.GET_META_DATA);
|
||||||
if (null != ai.metaData) {
|
if (null != ai.metaData) {
|
||||||
String lib_name = ai.metaData.getString(META_DATA_LIB_NAME);
|
String lib_name = ai.metaData.getString(META_DATA_LIB_NAME);
|
||||||
if (null != lib_name) {
|
if (null != lib_name) {
|
||||||
System.loadLibrary(lib_name);
|
System.loadLibrary(lib_name);
|
||||||
} else {
|
} else {
|
||||||
System.loadLibrary(DEFAULT_LIB_NAME);
|
System.loadLibrary(DEFAULT_LIB_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
throw new RuntimeException("Error getting activity info", e);
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
throw new RuntimeException("Error getting activity info", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Cocos2dxHelper.sPackageName = applicationInfo.packageName;
|
Cocos2dxHelper.sPackageName = applicationInfo.packageName;
|
||||||
Cocos2dxHelper.sFileDirectory = activity.getFilesDir().getAbsolutePath();
|
Cocos2dxHelper.sFileDirectory = activity.getFilesDir().getAbsolutePath();
|
||||||
//Cocos2dxHelper.nativeSetApkPath(applicationInfo.sourceDir);
|
//Cocos2dxHelper.nativeSetApkPath(applicationInfo.sourceDir);
|
||||||
|
|
||||||
Cocos2dxHelper.sCocos2dMusic = new Cocos2dxMusic(activity);
|
Cocos2dxHelper.sCocos2dMusic = new Cocos2dxMusic(activity);
|
||||||
Cocos2dxHelper.sCocos2dSound = new Cocos2dxSound(activity);
|
Cocos2dxHelper.sCocos2dSound = new Cocos2dxSound(activity);
|
||||||
Cocos2dxHelper.sAssetManager = activity.getAssets();
|
Cocos2dxHelper.sAssetManager = activity.getAssets();
|
||||||
|
|
||||||
//Cocos2dxHelper.nativeSetAssetManager(sAssetManager);
|
//Cocos2dxHelper.nativeSetAssetManager(sAssetManager);
|
||||||
Cocos2dxBitmap.setContext(activity);
|
Cocos2dxBitmap.setContext(activity);
|
||||||
sActivity = activity;
|
sActivity = activity;
|
||||||
|
|
||||||
|
sInited = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initListener() {
|
public static void initListener() {
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||||
|
|
||||||
|
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.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "renderer/CCBatchCommand.h"
|
||||||
|
#include "ccGLStateCache.h"
|
||||||
|
#include "CCTextureAtlas.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
BatchCommand::BatchCommand()
|
||||||
|
: _viewport(0)
|
||||||
|
, _depth(0)
|
||||||
|
, _textureID(0)
|
||||||
|
, _blendType(BlendFunc::DISABLE)
|
||||||
|
, _textureAtlas(nullptr)
|
||||||
|
{
|
||||||
|
_type = RenderCommand::Type::BATCH_COMMAND;
|
||||||
|
_shader = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BatchCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram* shader, BlendFunc blendType, TextureAtlas *textureAtlas, const kmMat4& modelViewTransform)
|
||||||
|
{
|
||||||
|
_viewport = viewport;
|
||||||
|
_depth = depth;
|
||||||
|
_textureID = textureID;
|
||||||
|
_blendType = blendType;
|
||||||
|
_shader = shader;
|
||||||
|
|
||||||
|
_textureAtlas = textureAtlas;
|
||||||
|
|
||||||
|
_mv = modelViewTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
BatchCommand::~BatchCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t BatchCommand::generateID()
|
||||||
|
{
|
||||||
|
_id = 0;
|
||||||
|
|
||||||
|
//Generate Material ID
|
||||||
|
//TODO fix shader ID generation
|
||||||
|
CCASSERT(_shader->getProgram() < pow(2,10), "ShaderID is greater than 2^10");
|
||||||
|
//TODO fix texture ID generation
|
||||||
|
CCASSERT(_textureID < pow(2,18), "TextureID is greater than 2^18");
|
||||||
|
|
||||||
|
//TODO fix blend id generation
|
||||||
|
int blendID = 0;
|
||||||
|
if(_blendType == BlendFunc::DISABLE)
|
||||||
|
{
|
||||||
|
blendID = 0;
|
||||||
|
}
|
||||||
|
else if(_blendType == BlendFunc::ALPHA_PREMULTIPLIED)
|
||||||
|
{
|
||||||
|
blendID = 1;
|
||||||
|
}
|
||||||
|
else if(_blendType == BlendFunc::ALPHA_NON_PREMULTIPLIED)
|
||||||
|
{
|
||||||
|
blendID = 2;
|
||||||
|
}
|
||||||
|
else if(_blendType == BlendFunc::ADDITIVE)
|
||||||
|
{
|
||||||
|
blendID = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blendID = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO Material ID should be part of the ID
|
||||||
|
//
|
||||||
|
// Temporal hack (later, these 32-bits should be packed in 24-bits
|
||||||
|
//
|
||||||
|
// +---------------------+-------------------+----------------------+
|
||||||
|
// | Shader ID (10 bits) | Blend ID (4 bits) | Texture ID (18 bits) |
|
||||||
|
// +---------------------+-------------------+----------------------+
|
||||||
|
|
||||||
|
_materialID = (int32_t)_shader->getProgram() << 22
|
||||||
|
| (int32_t)blendID << 18
|
||||||
|
| (int32_t)_textureID << 0;
|
||||||
|
|
||||||
|
//Generate RenderCommandID
|
||||||
|
_id = (int64_t)_viewport << 61
|
||||||
|
| (int64_t)1 << 60 //translucent
|
||||||
|
| (int64_t)_depth << 36;
|
||||||
|
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BatchCommand::execute()
|
||||||
|
{
|
||||||
|
// Set material
|
||||||
|
_shader->use();
|
||||||
|
_shader->setUniformsForBuiltins(_mv);
|
||||||
|
GL::bindTexture2D(_textureID);
|
||||||
|
GL::blendFunc(_blendType.src, _blendType.dst);
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
_textureAtlas->drawQuads();
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
|
@ -0,0 +1,81 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||||
|
|
||||||
|
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 _CC_BATCHCOMMAND_H_
|
||||||
|
#define _CC_BATCHCOMMAND_H_
|
||||||
|
|
||||||
|
#include "CCRenderCommand.h"
|
||||||
|
#include "CCGLProgram.h"
|
||||||
|
#include "CCRenderCommandPool.h"
|
||||||
|
#include "kazmath/kazmath.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
class TextureAtlas;
|
||||||
|
|
||||||
|
#define CC_NO_TEXTURE 0
|
||||||
|
|
||||||
|
class BatchCommand : public RenderCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
BatchCommand();
|
||||||
|
~BatchCommand();
|
||||||
|
|
||||||
|
void init(int viewport, int32_t depth, GLuint texutreID, GLProgram* shader, BlendFunc blendType, TextureAtlas *textureAtlas, const kmMat4& modelViewTransform);
|
||||||
|
|
||||||
|
// +----------+----------+-----+-----------------------------------+
|
||||||
|
// | | | | | |
|
||||||
|
// | ViewPort | Transluc | | Depth | Material ID |
|
||||||
|
// | 3 bits | 1 bit | | 24 bits | 24 bit2 |
|
||||||
|
// +----------+----------+-----+----------------+------------------+
|
||||||
|
virtual int64_t generateID();
|
||||||
|
|
||||||
|
void execute();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int32_t _materialID;
|
||||||
|
|
||||||
|
//Key Data
|
||||||
|
int _viewport; /// Which view port it belongs to
|
||||||
|
|
||||||
|
//TODO use material to determine if it's translucent
|
||||||
|
int32_t _depth;
|
||||||
|
|
||||||
|
//Maternal
|
||||||
|
GLuint _textureID;
|
||||||
|
|
||||||
|
GLProgram* _shader;
|
||||||
|
// GLuint _shaderID;
|
||||||
|
|
||||||
|
BlendFunc _blendType;
|
||||||
|
|
||||||
|
TextureAtlas *_textureAtlas;
|
||||||
|
|
||||||
|
// ModelView transform
|
||||||
|
kmMat4 _mv;
|
||||||
|
};
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
|
#endif //_CC_BATCHCOMMAND_H_
|
|
@ -27,8 +27,7 @@
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
CustomCommand::CustomCommand()
|
CustomCommand::CustomCommand()
|
||||||
:RenderCommand()
|
: func(nullptr)
|
||||||
, func(nullptr)
|
|
||||||
, _viewport(0)
|
, _viewport(0)
|
||||||
, _depth(0)
|
, _depth(0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,8 +86,7 @@ void GroupCommandManager::releaseGroupID(int groupID)
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupCommand::GroupCommand()
|
GroupCommand::GroupCommand()
|
||||||
:RenderCommand()
|
: _viewport(0)
|
||||||
, _viewport(0)
|
|
||||||
, _depth(0)
|
, _depth(0)
|
||||||
{
|
{
|
||||||
_type = RenderCommand::Type::GROUP_COMMAND;
|
_type = RenderCommand::Type::GROUP_COMMAND;
|
||||||
|
|
|
@ -29,17 +29,15 @@
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
QuadCommand::QuadCommand()
|
QuadCommand::QuadCommand()
|
||||||
:RenderCommand()
|
:_viewport(0)
|
||||||
,_viewport(0)
|
|
||||||
,_depth(0)
|
,_depth(0)
|
||||||
,_textureID(0)
|
,_textureID(0)
|
||||||
,_blendType(BlendFunc::DISABLE)
|
,_blendType(BlendFunc::DISABLE)
|
||||||
,_quadCount(0)
|
,_quadsCount(0)
|
||||||
,_capacity(0)
|
|
||||||
{
|
{
|
||||||
_type = RenderCommand::Type::QUAD_COMMAND;
|
_type = RenderCommand::Type::QUAD_COMMAND;
|
||||||
_shader = nullptr;
|
_shader = nullptr;
|
||||||
_quad = nullptr;
|
_quads = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram* shader, BlendFunc blendType, V3F_C4B_T2F_Quad* quad, ssize_t quadCount, const kmMat4 &mv)
|
void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram* shader, BlendFunc blendType, V3F_C4B_T2F_Quad* quad, ssize_t quadCount, const kmMat4 &mv)
|
||||||
|
@ -48,63 +46,16 @@ void QuadCommand::init(int viewport, int32_t depth, GLuint textureID, GLProgram*
|
||||||
_depth = depth;
|
_depth = depth;
|
||||||
_textureID = textureID;
|
_textureID = textureID;
|
||||||
_blendType = blendType;
|
_blendType = blendType;
|
||||||
_quadCount = quadCount;
|
|
||||||
_shader = shader;
|
_shader = shader;
|
||||||
|
|
||||||
if(quadCount > _capacity ) {
|
_quadsCount = quadCount;
|
||||||
//TODO find a better way to manage quads, current way will result in memory be wasted
|
_quads = quad;
|
||||||
// _quad = (V3F_C4B_T2F_Quad*)malloc(sizeof(V3F_C4B_T2F_Quad) * quadCount);
|
|
||||||
_quad = (V3F_C4B_T2F_Quad*) realloc(_quad, sizeof(*quad) * quadCount );
|
|
||||||
_capacity = quadCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
_quadCount = quadCount;
|
_mv = mv;
|
||||||
memcpy(_quad, quad, sizeof(V3F_C4B_T2F_Quad) * quadCount);
|
|
||||||
|
|
||||||
for(int i=0; i<quadCount; ++i) {
|
|
||||||
V3F_C4B_T2F_Quad *q = &_quad[i];
|
|
||||||
|
|
||||||
kmVec3 vec1, out1;
|
|
||||||
vec1.x = q->bl.vertices.x;
|
|
||||||
vec1.y = q->bl.vertices.y;
|
|
||||||
vec1.z = q->bl.vertices.z;
|
|
||||||
kmVec3Transform(&out1, &vec1, &mv);
|
|
||||||
q->bl.vertices.x = out1.x;
|
|
||||||
q->bl.vertices.y = out1.y;
|
|
||||||
q->bl.vertices.z = out1.z;
|
|
||||||
|
|
||||||
kmVec3 vec2, out2;
|
|
||||||
vec2.x = q->br.vertices.x;
|
|
||||||
vec2.y = q->br.vertices.y;
|
|
||||||
vec2.z = q->br.vertices.z;
|
|
||||||
kmVec3Transform(&out2, &vec2, &mv);
|
|
||||||
q->br.vertices.x = out2.x;
|
|
||||||
q->br.vertices.y = out2.y;
|
|
||||||
q->br.vertices.z = out2.z;
|
|
||||||
|
|
||||||
kmVec3 vec3, out3;
|
|
||||||
vec3.x = q->tr.vertices.x;
|
|
||||||
vec3.y = q->tr.vertices.y;
|
|
||||||
vec3.z = q->tr.vertices.z;
|
|
||||||
kmVec3Transform(&out3, &vec3, &mv);
|
|
||||||
q->tr.vertices.x = out3.x;
|
|
||||||
q->tr.vertices.y = out3.y;
|
|
||||||
q->tr.vertices.z = out3.z;
|
|
||||||
|
|
||||||
kmVec3 vec4, out4;
|
|
||||||
vec4.x = q->tl.vertices.x;
|
|
||||||
vec4.y = q->tl.vertices.y;
|
|
||||||
vec4.z = q->tl.vertices.z;
|
|
||||||
kmVec3Transform(&out4, &vec4, &mv);
|
|
||||||
q->tl.vertices.x = out4.x;
|
|
||||||
q->tl.vertices.y = out4.y;
|
|
||||||
q->tl.vertices.z = out4.z;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QuadCommand::~QuadCommand()
|
QuadCommand::~QuadCommand()
|
||||||
{
|
{
|
||||||
free(_quad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t QuadCommand::generateID()
|
int64_t QuadCommand::generateID()
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
QuadCommand();
|
QuadCommand();
|
||||||
~QuadCommand();
|
~QuadCommand();
|
||||||
|
|
||||||
void init(int viewport, int32_t depth, GLuint texutreID, GLProgram* shader, BlendFunc blendType, V3F_C4B_T2F_Quad* quad, ssize_t quadCount,
|
void init(int viewport, int32_t depth, GLuint texutreID, GLProgram* shader, BlendFunc blendType, V3F_C4B_T2F_Quad* quads, ssize_t quadCount,
|
||||||
const kmMat4& mv);
|
const kmMat4& mv);
|
||||||
|
|
||||||
// +----------+----------+-----+-----------------------------------+
|
// +----------+----------+-----+-----------------------------------+
|
||||||
|
@ -56,20 +56,22 @@ public:
|
||||||
//TODO use material to decide if it is translucent
|
//TODO use material to decide if it is translucent
|
||||||
inline bool isTranslucent() const { return true; }
|
inline bool isTranslucent() const { return true; }
|
||||||
|
|
||||||
inline int32_t getMaterialID() const { return _materialID; }
|
inline uint32_t getMaterialID() const { return _materialID; }
|
||||||
|
|
||||||
inline GLuint getTextureID() const { return _textureID; }
|
inline GLuint getTextureID() const { return _textureID; }
|
||||||
|
|
||||||
inline V3F_C4B_T2F_Quad* getQuad() const { return _quad; }
|
inline V3F_C4B_T2F_Quad* getQuads() const { return _quads; }
|
||||||
|
|
||||||
inline ssize_t getQuadCount() const { return _quadCount; }
|
inline ssize_t getQuadCount() const { return _quadsCount; }
|
||||||
|
|
||||||
inline GLProgram* getShader() const { return _shader; }
|
inline GLProgram* getShader() const { return _shader; }
|
||||||
|
|
||||||
inline BlendFunc getBlendType() const { return _blendType; }
|
inline BlendFunc getBlendType() const { return _blendType; }
|
||||||
|
|
||||||
|
inline const kmMat4& getModelView() const { return _mv; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t _materialID;
|
uint32_t _materialID;
|
||||||
|
|
||||||
//Key Data
|
//Key Data
|
||||||
int _viewport; /// Which view port it belongs to
|
int _viewport; /// Which view port it belongs to
|
||||||
|
@ -85,9 +87,10 @@ protected:
|
||||||
|
|
||||||
BlendFunc _blendType;
|
BlendFunc _blendType;
|
||||||
|
|
||||||
V3F_C4B_T2F_Quad* _quad;
|
V3F_C4B_T2F_Quad* _quads;
|
||||||
ssize_t _quadCount;
|
ssize_t _quadsCount;
|
||||||
ssize_t _capacity;
|
|
||||||
|
kmMat4 _mv;
|
||||||
};
|
};
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
{
|
{
|
||||||
QUAD_COMMAND,
|
QUAD_COMMAND,
|
||||||
CUSTOM_COMMAND,
|
CUSTOM_COMMAND,
|
||||||
|
BATCH_COMMAND,
|
||||||
GROUP_COMMAND,
|
GROUP_COMMAND,
|
||||||
UNKNOWN_COMMAND,
|
UNKNOWN_COMMAND,
|
||||||
};
|
};
|
||||||
|
@ -49,9 +50,10 @@ public:
|
||||||
virtual int64_t generateID() = 0;
|
virtual int64_t generateID() = 0;
|
||||||
|
|
||||||
/** Get Render Command Id */
|
/** Get Render Command Id */
|
||||||
virtual inline int64_t getID() { return _id; }
|
inline int64_t getID() { return _id; }
|
||||||
|
|
||||||
virtual inline Type getType() { return _type; }
|
/** Returns the Command type */
|
||||||
|
inline Type getType() { return _type; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RenderCommand();
|
RenderCommand();
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "ccGLStateCache.h"
|
#include "ccGLStateCache.h"
|
||||||
#include "CCCustomCommand.h"
|
#include "CCCustomCommand.h"
|
||||||
#include "renderer/CCQuadCommand.h"
|
#include "renderer/CCQuadCommand.h"
|
||||||
|
#include "renderer/CCBatchCommand.h"
|
||||||
#include "CCGroupCommand.h"
|
#include "CCGroupCommand.h"
|
||||||
#include "CCConfiguration.h"
|
#include "CCConfiguration.h"
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
|
@ -248,7 +249,7 @@ void Renderer::render()
|
||||||
//Batch quads
|
//Batch quads
|
||||||
if(_numQuads + cmdQuadCount > VBO_SIZE)
|
if(_numQuads + cmdQuadCount > VBO_SIZE)
|
||||||
{
|
{
|
||||||
CCASSERT(cmdQuadCount < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command");
|
CCASSERT(cmdQuadCount>=0 && cmdQuadCount<VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command");
|
||||||
|
|
||||||
//Draw batched quads if VBO is full
|
//Draw batched quads if VBO is full
|
||||||
_lastCommand --;
|
_lastCommand --;
|
||||||
|
@ -256,7 +257,9 @@ void Renderer::render()
|
||||||
_lastCommand ++;
|
_lastCommand ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(_quads + _numQuads, cmd->getQuad(), sizeof(V3F_C4B_T2F_Quad) * cmdQuadCount);
|
memcpy(_quads + _numQuads, cmd->getQuads(), sizeof(V3F_C4B_T2F_Quad) * cmdQuadCount);
|
||||||
|
convertToWorldCoordiantes(_quads + _numQuads, cmdQuadCount, cmd->getModelView());
|
||||||
|
|
||||||
_numQuads += cmdQuadCount;
|
_numQuads += cmdQuadCount;
|
||||||
}
|
}
|
||||||
else if(commandType == RenderCommand::Type::CUSTOM_COMMAND)
|
else if(commandType == RenderCommand::Type::CUSTOM_COMMAND)
|
||||||
|
@ -265,6 +268,12 @@ void Renderer::render()
|
||||||
CustomCommand* cmd = static_cast<CustomCommand*>(command);
|
CustomCommand* cmd = static_cast<CustomCommand*>(command);
|
||||||
cmd->execute();
|
cmd->execute();
|
||||||
}
|
}
|
||||||
|
else if(commandType == RenderCommand::Type::BATCH_COMMAND)
|
||||||
|
{
|
||||||
|
flush();
|
||||||
|
BatchCommand* cmd = static_cast<BatchCommand*>(command);
|
||||||
|
cmd->execute();
|
||||||
|
}
|
||||||
else if(commandType == RenderCommand::Type::GROUP_COMMAND)
|
else if(commandType == RenderCommand::Type::GROUP_COMMAND)
|
||||||
{
|
{
|
||||||
flush();
|
flush();
|
||||||
|
@ -319,6 +328,25 @@ void Renderer::render()
|
||||||
_lastMaterialID = 0;
|
_lastMaterialID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::convertToWorldCoordiantes(V3F_C4B_T2F_Quad* quads, ssize_t quantity, const kmMat4& modelView)
|
||||||
|
{
|
||||||
|
for(ssize_t i=0; i<quantity; ++i) {
|
||||||
|
V3F_C4B_T2F_Quad *q = &quads[i];
|
||||||
|
|
||||||
|
kmVec3 *vec1 = (kmVec3*)&q->bl.vertices;
|
||||||
|
kmVec3Transform(vec1, vec1, &modelView);
|
||||||
|
|
||||||
|
kmVec3 *vec2 = (kmVec3*)&q->br.vertices;
|
||||||
|
kmVec3Transform(vec2, vec2, &modelView);
|
||||||
|
|
||||||
|
kmVec3 *vec3 = (kmVec3*)&q->tr.vertices;
|
||||||
|
kmVec3Transform(vec3, vec3, &modelView);
|
||||||
|
|
||||||
|
kmVec3 *vec4 = (kmVec3*)&q->tl.vertices;
|
||||||
|
kmVec3Transform(vec4, vec4, &modelView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::drawBatchedQuads()
|
void Renderer::drawBatchedQuads()
|
||||||
{
|
{
|
||||||
//TODO we can improve the draw performance by insert material switching command before hand.
|
//TODO we can improve the draw performance by insert material switching command before hand.
|
||||||
|
@ -353,7 +381,7 @@ void Renderer::drawBatchedQuads()
|
||||||
#define kQuadSize sizeof(_quads[0].bl)
|
#define kQuadSize sizeof(_quads[0].bl)
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
|
||||||
|
|
||||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(_quads[0]) * _numQuads , _quads);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _numQuads , _quads, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
|
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
|
||||||
|
|
||||||
|
@ -370,7 +398,7 @@ void Renderer::drawBatchedQuads()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Start drawing verties in batch
|
//Start drawing verties in batch
|
||||||
for(size_t i = _firstCommand; i <= _lastCommand; i++)
|
for(ssize_t i = _firstCommand; i <= _lastCommand; i++)
|
||||||
{
|
{
|
||||||
RenderCommand* command = _renderGroups[_renderStack.top().renderQueueID][i];
|
RenderCommand* command = _renderGroups[_renderStack.top().renderQueueID][i];
|
||||||
if (command->getType() == RenderCommand::Type::QUAD_COMMAND)
|
if (command->getType() == RenderCommand::Type::QUAD_COMMAND)
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef std::vector<RenderCommand*> RenderQueue;
|
||||||
struct RenderStackElement
|
struct RenderStackElement
|
||||||
{
|
{
|
||||||
int renderQueueID;
|
int renderQueueID;
|
||||||
size_t currentIndex;
|
ssize_t currentIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Renderer
|
class Renderer
|
||||||
|
@ -75,18 +75,21 @@ protected:
|
||||||
void mapBuffers();
|
void mapBuffers();
|
||||||
|
|
||||||
void drawBatchedQuads();
|
void drawBatchedQuads();
|
||||||
|
|
||||||
//Draw the previews queued quads and flush previous context
|
//Draw the previews queued quads and flush previous context
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
|
void convertToWorldCoordiantes(V3F_C4B_T2F_Quad* quads, ssize_t quantity, const kmMat4& modelView);
|
||||||
|
|
||||||
std::stack<int> _commandGroupStack;
|
std::stack<int> _commandGroupStack;
|
||||||
|
|
||||||
std::stack<RenderStackElement> _renderStack;
|
std::stack<RenderStackElement> _renderStack;
|
||||||
std::vector<RenderQueue> _renderGroups;
|
std::vector<RenderQueue> _renderGroups;
|
||||||
|
|
||||||
int _lastMaterialID;
|
uint32_t _lastMaterialID;
|
||||||
|
|
||||||
size_t _firstCommand;
|
ssize_t _firstCommand;
|
||||||
size_t _lastCommand;
|
ssize_t _lastCommand;
|
||||||
|
|
||||||
V3F_C4B_T2F_Quad _quads[VBO_SIZE];
|
V3F_C4B_T2F_Quad _quads[VBO_SIZE];
|
||||||
GLushort _indices[6 * VBO_SIZE];
|
GLushort _indices[6 * VBO_SIZE];
|
||||||
|
|
|
@ -144,24 +144,7 @@ static const char* inet_ntop(int af, const void* src, char* dst, int cnt)
|
||||||
// Free functions to log
|
// Free functions to log
|
||||||
//
|
//
|
||||||
|
|
||||||
// XXX: Deprecated
|
static void _log(const char *format, va_list args)
|
||||||
void CCLog(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
log(format, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void log(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
log(format, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void log(const char *format, va_list args)
|
|
||||||
{
|
{
|
||||||
char buf[MAX_LOG_LENGTH];
|
char buf[MAX_LOG_LENGTH];
|
||||||
|
|
||||||
|
@ -189,6 +172,22 @@ void log(const char *format, va_list args)
|
||||||
Director::getInstance()->getConsole()->log(buf);
|
Director::getInstance()->getConsole()->log(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: Deprecated
|
||||||
|
void CCLog(const char * format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
_log(format, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log(const char * format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
_log(format, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Console code
|
// Console code
|
||||||
|
@ -392,7 +391,7 @@ void Console::commandTextures(int fd, const char *command)
|
||||||
{
|
{
|
||||||
Scheduler *sched = Director::getInstance()->getScheduler();
|
Scheduler *sched = Director::getInstance()->getScheduler();
|
||||||
sched->performFunctionInCocosThread( [&](){
|
sched->performFunctionInCocosThread( [&](){
|
||||||
mydprintf(fd, "%s", TextureCache::getInstance()->getCachedTextureInfo().c_str());
|
mydprintf(fd, "%s", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@ static const int MAX_LOG_LENGTH = 16*1024;
|
||||||
@brief Output Debug message.
|
@brief Output Debug message.
|
||||||
*/
|
*/
|
||||||
void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2);
|
void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2);
|
||||||
void CC_DLL log(const char * format, va_list args);
|
|
||||||
|
|
||||||
/** Console is helper class that lets the developer control the game from TCP connection.
|
/** Console is helper class that lets the developer control the game from TCP connection.
|
||||||
Console will spawn a new thread that will listen to a specified TCP port.
|
Console will spawn a new thread that will listen to a specified TCP port.
|
||||||
|
|
|
@ -115,7 +115,7 @@ void DisplayFactory::updateDisplay(Bone *bone, float dt, bool dirty)
|
||||||
anchorPoint = PointApplyTransform(anchorPoint, displayTransform);
|
anchorPoint = PointApplyTransform(anchorPoint, displayTransform);
|
||||||
displayTransform.mat[12] = anchorPoint.x;
|
displayTransform.mat[12] = anchorPoint.x;
|
||||||
displayTransform.mat[13] = anchorPoint.y;
|
displayTransform.mat[13] = anchorPoint.y;
|
||||||
kmMat4 t = TransformConcat(displayTransform, bone->getArmature()->getNodeToParentTransform());
|
kmMat4 t = TransformConcat( bone->getArmature()->getNodeToParentTransform(),displayTransform);
|
||||||
detector->updateTransform(t);
|
detector->updateTransform(t);
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
|
|
@ -197,7 +197,7 @@ void Skin::updateTransform()
|
||||||
|
|
||||||
kmMat4 Skin::getNodeToWorldTransform() const
|
kmMat4 Skin::getNodeToWorldTransform() const
|
||||||
{
|
{
|
||||||
return TransformConcat(_transform, _bone->getArmature()->getNodeToWorldTransform());
|
return TransformConcat( _bone->getArmature()->getNodeToWorldTransform(), _transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
kmMat4 Skin::getNodeToWorldTransformAR() const
|
kmMat4 Skin::getNodeToWorldTransformAR() const
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit bab1d8a7c5d8b29f14c8dc19158a8bb994f0e970
|
Subproject commit 74cb897b64f7325cf969341e9bc2d87fc7fb1bb7
|
|
@ -1 +1 @@
|
||||||
16af4ad046f4db00af7a229d89c406054d8616c3
|
f92acd30f26c52238e94d2ef1f5b11e760980a67
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -121,6 +121,8 @@ Classes/PerformanceTest/PerformanceTest.cpp \
|
||||||
Classes/PerformanceTest/PerformanceTextureTest.cpp \
|
Classes/PerformanceTest/PerformanceTextureTest.cpp \
|
||||||
Classes/PerformanceTest/PerformanceTouchesTest.cpp \
|
Classes/PerformanceTest/PerformanceTouchesTest.cpp \
|
||||||
Classes/PerformanceTest/PerformanceLabelTest.cpp \
|
Classes/PerformanceTest/PerformanceLabelTest.cpp \
|
||||||
|
Classes/PerformanceTest/PerformanceRendererTest.cpp \
|
||||||
|
Classes/PerformanceTest/PerformanceContainerTest.cpp \
|
||||||
Classes/PhysicsTest/PhysicsTest.cpp \
|
Classes/PhysicsTest/PhysicsTest.cpp \
|
||||||
Classes/RenderTextureTest/RenderTextureTest.cpp \
|
Classes/RenderTextureTest/RenderTextureTest.cpp \
|
||||||
Classes/RotateWorldTest/RotateWorldTest.cpp \
|
Classes/RotateWorldTest/RotateWorldTest.cpp \
|
||||||
|
|
|
@ -116,6 +116,8 @@ set(SAMPLE_SRC
|
||||||
Classes/PerformanceTest/PerformanceTextureTest.cpp
|
Classes/PerformanceTest/PerformanceTextureTest.cpp
|
||||||
Classes/PerformanceTest/PerformanceTouchesTest.cpp
|
Classes/PerformanceTest/PerformanceTouchesTest.cpp
|
||||||
Classes/PerformanceTest/PerformanceLabelTest.cpp
|
Classes/PerformanceTest/PerformanceLabelTest.cpp
|
||||||
|
Classes/PerformanceTest/PerformanceRendererTest.cpp
|
||||||
|
Classes/PerformanceTest/PerformanceContainerTest.cpp
|
||||||
Classes/PhysicsTest/PhysicsTest.cpp
|
Classes/PhysicsTest/PhysicsTest.cpp
|
||||||
Classes/RenderTextureTest/RenderTextureTest.cpp
|
Classes/RenderTextureTest/RenderTextureTest.cpp
|
||||||
Classes/RotateWorldTest/RotateWorldTest.cpp
|
Classes/RotateWorldTest/RotateWorldTest.cpp
|
||||||
|
|
|
@ -1067,8 +1067,22 @@ void TestColliderDetector::update(float delta)
|
||||||
}
|
}
|
||||||
void TestColliderDetector::draw()
|
void TestColliderDetector::draw()
|
||||||
{
|
{
|
||||||
armature2->drawContour();
|
_customCommand.init(0, _vertexZ);
|
||||||
|
_customCommand.func = CC_CALLBACK_0(TestColliderDetector::onDraw, this);
|
||||||
|
Director::getInstance()->getRenderer()->addCommand(&_customCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestColliderDetector::onDraw()
|
||||||
|
{
|
||||||
|
kmMat4 oldMat;
|
||||||
|
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||||
|
kmGLLoadMatrix(&_modelViewTransform);
|
||||||
|
|
||||||
|
armature2->drawContour();
|
||||||
|
|
||||||
|
kmGLLoadMatrix(&oldMat);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -271,6 +271,7 @@ public:
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual void update(float delta);
|
virtual void update(float delta);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
|
void onDraw();
|
||||||
|
|
||||||
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
|
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
|
||||||
|
|
||||||
|
@ -278,6 +279,7 @@ public:
|
||||||
cocostudio::Armature *armature;
|
cocostudio::Armature *armature;
|
||||||
cocostudio::Armature *armature2;
|
cocostudio::Armature *armature2;
|
||||||
|
|
||||||
|
CustomCommand _customCommand; //new render needed this for drawing primitives
|
||||||
cocos2d::Sprite *bullet;
|
cocos2d::Sprite *bullet;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,7 +66,8 @@ static std::function<Layer*()> createFunctions[] =
|
||||||
CL(LabelTTFUnicodeNew),
|
CL(LabelTTFUnicodeNew),
|
||||||
CL(LabelBMFontTestNew),
|
CL(LabelBMFontTestNew),
|
||||||
CL(LabelTTFDistanceField),
|
CL(LabelTTFDistanceField),
|
||||||
CL(LabelTTFDistanceFieldEffect)
|
CL(LabelTTFDistanceFieldEffect),
|
||||||
|
CL(LabelCrashTest)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||||
|
@ -158,20 +159,19 @@ LabelTTFAlignmentNew::LabelTTFAlignmentNew()
|
||||||
{
|
{
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
auto ttf0 = Label::createWithTTF("Alignment 0\nnew line", "fonts/tahoma.ttf", 32);
|
TTFConfig config("fonts/tahoma.ttf",32);
|
||||||
ttf0->setAlignment(TextHAlignment::LEFT);
|
|
||||||
|
auto ttf0 = Label::createWithTTF(config,"Alignment 0\nnew line",TextHAlignment::LEFT);
|
||||||
ttf0->setPosition(Point(s.width/2,(s.height/6)*2 - 30));
|
ttf0->setPosition(Point(s.width/2,(s.height/6)*2 - 30));
|
||||||
ttf0->setAnchorPoint(Point(0.5f,0.5f));
|
ttf0->setAnchorPoint(Point(0.5f,0.5f));
|
||||||
this->addChild(ttf0);
|
this->addChild(ttf0);
|
||||||
|
|
||||||
auto ttf1 = Label::createWithTTF("Alignment 1\nnew line", "fonts/tahoma.ttf", 32);
|
auto ttf1 = Label::createWithTTF(config,"Alignment 1\nnew line",TextHAlignment::CENTER);
|
||||||
ttf1->setAlignment(TextHAlignment::CENTER);
|
|
||||||
ttf1->setPosition(Point(s.width/2,(s.height/6)*3 - 30));
|
ttf1->setPosition(Point(s.width/2,(s.height/6)*3 - 30));
|
||||||
ttf1->setAnchorPoint(Point(0.5f,0.5f));
|
ttf1->setAnchorPoint(Point(0.5f,0.5f));
|
||||||
this->addChild(ttf1);
|
this->addChild(ttf1);
|
||||||
|
|
||||||
auto ttf2 = Label::createWithTTF("Alignment 2\nnew line", "fonts/tahoma.ttf", 32);
|
auto ttf2 = Label::createWithTTF(config,"Alignment 2\nnew line",TextHAlignment::RIGHT);
|
||||||
ttf1->setAlignment(TextHAlignment::RIGHT);
|
|
||||||
ttf2->setPosition(Point(s.width/2,(s.height/6)*4 - 30));
|
ttf2->setPosition(Point(s.width/2,(s.height/6)*4 - 30));
|
||||||
ttf2->setAnchorPoint(Point(0.5f,0.5f));
|
ttf2->setAnchorPoint(Point(0.5f,0.5f));
|
||||||
this->addChild(ttf2);
|
this->addChild(ttf2);
|
||||||
|
@ -194,7 +194,7 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity()
|
||||||
auto col = LayerColor::create( Color4B(128,128,128,255) );
|
auto col = LayerColor::create( Color4B(128,128,128,255) );
|
||||||
addChild(col, -10);
|
addChild(col, -10);
|
||||||
|
|
||||||
auto label1 = Label::createWithBMFont("Test", "fonts/bitmapFontTest2.fnt");
|
auto label1 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test");
|
||||||
|
|
||||||
label1->setAnchorPoint( Point(0,0) );
|
label1->setAnchorPoint( Point(0,0) );
|
||||||
addChild(label1, 0, kTagBitmapAtlas1);
|
addChild(label1, 0, kTagBitmapAtlas1);
|
||||||
|
@ -204,13 +204,13 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity()
|
||||||
auto repeat = RepeatForever::create(seq);
|
auto repeat = RepeatForever::create(seq);
|
||||||
label1->runAction(repeat);
|
label1->runAction(repeat);
|
||||||
|
|
||||||
auto label2 = Label::createWithBMFont("Test", "fonts/bitmapFontTest2.fnt");
|
auto label2 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test");
|
||||||
label2->setAnchorPoint( Point(0.5f, 0.5f) );
|
label2->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||||
label2->setColor( Color3B::RED );
|
label2->setColor( Color3B::RED );
|
||||||
addChild(label2, 0, kTagBitmapAtlas2);
|
addChild(label2, 0, kTagBitmapAtlas2);
|
||||||
label2->runAction( repeat->clone() );
|
label2->runAction( repeat->clone() );
|
||||||
|
|
||||||
auto label3 = Label::createWithBMFont("Test", "fonts/bitmapFontTest2.fnt");
|
auto label3 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test");
|
||||||
label3->setAnchorPoint( Point(1,1) );
|
label3->setAnchorPoint( Point(1,1) );
|
||||||
addChild(label3, 0, kTagBitmapAtlas3);
|
addChild(label3, 0, kTagBitmapAtlas3);
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
||||||
_time = 0;
|
_time = 0;
|
||||||
|
|
||||||
// Upper Label
|
// Upper Label
|
||||||
auto label = Label::createWithBMFont("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");
|
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Bitmap Font Atlas");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
@ -289,7 +289,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
||||||
|
|
||||||
|
|
||||||
// Bottom Label
|
// Bottom Label
|
||||||
auto label2 = Label::createWithBMFont("00.0", "fonts/bitmapFontTest.fnt");
|
auto label2 = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "00.0");
|
||||||
addChild(label2, 0, kTagBitmapAtlas2);
|
addChild(label2, 0, kTagBitmapAtlas2);
|
||||||
label2->setPosition( Point(s.width/2.0f, 80) );
|
label2->setPosition( Point(s.width/2.0f, 80) );
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ std::string LabelFNTSpriteActions::subtitle() const
|
||||||
|
|
||||||
LabelFNTPadding::LabelFNTPadding()
|
LabelFNTPadding::LabelFNTPadding()
|
||||||
{
|
{
|
||||||
auto label = Label::createWithBMFont("abcdefg", "fonts/bitmapFontTest4.fnt");
|
auto label = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "abcdefg");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
@ -365,17 +365,17 @@ LabelFNTOffset::LabelFNTOffset()
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
Label* label = NULL;
|
Label* label = NULL;
|
||||||
label = Label::createWithBMFont("FaFeFiFoFu", "fonts/bitmapFontTest5.fnt");
|
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "FaFeFiFoFu");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setPosition( Point(s.width/2, s.height/2+50) );
|
label->setPosition( Point(s.width/2, s.height/2+50) );
|
||||||
label->setAnchorPoint( Point(0.5f, 0.5f) ) ;
|
label->setAnchorPoint( Point(0.5f, 0.5f) ) ;
|
||||||
|
|
||||||
label = Label::createWithBMFont("fafefifofu", "fonts/bitmapFontTest5.fnt");
|
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "fafefifofu");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setPosition( Point(s.width/2, s.height/2) );
|
label->setPosition( Point(s.width/2, s.height/2) );
|
||||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||||
|
|
||||||
label = Label::createWithBMFont("aeiou", "fonts/bitmapFontTest5.fnt");
|
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "aeiou");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setPosition( Point(s.width/2, s.height/2-50) );
|
label->setPosition( Point(s.width/2, s.height/2-50) );
|
||||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||||
|
@ -396,19 +396,19 @@ LabelFNTColor::LabelFNTColor()
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
Label* label = NULL;
|
Label* label = NULL;
|
||||||
label = Label::createWithBMFont("Blue", "fonts/bitmapFontTest5.fnt");
|
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "Blue");
|
||||||
label->setColor( Color3B::BLUE );
|
label->setColor( Color3B::BLUE );
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setPosition( Point(s.width/2, s.height/4) );
|
label->setPosition( Point(s.width/2, s.height/4) );
|
||||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||||
|
|
||||||
label = Label::createWithBMFont("Red", "fonts/bitmapFontTest5.fnt");
|
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "Red");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setPosition( Point(s.width/2, 2*s.height/4) );
|
label->setPosition( Point(s.width/2, 2*s.height/4) );
|
||||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||||
label->setColor( Color3B::RED );
|
label->setColor( Color3B::RED );
|
||||||
|
|
||||||
label = Label::createWithBMFont("G", "fonts/bitmapFontTest5.fnt");
|
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "Green");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setPosition( Point(s.width/2, 3*s.height/4) );
|
label->setPosition( Point(s.width/2, 3*s.height/4) );
|
||||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||||
|
@ -433,7 +433,7 @@ LabelFNTHundredLabels::LabelFNTHundredLabels()
|
||||||
{
|
{
|
||||||
char str[6] = {0};
|
char str[6] = {0};
|
||||||
sprintf(str, "-%d-", i);
|
sprintf(str, "-%d-", i);
|
||||||
auto label = Label::createWithBMFont(str, "fonts/bitmapFontTest.fnt");
|
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", str);
|
||||||
addChild(label);
|
addChild(label);
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
@ -459,7 +459,7 @@ LabelFNTMultiLine::LabelFNTMultiLine()
|
||||||
Size s;
|
Size s;
|
||||||
|
|
||||||
// Left
|
// Left
|
||||||
auto label1 = Label::createWithBMFont(" Multi line\nLeft", "fonts/bitmapFontTest3.fnt");
|
auto label1 = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", " Multi line\nLeft");
|
||||||
label1->setAnchorPoint(Point(0,0));
|
label1->setAnchorPoint(Point(0,0));
|
||||||
addChild(label1, 0, kTagBitmapAtlas1);
|
addChild(label1, 0, kTagBitmapAtlas1);
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ LabelFNTMultiLine::LabelFNTMultiLine()
|
||||||
|
|
||||||
|
|
||||||
// Center
|
// Center
|
||||||
auto label2 = Label::createWithBMFont("Multi line\nCenter", "fonts/bitmapFontTest3.fnt");
|
auto label2 = Label::createWithBMFont( "fonts/bitmapFontTest3.fnt", "Multi line\nCenter");
|
||||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
addChild(label2, 0, kTagBitmapAtlas2);
|
addChild(label2, 0, kTagBitmapAtlas2);
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ LabelFNTMultiLine::LabelFNTMultiLine()
|
||||||
CCLOG("content size: %.2fx%.2f", s.width, s.height);
|
CCLOG("content size: %.2fx%.2f", s.width, s.height);
|
||||||
|
|
||||||
// right
|
// right
|
||||||
auto label3 = Label::createWithBMFont("Multi line\nRight\nThree lines Three", "fonts/bitmapFontTest3.fnt");
|
auto label3 = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "Multi line\nRight\nThree lines Three");
|
||||||
label3->setAnchorPoint(Point(1, 1));
|
label3->setAnchorPoint(Point(1, 1));
|
||||||
addChild(label3, 0, kTagBitmapAtlas3);
|
addChild(label3, 0, kTagBitmapAtlas3);
|
||||||
|
|
||||||
|
@ -504,19 +504,18 @@ LabelFNTandTTFEmpty::LabelFNTandTTFEmpty()
|
||||||
float delta = s.height/4;
|
float delta = s.height/4;
|
||||||
|
|
||||||
// LabelBMFont
|
// LabelBMFont
|
||||||
auto label1 = Label::createWithBMFont("", "fonts/bitmapFontTest3.fnt", TextHAlignment::CENTER, s.width);
|
auto label1 = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "", TextHAlignment::CENTER, s.width);
|
||||||
addChild(label1, 0, kTagBitmapAtlas1);
|
addChild(label1, 0, kTagBitmapAtlas1);
|
||||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label1->setPosition(Point(s.width/2, delta));
|
label1->setPosition(Point(s.width/2, delta));
|
||||||
|
|
||||||
// LabelTTF
|
// LabelTTF
|
||||||
auto label2 = Label::createWithTTF("", "fonts/arial.ttf", 48, s.width, TextHAlignment::CENTER,GlyphCollection::NEHE);
|
TTFConfig ttfConfig("fonts/arial.ttf",48);
|
||||||
|
auto label2 = Label::createWithTTF(ttfConfig,"", TextHAlignment::CENTER,s.width);
|
||||||
addChild(label2, 0, kTagBitmapAtlas2);
|
addChild(label2, 0, kTagBitmapAtlas2);
|
||||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label2->setPosition(Point(s.width/2, delta * 2));
|
label2->setPosition(Point(s.width/2, delta * 2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
schedule(schedule_selector(LabelFNTandTTFEmpty::updateStrings), 1.0f);
|
schedule(schedule_selector(LabelFNTandTTFEmpty::updateStrings), 1.0f);
|
||||||
|
|
||||||
setEmpty = false;
|
setEmpty = false;
|
||||||
|
@ -558,7 +557,7 @@ LabelFNTRetina::LabelFNTRetina()
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
// LabelBMFont
|
// LabelBMFont
|
||||||
auto label1 = Label::createWithBMFont("TESTING RETINA DISPLAY", "fonts/konqa32.fnt");
|
auto label1 = Label::createWithBMFont("fonts/konqa32.fnt", "TESTING RETINA DISPLAY");
|
||||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
label1->setPosition(Point(s.width/2, s.height/2));
|
label1->setPosition(Point(s.width/2, s.height/2));
|
||||||
|
@ -582,7 +581,7 @@ LabelFNTGlyphDesigner::LabelFNTGlyphDesigner()
|
||||||
addChild(layer, -10);
|
addChild(layer, -10);
|
||||||
|
|
||||||
// LabelBMFont
|
// LabelBMFont
|
||||||
auto label1 = Label::createWithBMFont("Testing Glyph Designer", "fonts/futura-48.fnt");
|
auto label1 = Label::createWithBMFont("fonts/futura-48.fnt", "Testing Glyph Designer");
|
||||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
label1->setPosition(Point(s.width/2, s.height/2));
|
label1->setPosition(Point(s.width/2, s.height/2));
|
||||||
|
@ -603,7 +602,8 @@ LabelTTFUnicodeChinese::LabelTTFUnicodeChinese()
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
// Adding "啊" letter at the end of string to make VS2012 happy, otherwise VS will generate errors
|
// Adding "啊" letter at the end of string to make VS2012 happy, otherwise VS will generate errors
|
||||||
// like "Error 3 error C2146: syntax error : missing ')' before identifier 'label'";
|
// like "Error 3 error C2146: syntax error : missing ')' before identifier 'label'";
|
||||||
auto label = Label::createWithTTF("美好的一天啊", "fonts/wt021.ttf", 55, size.width, TextHAlignment::CENTER, GlyphCollection::CUSTOM, "美好的一天啊");
|
TTFConfig ttfConfig("fonts/wt021.ttf",55,GlyphCollection::CUSTOM, "美好的一天啊");
|
||||||
|
auto label = Label::createWithTTF(ttfConfig,"美好的一天啊", TextHAlignment::CENTER, size.width);
|
||||||
label->setAnchorPoint(Point(0.5f, 0.5f));
|
label->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label->setPosition(Point(size.width / 2, size.height /2));
|
label->setPosition(Point(size.width / 2, size.height /2));
|
||||||
this->addChild(label);
|
this->addChild(label);
|
||||||
|
@ -622,7 +622,7 @@ std::string LabelTTFUnicodeChinese::subtitle() const
|
||||||
LabelFNTUnicodeChinese::LabelFNTUnicodeChinese()
|
LabelFNTUnicodeChinese::LabelFNTUnicodeChinese()
|
||||||
{
|
{
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
auto label = Label::createWithBMFont("中国", "fonts/bitmapFontChinese.fnt");
|
auto label = Label::createWithBMFont("fonts/bitmapFontChinese.fnt", "中国");
|
||||||
label->setAnchorPoint(Point(0.5f, 0.5f));
|
label->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label->setPosition(Point(size.width / 2, size.height /2));
|
label->setPosition(Point(size.width / 2, size.height /2));
|
||||||
this->addChild(label);
|
this->addChild(label);
|
||||||
|
@ -671,8 +671,7 @@ LabelFNTMultiLineAlignment::LabelFNTMultiLineAlignment()
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
// create and initialize a Label
|
// create and initialize a Label
|
||||||
this->_labelShouldRetain = Label::createWithBMFont(LongSentencesExample, "fonts/markerFelt.fnt", TextHAlignment::CENTER, size.width/1.5);
|
this->_labelShouldRetain = Label::createWithBMFont("fonts/markerFelt.fnt", LongSentencesExample, TextHAlignment::CENTER, size.width/1.5);
|
||||||
//this->_labelShouldRetain = Label::createWithBMFont(LongSentencesExample, "fonts/bitmapFontTest.fnt", TextHAlignment::CENTER, size.width/1.5);
|
|
||||||
this->_labelShouldRetain->setAnchorPoint(Point(0.5f, 0.5f));
|
this->_labelShouldRetain->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
this->_labelShouldRetain->retain();
|
this->_labelShouldRetain->retain();
|
||||||
|
|
||||||
|
@ -855,22 +854,22 @@ LabelFNTUNICODELanguages::LabelFNTUNICODELanguages()
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
auto label1 = Label::createWithBMFont(spanish, "fonts/arial-unicode-26.fnt", TextHAlignment::CENTER, 200);
|
auto label1 = Label::createWithBMFont("fonts/arial-unicode-26.fnt", spanish, TextHAlignment::CENTER, 200);
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label1->setPosition(Point(s.width/2, s.height/5*3));
|
label1->setPosition(Point(s.width/2, s.height/5*3));
|
||||||
|
|
||||||
auto label2 = Label::createWithBMFont(chinese, "fonts/arial-unicode-26.fnt");
|
auto label2 = Label::createWithBMFont("fonts/arial-unicode-26.fnt", chinese);
|
||||||
addChild(label2);
|
addChild(label2);
|
||||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label2->setPosition(Point(s.width/2, s.height/5*2.5));
|
label2->setPosition(Point(s.width/2, s.height/5*2.5));
|
||||||
|
|
||||||
auto label3 = Label::createWithBMFont(russian, "fonts/arial-26-en-ru.fnt");
|
auto label3 = Label::createWithBMFont("fonts/arial-26-en-ru.fnt", russian);
|
||||||
addChild(label3);
|
addChild(label3);
|
||||||
label3->setAnchorPoint(Point(0.5f, 0.5f));
|
label3->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label3->setPosition(Point(s.width/2, s.height/5*2));
|
label3->setPosition(Point(s.width/2, s.height/5*2));
|
||||||
|
|
||||||
auto label4 = Label::createWithBMFont(japanese, "fonts/arial-unicode-26.fnt");
|
auto label4 = Label::createWithBMFont("fonts/arial-unicode-26.fnt", japanese);
|
||||||
addChild(label4);
|
addChild(label4);
|
||||||
label4->setAnchorPoint(Point(0.5f, 0.5f));
|
label4->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
label4->setPosition(Point(s.width/2, s.height/5*1.5));
|
label4->setPosition(Point(s.width/2, s.height/5*1.5));
|
||||||
|
@ -894,7 +893,7 @@ LabelFNTBounds::LabelFNTBounds()
|
||||||
addChild(layer, -10);
|
addChild(layer, -10);
|
||||||
|
|
||||||
// LabelBMFont
|
// LabelBMFont
|
||||||
label1 = Label::createWithBMFont("Testing Glyph Designer", "fonts/boundsTestFont.fnt", TextHAlignment::CENTER, s.width);
|
label1 = Label::createWithBMFont("fonts/boundsTestFont.fnt", "Testing Glyph Designer", TextHAlignment::CENTER, s.width);
|
||||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
label1->setPosition(Point(s.width/2, s.height/2));
|
label1->setPosition(Point(s.width/2, s.height/2));
|
||||||
|
@ -946,7 +945,8 @@ LabelTTFLongLineWrapping::LabelTTFLongLineWrapping()
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
// Long sentence
|
// Long sentence
|
||||||
auto label1 = Label::createWithTTF(LongSentencesExample, "fonts/arial.ttf", 28, size.width, TextHAlignment::CENTER, GlyphCollection::NEHE);
|
TTFConfig ttfConfig("fonts/arial.ttf", 28);
|
||||||
|
auto label1 = Label::createWithTTF(ttfConfig, LongSentencesExample, TextHAlignment::CENTER,size.width);
|
||||||
label1->setPosition( Point(size.width/2, size.height/2) );
|
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||||
label1->setAnchorPoint(Point(0.5, 1.0));
|
label1->setAnchorPoint(Point(0.5, 1.0));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
|
@ -966,22 +966,23 @@ LabelTTFColor::LabelTTFColor()
|
||||||
{
|
{
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
TTFConfig ttfConfig("fonts/arial.ttf", 35);
|
||||||
// Green
|
// Green
|
||||||
auto label1 = Label::createWithTTF("Green", "fonts/arial.ttf", 35, size.width, TextHAlignment::CENTER, GlyphCollection::NEHE);
|
auto label1 = Label::createWithTTF(ttfConfig,"Green", TextHAlignment::CENTER, size.width);
|
||||||
label1->setPosition( Point(size.width/2, size.height/5 * 1.5) );
|
label1->setPosition( Point(size.width/2, size.height/5 * 1.5) );
|
||||||
label1->setColor( Color3B::GREEN );
|
label1->setColor( Color3B::GREEN );
|
||||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
|
|
||||||
// Red
|
// Red
|
||||||
auto label2 = Label::createWithTTF("Red", "fonts/arial.ttf", 35, size.width, TextHAlignment::CENTER, GlyphCollection::NEHE);
|
auto label2 = Label::createWithTTF(ttfConfig,"Red", TextHAlignment::CENTER, size.width);
|
||||||
label2->setPosition( Point(size.width/2, size.height/5 * 2.0) );
|
label2->setPosition( Point(size.width/2, size.height/5 * 2.0) );
|
||||||
label2->setColor( Color3B::RED );
|
label2->setColor( Color3B::RED );
|
||||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||||
addChild(label2);
|
addChild(label2);
|
||||||
|
|
||||||
// Blue
|
// Blue
|
||||||
auto label3 = Label::createWithTTF("Blue", "fonts/arial.ttf", 35, size.width, TextHAlignment::CENTER, GlyphCollection::NEHE);
|
auto label3 = Label::createWithTTF(ttfConfig,"Blue", TextHAlignment::CENTER, size.width);
|
||||||
label3->setPosition( Point(size.width/2, size.height/5 * 2.5) );
|
label3->setPosition( Point(size.width/2, size.height/5 * 2.5) );
|
||||||
label3->setColor( Color3B::BLUE );
|
label3->setColor( Color3B::BLUE );
|
||||||
label3->setAnchorPoint(Point(0.5, 0.5));
|
label3->setAnchorPoint(Point(0.5, 0.5));
|
||||||
|
@ -1001,13 +1002,11 @@ std::string LabelTTFColor::subtitle() const
|
||||||
LabelTTFDynamicAlignment::LabelTTFDynamicAlignment()
|
LabelTTFDynamicAlignment::LabelTTFDynamicAlignment()
|
||||||
{
|
{
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
TTFConfig ttfConfig("fonts/arial.ttf", 45);
|
||||||
_label = Label::createWithTTF(LongSentencesExample, "fonts/arial.ttf", 45, size.width, TextHAlignment::CENTER, GlyphCollection::NEHE);
|
_label = Label::createWithTTF(ttfConfig,LongSentencesExample, TextHAlignment::CENTER, size.width);
|
||||||
_label->setPosition( Point(size.width/2, size.height/2) );
|
_label->setPosition( Point(size.width/2, size.height/2) );
|
||||||
_label->setAnchorPoint(Point(0.5, 0.5));
|
_label->setAnchorPoint(Point(0.5, 0.5));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
auto menu = Menu::create(
|
auto menu = Menu::create(
|
||||||
MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentLeft, this)),
|
MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentLeft, this)),
|
||||||
MenuItemFont::create("Center", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentCenter, this)),
|
MenuItemFont::create("Center", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentCenter, this)),
|
||||||
|
@ -1074,21 +1073,24 @@ LabelTTFUnicodeNew::LabelTTFUnicodeNew()
|
||||||
float vStep = size.height/9;
|
float vStep = size.height/9;
|
||||||
float vSize = size.height;
|
float vSize = size.height;
|
||||||
|
|
||||||
|
TTFConfig ttfConfig("fonts/arial.ttf", 45,GlyphCollection::ASCII);
|
||||||
// Spanish
|
// Spanish
|
||||||
auto label1 = Label::createWithTTF("Buen día, ¿cómo te llamas?", "fonts/arial.ttf", 45, size.width, TextHAlignment::CENTER, GlyphCollection::ASCII);
|
auto label1 = Label::createWithTTF(ttfConfig,"Buen día, ¿cómo te llamas?", TextHAlignment::CENTER, size.width);
|
||||||
label1->setPosition( Point(size.width/2, vSize - (vStep * 4.5)) );
|
label1->setPosition( Point(size.width/2, vSize - (vStep * 4.5)) );
|
||||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
|
|
||||||
// German
|
// German
|
||||||
auto label2 = Label::createWithTTF("In welcher Straße haben Sie gelebt?", "fonts/arial.ttf", 45, size.width, TextHAlignment::CENTER, GlyphCollection::ASCII);
|
auto label2 = Label::createWithTTF(ttfConfig,"In welcher Straße haben Sie gelebt?", TextHAlignment::CENTER,size.width);
|
||||||
label2->setPosition( Point(size.width/2, vSize - (vStep * 5.5)) );
|
label2->setPosition( Point(size.width/2, vSize - (vStep * 5.5)) );
|
||||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||||
addChild(label2);
|
addChild(label2);
|
||||||
|
|
||||||
// chinese
|
// chinese
|
||||||
auto label3 = Label::createWithTTF(chinese, "fonts/wt021.ttf", 45, size.width, TextHAlignment::CENTER, GlyphCollection::CUSTOM, chinese.c_str());
|
ttfConfig.fontFilePath = "fonts/wt021.ttf";
|
||||||
|
ttfConfig.glyphs = GlyphCollection::CUSTOM;
|
||||||
|
ttfConfig.customGlyphs = chinese.c_str();
|
||||||
|
auto label3 = Label::createWithTTF(ttfConfig,chinese, TextHAlignment::CENTER,size.width);
|
||||||
label3->setPosition( Point(size.width/2, vSize - (vStep * 6.5)) );
|
label3->setPosition( Point(size.width/2, vSize - (vStep * 6.5)) );
|
||||||
label3->setAnchorPoint(Point(0.5, 0.5));
|
label3->setAnchorPoint(Point(0.5, 0.5));
|
||||||
addChild(label3);
|
addChild(label3);
|
||||||
|
@ -1118,9 +1120,10 @@ LabelTTFFontsTestNew::LabelTTFFontsTestNew()
|
||||||
#define arraysize(ar) (sizeof(ar) / sizeof(ar[0]))
|
#define arraysize(ar) (sizeof(ar) / sizeof(ar[0]))
|
||||||
|
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
TTFConfig ttfConfig(ttfpaths[0],40, GlyphCollection::NEHE);
|
||||||
for(size_t i=0;i < arraysize(ttfpaths); ++i) {
|
for(size_t i=0;i < arraysize(ttfpaths); ++i) {
|
||||||
auto label = Label::createWithTTF( ttfpaths[i], ttfpaths[i], 40, 0, TextHAlignment::CENTER, GlyphCollection::NEHE);
|
ttfConfig.fontFilePath = ttfpaths[i];
|
||||||
|
auto label = Label::createWithTTF(ttfConfig, ttfpaths[i], TextHAlignment::CENTER,0);
|
||||||
if( label ) {
|
if( label ) {
|
||||||
|
|
||||||
label->setPosition( Point(size.width/2, ((size.height * 0.6)/arraysize(ttfpaths) * i) + (size.height/5)));
|
label->setPosition( Point(size.width/2, ((size.height * 0.6)/arraysize(ttfpaths) * i) + (size.height/5)));
|
||||||
|
@ -1147,7 +1150,7 @@ LabelBMFontTestNew::LabelBMFontTestNew()
|
||||||
{
|
{
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
auto label1 = Label::createWithBMFont("Hello World, this is testing the new Label using fnt file", "fonts/bitmapFontTest2.fnt", TextHAlignment::CENTER, size.width);
|
auto label1 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Hello World, this is testing the new Label using fnt file", TextHAlignment::CENTER, size.width);
|
||||||
label1->setPosition( Point(size.width/2, size.height/2) );
|
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
|
@ -1166,8 +1169,9 @@ std::string LabelBMFontTestNew::subtitle() const
|
||||||
LabelTTFDistanceField::LabelTTFDistanceField()
|
LabelTTFDistanceField::LabelTTFDistanceField()
|
||||||
{
|
{
|
||||||
auto size = Director::getInstance()->getWinSize();
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
TTFConfig ttfConfig("fonts/arial.ttf", 80, GlyphCollection::DYNAMIC,nullptr,true);
|
||||||
|
|
||||||
auto label1 = Label::createWithTTF("Distance Field", "fonts/arial.ttf", 80, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true);
|
auto label1 = Label::createWithTTF(ttfConfig,"Distance Field",TextHAlignment::CENTER,size.width);
|
||||||
label1->setPosition( Point(size.width/2, size.height/2) );
|
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||||
label1->setColor( Color3B::GREEN );
|
label1->setColor( Color3B::GREEN );
|
||||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||||
|
@ -1180,7 +1184,7 @@ LabelTTFDistanceField::LabelTTFDistanceField()
|
||||||
nullptr);
|
nullptr);
|
||||||
label1->runAction(RepeatForever::create(action));
|
label1->runAction(RepeatForever::create(action));
|
||||||
|
|
||||||
auto label2 = Label::createWithTTF("Distance Field", "fonts/arial.ttf", 80, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true);
|
auto label2 = Label::createWithTTF(ttfConfig,"Distance Field",TextHAlignment::CENTER,size.width);
|
||||||
label2->setPosition( Point(size.width/2, size.height/5) );
|
label2->setPosition( Point(size.width/2, size.height/5) );
|
||||||
label2->setColor( Color3B::RED );
|
label2->setColor( Color3B::RED );
|
||||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||||
|
@ -1205,21 +1209,23 @@ LabelTTFDistanceFieldEffect::LabelTTFDistanceFieldEffect()
|
||||||
auto bg = LayerColor::create(Color4B(200,191,231,255));
|
auto bg = LayerColor::create(Color4B(200,191,231,255));
|
||||||
this->addChild(bg);
|
this->addChild(bg);
|
||||||
|
|
||||||
auto label1 = Label::createWithTTF("Glow", "fonts/arial.ttf", 80, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true);
|
TTFConfig ttfConfig("fonts/arial.ttf", 80, GlyphCollection::DYNAMIC,nullptr,true);
|
||||||
|
|
||||||
|
auto label1 = Label::createWithTTF(ttfConfig,"Glow", TextHAlignment::CENTER, size.width);
|
||||||
label1->setPosition( Point(size.width/2, size.height*0.5) );
|
label1->setPosition( Point(size.width/2, size.height*0.5) );
|
||||||
label1->setColor( Color3B::GREEN );
|
label1->setColor( Color3B::GREEN );
|
||||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||||
label1->setLabelEffect(LabelEffect::GLOW,Color3B::YELLOW);
|
label1->setLabelEffect(LabelEffect::GLOW,Color3B::YELLOW);
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
|
|
||||||
auto label2 = Label::createWithTTF("Outline", "fonts/arial.ttf", 80, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true);
|
auto label2 = Label::createWithTTF(ttfConfig,"Outline", TextHAlignment::CENTER, size.width);
|
||||||
label2->setPosition( Point(size.width/2, size.height*0.375) );
|
label2->setPosition( Point(size.width/2, size.height*0.375) );
|
||||||
label2->setColor( Color3B::RED );
|
label2->setColor( Color3B::RED );
|
||||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||||
label2->setLabelEffect(LabelEffect::OUTLINE,Color3B::BLUE);
|
label2->setLabelEffect(LabelEffect::OUTLINE,Color3B::BLUE);
|
||||||
addChild(label2);
|
addChild(label2);
|
||||||
|
|
||||||
auto label3 = Label::createWithTTF("Shadow", "fonts/arial.ttf", 80, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true);
|
auto label3 = Label::createWithTTF(ttfConfig,"Shadow", TextHAlignment::CENTER, size.width);
|
||||||
label3->setPosition( Point(size.width/2, size.height*0.25f) );
|
label3->setPosition( Point(size.width/2, size.height*0.25f) );
|
||||||
label3->setColor( Color3B::RED );
|
label3->setColor( Color3B::RED );
|
||||||
label3->setAnchorPoint(Point(0.5, 0.5));
|
label3->setAnchorPoint(Point(0.5, 0.5));
|
||||||
|
@ -1237,3 +1243,25 @@ std::string LabelTTFDistanceFieldEffect::subtitle() const
|
||||||
{
|
{
|
||||||
return "Testing effect base on DistanceField";
|
return "Testing effect base on DistanceField";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LabelCrashTest::LabelCrashTest()
|
||||||
|
{
|
||||||
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
TTFConfig ttfConfig("fonts/arial.ttf", 80, GlyphCollection::DYNAMIC,nullptr,true);
|
||||||
|
|
||||||
|
auto label1 = Label::createWithTTF(ttfConfig,"Test崩溃123", TextHAlignment::CENTER, size.width);
|
||||||
|
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||||
|
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||||
|
addChild(label1);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelCrashTest::title() const
|
||||||
|
{
|
||||||
|
return "New Label Crash Test";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelCrashTest::subtitle() const
|
||||||
|
{
|
||||||
|
return "Not crash and show [Test123] when using unknown character.";
|
||||||
|
}
|
||||||
|
|
|
@ -347,6 +347,16 @@ public:
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LabelCrashTest : public AtlasDemoNew
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(LabelCrashTest);
|
||||||
|
|
||||||
|
LabelCrashTest();
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
};
|
||||||
|
|
||||||
// we don't support linebreak mode
|
// we don't support linebreak mode
|
||||||
|
|
||||||
|
|
|
@ -764,20 +764,22 @@ void DirectorEventTest::onEnter()
|
||||||
|
|
||||||
Size s = Director::getInstance()->getWinSize();
|
Size s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
_label1 = Label::createWithTTF("Update: 0", "fonts/arial.ttf", 20);
|
TTFConfig ttfConfig("fonts/arial.ttf", 20);
|
||||||
|
|
||||||
|
_label1 = Label::createWithTTF(ttfConfig, "Update: 0");
|
||||||
_label1->setPosition(30,s.height/2 + 60);
|
_label1->setPosition(30,s.height/2 + 60);
|
||||||
this->addChild(_label1);
|
this->addChild(_label1);
|
||||||
|
|
||||||
_label2 = Label::createWithTTF("Visit: 0", "fonts/arial.ttf", 20);
|
_label2 = Label::createWithTTF(ttfConfig, "Visit: 0");
|
||||||
_label2->setPosition(30,s.height/2 + 20);
|
_label2->setPosition(30,s.height/2 + 20);
|
||||||
this->addChild(_label2);
|
this->addChild(_label2);
|
||||||
|
|
||||||
_label3 = Label::createWithTTF("Draw: 0", "fonts/arial.ttf", 20);
|
_label3 = Label::createWithTTF(ttfConfig, "Draw: 0");
|
||||||
_label3->setPosition(30,30);
|
_label3->setPosition(30,30);
|
||||||
_label3->setPosition(30,s.height/2 - 20);
|
_label3->setPosition(30,s.height/2 - 20);
|
||||||
this->addChild(_label3);
|
this->addChild(_label3);
|
||||||
|
|
||||||
_label4 = Label::createWithTTF("Projection: 0", "fonts/arial.ttf", 20);
|
_label4 = Label::createWithTTF(ttfConfig, "Projection: 0");
|
||||||
_label4->setPosition(30,30);
|
_label4->setPosition(30,30);
|
||||||
_label4->setPosition(30,s.height/2 - 60);
|
_label4->setPosition(30,s.height/2 - 60);
|
||||||
this->addChild(_label4);
|
this->addChild(_label4);
|
||||||
|
|
|
@ -0,0 +1,711 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "PerformanceContainerTest.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// Enable profiles for this file
|
||||||
|
#undef CC_PROFILER_DISPLAY_TIMERS
|
||||||
|
#define CC_PROFILER_DISPLAY_TIMERS() Profiler::getInstance()->displayTimers()
|
||||||
|
#undef CC_PROFILER_PURGE_ALL
|
||||||
|
#define CC_PROFILER_PURGE_ALL() Profiler::getInstance()->releaseAllTimers()
|
||||||
|
|
||||||
|
#undef CC_PROFILER_START
|
||||||
|
#define CC_PROFILER_START(__name__) ProfilingBeginTimingBlock(__name__)
|
||||||
|
#undef CC_PROFILER_STOP
|
||||||
|
#define CC_PROFILER_STOP(__name__) ProfilingEndTimingBlock(__name__)
|
||||||
|
#undef CC_PROFILER_RESET
|
||||||
|
#define CC_PROFILER_RESET(__name__) ProfilingResetTimingBlock(__name__)
|
||||||
|
|
||||||
|
#undef CC_PROFILER_START_CATEGORY
|
||||||
|
#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingBeginTimingBlock(__name__); } while(0)
|
||||||
|
#undef CC_PROFILER_STOP_CATEGORY
|
||||||
|
#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingEndTimingBlock(__name__); } while(0)
|
||||||
|
#undef CC_PROFILER_RESET_CATEGORY
|
||||||
|
#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingResetTimingBlock(__name__); } while(0)
|
||||||
|
|
||||||
|
#undef CC_PROFILER_START_INSTANCE
|
||||||
|
#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ ProfilingBeginTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
|
||||||
|
#undef CC_PROFILER_STOP_INSTANCE
|
||||||
|
#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ ProfilingEndTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
|
||||||
|
#undef CC_PROFILER_RESET_INSTANCE
|
||||||
|
#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ ProfilingResetTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
|
||||||
|
|
||||||
|
static std::function<PerformanceContainerScene*()> createFunctions[] =
|
||||||
|
{
|
||||||
|
CL(TemplateVectorPerfTest),
|
||||||
|
CL(ArrayPerfTest)
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kTagInfoLayer = 1,
|
||||||
|
|
||||||
|
kTagBase = 20000,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kMaxNodes = 15000,
|
||||||
|
kNodesIncrease = 500,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int g_curCase = 0;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// ContainerBasicLayer
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ContainerBasicLayer::ContainerBasicLayer(bool bControlMenuVisible, int nMaxCases, int nCurCase)
|
||||||
|
: PerformBasicLayer(bControlMenuVisible, nMaxCases, nCurCase)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContainerBasicLayer::showCurrentTest()
|
||||||
|
{
|
||||||
|
int nodes = ((PerformanceContainerScene*)getParent())->getQuantityOfNodes();
|
||||||
|
|
||||||
|
auto scene = createFunctions[_curCase]();
|
||||||
|
|
||||||
|
g_curCase = _curCase;
|
||||||
|
|
||||||
|
if (scene)
|
||||||
|
{
|
||||||
|
scene->initWithQuantityOfNodes(nodes);
|
||||||
|
|
||||||
|
Director::getInstance()->replaceScene(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PerformanceContainerScene
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes)
|
||||||
|
{
|
||||||
|
_type = 0;
|
||||||
|
//srand(time());
|
||||||
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
// Title
|
||||||
|
auto label = LabelTTF::create(title().c_str(), "Arial", 40);
|
||||||
|
addChild(label, 1, TAG_TITLE);
|
||||||
|
label->setPosition(Point(s.width/2, s.height-32));
|
||||||
|
label->setColor(Color3B(255,255,40));
|
||||||
|
|
||||||
|
// Subtitle
|
||||||
|
std::string strSubTitle = subtitle();
|
||||||
|
if(strSubTitle.length())
|
||||||
|
{
|
||||||
|
auto l = LabelTTF::create(strSubTitle.c_str(), "Thonburi", 16);
|
||||||
|
addChild(l, 1, TAG_SUBTITLE);
|
||||||
|
l->setPosition(Point(s.width/2, s.height-80));
|
||||||
|
}
|
||||||
|
|
||||||
|
lastRenderedCount = 0;
|
||||||
|
currentQuantityOfNodes = 0;
|
||||||
|
quantityOfNodes = nNodes;
|
||||||
|
|
||||||
|
MenuItemFont::setFontSize(65);
|
||||||
|
auto decrease = MenuItemFont::create(" - ", [&](Object *sender) {
|
||||||
|
quantityOfNodes -= kNodesIncrease;
|
||||||
|
if( quantityOfNodes < 0 )
|
||||||
|
quantityOfNodes = 0;
|
||||||
|
|
||||||
|
updateQuantityLabel();
|
||||||
|
updateQuantityOfNodes();
|
||||||
|
updateProfilerName();
|
||||||
|
CC_PROFILER_PURGE_ALL();
|
||||||
|
srand(0);
|
||||||
|
});
|
||||||
|
decrease->setColor(Color3B(0,200,20));
|
||||||
|
_decrease = decrease;
|
||||||
|
|
||||||
|
auto increase = MenuItemFont::create(" + ", [&](Object *sender) {
|
||||||
|
quantityOfNodes += kNodesIncrease;
|
||||||
|
if( quantityOfNodes > kMaxNodes )
|
||||||
|
quantityOfNodes = kMaxNodes;
|
||||||
|
|
||||||
|
updateQuantityLabel();
|
||||||
|
updateQuantityOfNodes();
|
||||||
|
updateProfilerName();
|
||||||
|
CC_PROFILER_PURGE_ALL();
|
||||||
|
srand(0);
|
||||||
|
});
|
||||||
|
increase->setColor(Color3B(0,200,20));
|
||||||
|
_increase = increase;
|
||||||
|
|
||||||
|
auto menu = Menu::create(decrease, increase, NULL);
|
||||||
|
menu->alignItemsHorizontally();
|
||||||
|
menu->setPosition(Point(s.width/2, s.height/2+15));
|
||||||
|
addChild(menu, 1);
|
||||||
|
|
||||||
|
auto infoLabel = LabelTTF::create("0 nodes", "Marker Felt", 30);
|
||||||
|
infoLabel->setColor(Color3B(0,200,20));
|
||||||
|
infoLabel->setPosition(Point(s.width/2, s.height/2-15));
|
||||||
|
addChild(infoLabel, 1, kTagInfoLayer);
|
||||||
|
|
||||||
|
auto menuLayer = new ContainerBasicLayer(true, MAX_LAYER, g_curCase);
|
||||||
|
addChild(menuLayer);
|
||||||
|
menuLayer->release();
|
||||||
|
|
||||||
|
printf("Size of Node: %lu\n", sizeof(Node));
|
||||||
|
|
||||||
|
int oldFontSize = MenuItemFont::getFontSize();
|
||||||
|
MenuItemFont::setFontSize(24);
|
||||||
|
|
||||||
|
Vector<cocos2d::MenuItem *> toggleItems;
|
||||||
|
|
||||||
|
generateTestFunctions();
|
||||||
|
|
||||||
|
CCASSERT(!_testFunctions.empty(), "Should not be empty after generate test functions");
|
||||||
|
|
||||||
|
|
||||||
|
for (const auto& f : _testFunctions)
|
||||||
|
{
|
||||||
|
toggleItems.pushBack(MenuItemFont::create(f.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto toggle = MenuItemToggle::createWithCallback([this](Object* sender){
|
||||||
|
auto toggle = static_cast<MenuItemToggle*>(sender);
|
||||||
|
this->_type = toggle->getSelectedIndex();
|
||||||
|
auto label = static_cast<LabelTTF*>(this->getChildByTag(TAG_SUBTITLE));
|
||||||
|
label->setString(StringUtils::format("Test '%s', See console", this->_testFunctions[this->_type].name));
|
||||||
|
this->updateProfilerName();
|
||||||
|
}, toggleItems);
|
||||||
|
|
||||||
|
toggle->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT);
|
||||||
|
toggle->setPosition(VisibleRect::left());
|
||||||
|
_toggle = toggle;
|
||||||
|
|
||||||
|
auto start = MenuItemFont::create("start", [this](Object* sender){
|
||||||
|
auto director = Director::getInstance();
|
||||||
|
auto sched = director->getScheduler();
|
||||||
|
|
||||||
|
CC_PROFILER_PURGE_ALL();
|
||||||
|
sched->scheduleSelector(schedule_selector(PerformanceContainerScene::dumpProfilerInfo), this, 2, false);
|
||||||
|
|
||||||
|
this->unscheduleUpdate();
|
||||||
|
this->scheduleUpdate();
|
||||||
|
this->_startItem->setEnabled(false);
|
||||||
|
this->_stopItem->setEnabled(true);
|
||||||
|
this->_toggle->setEnabled(false);
|
||||||
|
this->_increase->setEnabled(false);
|
||||||
|
this->_decrease->setEnabled(false);
|
||||||
|
});
|
||||||
|
start->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT);
|
||||||
|
start->setPosition(VisibleRect::right() + Point(0, 40));
|
||||||
|
_startItem = start;
|
||||||
|
|
||||||
|
auto stop = MenuItemFont::create("stop", [this](Object* sender){
|
||||||
|
auto director = Director::getInstance();
|
||||||
|
auto sched = director->getScheduler();
|
||||||
|
|
||||||
|
sched->unscheduleSelector(schedule_selector(PerformanceContainerScene::dumpProfilerInfo), this);
|
||||||
|
|
||||||
|
this->unscheduleUpdate();
|
||||||
|
this->_startItem->setEnabled(true);
|
||||||
|
this->_stopItem->setEnabled(false);
|
||||||
|
this->_toggle->setEnabled(true);
|
||||||
|
this->_increase->setEnabled(true);
|
||||||
|
this->_decrease->setEnabled(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
stop->setEnabled(false);
|
||||||
|
stop->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT);
|
||||||
|
stop->setPosition(VisibleRect::right() + Point(0, -40));
|
||||||
|
_stopItem = stop;
|
||||||
|
|
||||||
|
auto menu2 = Menu::create(toggle, start, stop, NULL);
|
||||||
|
menu2->setPosition(Point::ZERO);
|
||||||
|
addChild(menu2);
|
||||||
|
|
||||||
|
MenuItemFont::setFontSize(oldFontSize);
|
||||||
|
|
||||||
|
updateQuantityLabel();
|
||||||
|
updateQuantityOfNodes();
|
||||||
|
updateProfilerName();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string PerformanceContainerScene::title() const
|
||||||
|
{
|
||||||
|
return "No title";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string PerformanceContainerScene::subtitle() const
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::updateQuantityLabel()
|
||||||
|
{
|
||||||
|
if( quantityOfNodes != lastRenderedCount )
|
||||||
|
{
|
||||||
|
auto infoLabel = static_cast<LabelTTF*>( getChildByTag(kTagInfoLayer) );
|
||||||
|
char str[20] = {0};
|
||||||
|
sprintf(str, "%u nodes", quantityOfNodes);
|
||||||
|
infoLabel->setString(str);
|
||||||
|
|
||||||
|
lastRenderedCount = quantityOfNodes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * PerformanceContainerScene::profilerName()
|
||||||
|
{
|
||||||
|
return _profilerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::updateProfilerName()
|
||||||
|
{
|
||||||
|
snprintf(_profilerName, sizeof(_profilerName)-1, "%s(%d)", testName(), quantityOfNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::onExitTransitionDidStart()
|
||||||
|
{
|
||||||
|
Scene::onExitTransitionDidStart();
|
||||||
|
|
||||||
|
auto director = Director::getInstance();
|
||||||
|
auto sched = director->getScheduler();
|
||||||
|
|
||||||
|
sched->unscheduleSelector(schedule_selector(PerformanceContainerScene::dumpProfilerInfo), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::onEnterTransitionDidFinish()
|
||||||
|
{
|
||||||
|
Scene::onEnterTransitionDidFinish();
|
||||||
|
|
||||||
|
auto director = Director::getInstance();
|
||||||
|
auto sched = director->getScheduler();
|
||||||
|
|
||||||
|
CC_PROFILER_PURGE_ALL();
|
||||||
|
sched->scheduleSelector(schedule_selector(PerformanceContainerScene::dumpProfilerInfo), this, 2, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::dumpProfilerInfo(float dt)
|
||||||
|
{
|
||||||
|
CC_PROFILER_DISPLAY_TIMERS();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::update(float dt)
|
||||||
|
{
|
||||||
|
_testFunctions[_type].func();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceContainerScene::updateQuantityOfNodes()
|
||||||
|
{
|
||||||
|
currentQuantityOfNodes = quantityOfNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* PerformanceContainerScene::testName()
|
||||||
|
{
|
||||||
|
return _testFunctions[_type].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TemplateVectorPerfTest
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void TemplateVectorPerfTest::generateTestFunctions()
|
||||||
|
{
|
||||||
|
auto createVector = [this](){
|
||||||
|
Vector<Node*> ret;
|
||||||
|
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
{
|
||||||
|
auto node = Node::create();
|
||||||
|
node->setTag(i);
|
||||||
|
ret.pushBack(node);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
TestFunction testFunctions[] = {
|
||||||
|
{ "pushBack", [=](){
|
||||||
|
Vector<Node*> nodeVector;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.pushBack(Node::create());
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "insert", [=](){
|
||||||
|
Vector<Node*> nodeVector;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.insert(0, Node::create());
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "replace", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
srand(time(nullptr));
|
||||||
|
ssize_t index = rand() % quantityOfNodes;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.replace(index, Node::create());
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "getIndex", [=](){
|
||||||
|
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
Node* objToGet = nodeVector.at(quantityOfNodes/3);
|
||||||
|
ssize_t index = 0;
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
index = nodeVector.getIndex(objToGet);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
// Uses `index` to avoids `getIndex` invoking was optimized in release mode
|
||||||
|
if (index == quantityOfNodes/3)
|
||||||
|
{
|
||||||
|
nodeVector.clear();
|
||||||
|
}
|
||||||
|
} } ,
|
||||||
|
{ "find", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
Node* objToGet = nodeVector.at(quantityOfNodes/3);
|
||||||
|
Vector<Node*>::iterator iter;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
iter = nodeVector.find(objToGet);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
// Uses `iter` to avoids `find` invoking was optimized in release mode
|
||||||
|
if (*iter == objToGet)
|
||||||
|
{
|
||||||
|
nodeVector.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
} } ,
|
||||||
|
{ "at", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
Node* objToGet = nullptr;
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
objToGet = nodeVector.at(quantityOfNodes/3);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
// Uses `objToGet` to avoids `at` invoking was optimized in release mode
|
||||||
|
if (nodeVector.getIndex(objToGet) == quantityOfNodes/3)
|
||||||
|
{
|
||||||
|
nodeVector.clear();
|
||||||
|
}
|
||||||
|
} } ,
|
||||||
|
{ "contains", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
Node* objToGet = nodeVector.at(quantityOfNodes/3);
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
ret = nodeVector.contains(objToGet);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
// Uses `ret` to avoids `contains` invoking was optimized in release mode
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
nodeVector.clear();
|
||||||
|
}
|
||||||
|
} } ,
|
||||||
|
{ "eraseObject", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
Node** nodes = (Node**)malloc(sizeof(Node*) * quantityOfNodes);
|
||||||
|
|
||||||
|
for (int i = 0; i < quantityOfNodes; ++i)
|
||||||
|
{
|
||||||
|
nodes[i] = nodeVector.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.eraseObject(nodes[i]);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
CCASSERT(nodeVector.empty(), "nodeVector was not empty.");
|
||||||
|
|
||||||
|
free(nodes);
|
||||||
|
} } ,
|
||||||
|
{ "erase", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.erase(nodeVector.begin());
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
CCASSERT(nodeVector.empty(), "nodeVector was not empty.");
|
||||||
|
|
||||||
|
} } ,
|
||||||
|
{ "clear", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.clear();
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
CCASSERT(nodeVector.empty(), "nodeVector was not empty.");
|
||||||
|
} } ,
|
||||||
|
{ "swap by index", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
int swapIndex1 = quantityOfNodes / 3;
|
||||||
|
int swapIndex2 = quantityOfNodes / 3 * 2;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.swap(swapIndex1, swapIndex2);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
|
||||||
|
{ "swap by object", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
Node* swapNode1 = nodeVector.at(quantityOfNodes / 3);
|
||||||
|
Node* swapNode2 = nodeVector.at(quantityOfNodes / 3 * 2);
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.swap(swapNode1, swapNode2);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
|
||||||
|
{ "reverse", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector.reverse();
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
|
||||||
|
{ "c++11 Range Loop", [=](){
|
||||||
|
Vector<Node*> nodeVector = createVector();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for (const auto& e : nodeVector)
|
||||||
|
{
|
||||||
|
e->setTag(111);
|
||||||
|
}
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const auto& func : testFunctions)
|
||||||
|
{
|
||||||
|
_testFunctions.push_back(func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::string TemplateVectorPerfTest::title() const
|
||||||
|
{
|
||||||
|
return "Vector<T> Perf test";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string TemplateVectorPerfTest::subtitle() const
|
||||||
|
{
|
||||||
|
return "Test 'pushBack', See console";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// ArrayPerfTest
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
std::string ArrayPerfTest::title() const
|
||||||
|
{
|
||||||
|
return "Array Perf test";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ArrayPerfTest::subtitle() const
|
||||||
|
{
|
||||||
|
return "Test `addObject`, See console";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArrayPerfTest::generateTestFunctions()
|
||||||
|
{
|
||||||
|
auto createArray = [this](){
|
||||||
|
Array* ret = Array::create();
|
||||||
|
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
{
|
||||||
|
auto node = Node::create();
|
||||||
|
node->setTag(i);
|
||||||
|
ret->addObject(node);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
TestFunction testFunctions[] = {
|
||||||
|
{ "addObject", [=](){
|
||||||
|
Array* nodeVector = Array::create();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->addObject(Node::create());
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "insertObject", [=](){
|
||||||
|
Array* nodeVector = Array::create();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->insertObject(Node::create(), 0);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "setObject", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
srand(time(nullptr));
|
||||||
|
ssize_t index = rand() % quantityOfNodes;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->setObject(Node::create(), index);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "getIndexOfObject", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
Object* objToGet = nodeVector->getObjectAtIndex(quantityOfNodes/3);
|
||||||
|
ssize_t index = 0;
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
index = nodeVector->getIndexOfObject(objToGet);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
// Uses `index` to avoids `getIndex` invoking was optimized in release mode
|
||||||
|
if (index == quantityOfNodes/3)
|
||||||
|
{
|
||||||
|
nodeVector->removeAllObjects();
|
||||||
|
}
|
||||||
|
} } ,
|
||||||
|
{ "getObjectAtIndex", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->getObjectAtIndex(quantityOfNodes/3);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "containsObject", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
Object* objToGet = nodeVector->getObjectAtIndex(quantityOfNodes/3);
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->containsObject(objToGet);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
{ "removeObject", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
Node** nodes = (Node**)malloc(sizeof(Node*) * quantityOfNodes);
|
||||||
|
|
||||||
|
for (int i = 0; i < quantityOfNodes; ++i)
|
||||||
|
{
|
||||||
|
nodes[i] = static_cast<Node*>(nodeVector->getObjectAtIndex(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->removeObject(nodes[i]);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
CCASSERT(nodeVector->count() == 0, "nodeVector was not empty.");
|
||||||
|
|
||||||
|
free(nodes);
|
||||||
|
} } ,
|
||||||
|
{ "removeObjectAtIndex", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->removeObjectAtIndex(0);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
CCASSERT(nodeVector->count() == 0, "nodeVector was not empty.");
|
||||||
|
|
||||||
|
} } ,
|
||||||
|
{ "removeAllObjects", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->removeAllObjects();
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
CCASSERT(nodeVector->count() == 0, "nodeVector was not empty.");
|
||||||
|
} } ,
|
||||||
|
{ "swap by index", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
int swapIndex1 = quantityOfNodes / 3;
|
||||||
|
int swapIndex2 = quantityOfNodes / 3 * 2;
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->swap(swapIndex1, swapIndex2);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
|
||||||
|
{ "swap by object", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
Object* swapNode1 = nodeVector->getObjectAtIndex(quantityOfNodes / 3);
|
||||||
|
Object* swapNode2 = nodeVector->getObjectAtIndex(quantityOfNodes / 3 * 2);
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->exchangeObject(swapNode1, swapNode2);
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
|
||||||
|
{ "reverseObjects", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
nodeVector->reverseObjects();
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
|
||||||
|
{ "CCARRAY_FOREACH", [=](){
|
||||||
|
Array* nodeVector = createArray();
|
||||||
|
Object* obj;
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
|
||||||
|
CCARRAY_FOREACH(nodeVector, obj)
|
||||||
|
{
|
||||||
|
static_cast<Node*>(obj)->setTag(111);
|
||||||
|
}
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
} } ,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const auto& func : testFunctions)
|
||||||
|
{
|
||||||
|
_testFunctions.push_back(func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///----------------------------------------
|
||||||
|
void runContainerPerformanceTest()
|
||||||
|
{
|
||||||
|
auto scene = createFunctions[g_curCase]();
|
||||||
|
scene->initWithQuantityOfNodes(kNodesIncrease);
|
||||||
|
|
||||||
|
Director::getInstance()->replaceScene(scene);
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef __PERFORMANCE_CONTAINER_TEST_H__
|
||||||
|
#define __PERFORMANCE_CONTAINER_TEST_H__
|
||||||
|
|
||||||
|
#include "PerformanceTest.h"
|
||||||
|
#include "CCProfiling.h"
|
||||||
|
|
||||||
|
class ContainerBasicLayer : public PerformBasicLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContainerBasicLayer(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0);
|
||||||
|
|
||||||
|
virtual void showCurrentTest();
|
||||||
|
};
|
||||||
|
|
||||||
|
class PerformanceContainerScene : public Scene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const int TAG_TITLE = 100;
|
||||||
|
static const int TAG_SUBTITLE = 101;
|
||||||
|
|
||||||
|
struct TestFunction
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
std::function<void()> func;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void initWithQuantityOfNodes(unsigned int nNodes);
|
||||||
|
virtual void generateTestFunctions() = 0;
|
||||||
|
|
||||||
|
virtual std::string title() const;
|
||||||
|
virtual std::string subtitle() const;
|
||||||
|
virtual void updateQuantityOfNodes();
|
||||||
|
|
||||||
|
const char* profilerName();
|
||||||
|
void updateProfilerName();
|
||||||
|
|
||||||
|
// for the profiler
|
||||||
|
virtual const char* testName();
|
||||||
|
void updateQuantityLabel();
|
||||||
|
int getQuantityOfNodes() { return quantityOfNodes; }
|
||||||
|
void dumpProfilerInfo(float dt);
|
||||||
|
|
||||||
|
// overrides
|
||||||
|
virtual void onExitTransitionDidStart() override;
|
||||||
|
virtual void onEnterTransitionDidFinish() override;
|
||||||
|
virtual void update(float dt) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
char _profilerName[256];
|
||||||
|
int lastRenderedCount;
|
||||||
|
int quantityOfNodes;
|
||||||
|
int currentQuantityOfNodes;
|
||||||
|
unsigned int _type;
|
||||||
|
std::vector<TestFunction> _testFunctions;
|
||||||
|
|
||||||
|
MenuItemFont* _increase;
|
||||||
|
MenuItemFont* _decrease;
|
||||||
|
MenuItemFont* _startItem;
|
||||||
|
MenuItemFont* _stopItem;
|
||||||
|
MenuItemToggle* _toggle;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TemplateVectorPerfTest : public PerformanceContainerScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(TemplateVectorPerfTest);
|
||||||
|
|
||||||
|
virtual void generateTestFunctions() override;
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ArrayPerfTest : public PerformanceContainerScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(ArrayPerfTest);
|
||||||
|
|
||||||
|
virtual void generateTestFunctions() override;
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void runContainerPerformanceTest();
|
||||||
|
|
||||||
|
#endif // __PERFORMANCE_CONTAINER_TEST_H__
|
|
@ -86,6 +86,7 @@ void LabelMainScene::initWithSubTest(int nodes)
|
||||||
|
|
||||||
_lastRenderedCount = 0;
|
_lastRenderedCount = 0;
|
||||||
_quantityNodes = 0;
|
_quantityNodes = 0;
|
||||||
|
_accumulativeTime = 0.0f;
|
||||||
|
|
||||||
_labelContainer = Layer::create();
|
_labelContainer = Layer::create();
|
||||||
addChild(_labelContainer);
|
addChild(_labelContainer);
|
||||||
|
@ -212,15 +213,18 @@ void LabelMainScene::onIncrease(Object* sender)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kCaseLabelUpdate:
|
case kCaseLabelUpdate:
|
||||||
for( int i=0;i< kNodesIncrease;i++)
|
|
||||||
{
|
{
|
||||||
auto label = Label::createWithTTF("Label", "fonts/arial.ttf", 60, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true);
|
TTFConfig ttfConfig("fonts/arial.ttf", 60, GlyphCollection::DYNAMIC, nullptr, true);
|
||||||
label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50)));
|
for( int i=0;i< kNodesIncrease;i++)
|
||||||
_labelContainer->addChild(label, 1, _quantityNodes);
|
{
|
||||||
|
auto label = Label::createWithTTF(ttfConfig, "Label", TextHAlignment::CENTER, size.width);
|
||||||
|
label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50)));
|
||||||
|
_labelContainer->addChild(label, 1, _quantityNodes);
|
||||||
|
|
||||||
_quantityNodes++;
|
_quantityNodes++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case kCaseLabelBMFontBigLabels:
|
case kCaseLabelBMFontBigLabels:
|
||||||
for( int i=0;i< kNodesIncrease;i++)
|
for( int i=0;i< kNodesIncrease;i++)
|
||||||
{
|
{
|
||||||
|
@ -232,15 +236,18 @@ void LabelMainScene::onIncrease(Object* sender)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kCaseLabelBigLabels:
|
case kCaseLabelBigLabels:
|
||||||
for( int i=0;i< kNodesIncrease;i++)
|
|
||||||
{
|
{
|
||||||
auto label = Label::createWithTTF(LongSentencesExample, "fonts/arial.ttf", 60, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr);
|
TTFConfig ttfConfig("fonts/arial.ttf", 60, GlyphCollection::DYNAMIC);
|
||||||
label->setPosition(Point((rand() % 50), rand()%((int)size.height/3)));
|
for( int i=0;i< kNodesIncrease;i++)
|
||||||
_labelContainer->addChild(label, 1, _quantityNodes);
|
{
|
||||||
|
auto label = Label::createWithTTF(ttfConfig, LongSentencesExample, TextHAlignment::CENTER, size.width);
|
||||||
|
label->setPosition(Point((rand() % 50), rand()%((int)size.height/3)));
|
||||||
|
_labelContainer->addChild(label, 1, _quantityNodes);
|
||||||
|
|
||||||
_quantityNodes++;
|
_quantityNodes++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -330,7 +337,7 @@ void LabelMainScene::updateText(float dt)
|
||||||
case kCaseLabelUpdate:
|
case kCaseLabelUpdate:
|
||||||
for(const auto &child : children) {
|
for(const auto &child : children) {
|
||||||
Label* label = (Label*)child;
|
Label* label = (Label*)child;
|
||||||
label->setString(text,false);
|
label->setString(text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
//
|
||||||
|
// PerformanceRendererTest.cpp
|
||||||
|
// cocos2d_samples
|
||||||
|
//
|
||||||
|
// Created by Huabing on 1/10/14.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "PerformanceRendererTest.h"
|
||||||
|
#include "PerformanceTextureTest.h"
|
||||||
|
#include "../testResource.h"
|
||||||
|
|
||||||
|
RenderTestLayer::RenderTestLayer()
|
||||||
|
: PerformBasicLayer(true, 1, 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderTestLayer::~RenderTestLayer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene* RenderTestLayer::scene()
|
||||||
|
{
|
||||||
|
auto scene = Scene::create();
|
||||||
|
RenderTestLayer *layer = new RenderTestLayer();
|
||||||
|
scene->addChild(layer);
|
||||||
|
layer->release();
|
||||||
|
|
||||||
|
return scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderTestLayer::onEnter()
|
||||||
|
{
|
||||||
|
PerformBasicLayer::onEnter();
|
||||||
|
auto map = TMXTiledMap::create("TileMaps/map/sl.tmx");
|
||||||
|
|
||||||
|
Size CC_UNUSED s = map->getContentSize();
|
||||||
|
CCLOG("ContentSize: %f, %f", s.width,s.height);
|
||||||
|
|
||||||
|
addChild(map,-1);
|
||||||
|
|
||||||
|
//map->setAnchorPoint( Point(0, 0) );
|
||||||
|
//map->setPosition( Point(-20,-200) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderTestLayer::showCurrentTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void runRendererTest()
|
||||||
|
{
|
||||||
|
auto scene = RenderTestLayer::scene();
|
||||||
|
Director::getInstance()->replaceScene(scene);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// PerformanceRendererTest.h
|
||||||
|
// cocos2d_samples
|
||||||
|
//
|
||||||
|
// Created by Huabing on 1/10/14.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __PERFORMANCE_RENDERER_TEST_H__
|
||||||
|
#define __PERFORMANCE_RENDERER_TEST_H__
|
||||||
|
|
||||||
|
#include "PerformanceTest.h"
|
||||||
|
|
||||||
|
class RenderTestLayer : public PerformBasicLayer
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
RenderTestLayer();
|
||||||
|
virtual ~RenderTestLayer();
|
||||||
|
|
||||||
|
virtual void onEnter() override;
|
||||||
|
virtual void showCurrentTest() override;
|
||||||
|
public:
|
||||||
|
static Scene* scene();
|
||||||
|
};
|
||||||
|
|
||||||
|
void runRendererTest();
|
||||||
|
#endif
|
|
@ -48,11 +48,7 @@ enum {
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
SubTest::~SubTest()
|
SubTest::~SubTest()
|
||||||
{
|
{
|
||||||
if (_batchNode)
|
_parentNode->release();
|
||||||
{
|
|
||||||
_batchNode->release();
|
|
||||||
_batchNode = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubTest::initWithSubTest(int subtest, Node* p)
|
void SubTest::initWithSubTest(int subtest, Node* p)
|
||||||
|
@ -60,12 +56,11 @@ void SubTest::initWithSubTest(int subtest, Node* p)
|
||||||
srand(0);
|
srand(0);
|
||||||
|
|
||||||
subtestNumber = subtest;
|
subtestNumber = subtest;
|
||||||
_parent = p;
|
_parentNode = nullptr;
|
||||||
_batchNode = nullptr;
|
|
||||||
/*
|
/*
|
||||||
* Tests:
|
* Tests:
|
||||||
* 1: 1 (32-bit) PNG sprite of 52 x 139
|
* 1: 1 (32-bit) PNG sprite of 52 x 139
|
||||||
* 2: 1 (32-bit) PNG sprite of 52 x 139
|
* 2: 1 (32-bit) PNG sprite of 52 x 139 (same as 1)
|
||||||
* 3: 1 (32-bit) PNG Batch Node using 1 sprite of 52 x 139
|
* 3: 1 (32-bit) PNG Batch Node using 1 sprite of 52 x 139
|
||||||
* 4: 1 (16-bit) PNG Batch Node using 1 sprite of 52 x 139
|
* 4: 1 (16-bit) PNG Batch Node using 1 sprite of 52 x 139
|
||||||
|
|
||||||
|
@ -90,73 +85,67 @@ void SubTest::initWithSubTest(int subtest, Node* p)
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
case 1:
|
case 1:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||||
|
_parentNode = Node::create();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||||
_batchNode = SpriteBatchNode::create("Images/grossinis_sister1.png", 100);
|
_parentNode = SpriteBatchNode::create("Images/grossinis_sister1.png", 100);
|
||||||
p->addChild(_batchNode, 0);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
||||||
_batchNode = SpriteBatchNode::create("Images/grossinis_sister1.png", 100);
|
_parentNode = SpriteBatchNode::create("Images/grossinis_sister1.png", 100);
|
||||||
p->addChild(_batchNode, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
///
|
///
|
||||||
case 5:
|
case 5:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
|
||||||
break;
|
|
||||||
case 6:
|
case 6:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||||
_batchNode = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 100);
|
_parentNode = Node::create();
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||||
_batchNode = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 100);
|
_parentNode = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 100);
|
||||||
p->addChild(_batchNode, 0);
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
||||||
_batchNode = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 100);
|
_parentNode = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 100);
|
||||||
p->addChild(_batchNode, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
///
|
///
|
||||||
case 9:
|
case 9:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
|
||||||
break;
|
|
||||||
case 10:
|
case 10:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||||
_batchNode = SpriteBatchNode::create("Images/spritesheet1.png", 100);
|
_parentNode = Node::create();
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||||
_batchNode = SpriteBatchNode::create("Images/spritesheet1.png", 100);
|
_parentNode = SpriteBatchNode::create("Images/spritesheet1.png", 100);
|
||||||
p->addChild(_batchNode, 0);
|
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
||||||
_batchNode = SpriteBatchNode::create("Images/spritesheet1.png", 100);
|
_parentNode = SpriteBatchNode::create("Images/spritesheet1.png", 100);
|
||||||
p->addChild(_batchNode, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
case 13:
|
||||||
|
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444);
|
||||||
|
_parentNode = Node::create();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_batchNode)
|
p->addChild(_parentNode);
|
||||||
{
|
_parentNode->retain();
|
||||||
_batchNode->retain();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite* SubTest::createSpriteWithTag(int tag)
|
Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
{
|
{
|
||||||
|
TextureCache *cache = Director::getInstance()->getTextureCache();
|
||||||
|
|
||||||
Sprite* sprite = NULL;
|
Sprite* sprite = NULL;
|
||||||
switch (subtestNumber)
|
switch (subtestNumber)
|
||||||
{
|
{
|
||||||
|
@ -165,14 +154,15 @@ Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
sprite = Sprite::create("Images/grossinis_sister1.png");
|
sprite = Sprite::create("Images/grossinis_sister1.png");
|
||||||
_parent->addChild(sprite, 0, tag+100);
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
sprite = Sprite::createWithTexture(_batchNode->getTexture(), Rect(0, 0, 52, 139));
|
Texture2D *texture = cache->addImage("Images/grossinis_sister1.png");
|
||||||
_batchNode->addChild(sprite, 0, tag+100);
|
sprite = Sprite::createWithTexture(texture, Rect(0, 0, 52, 139));
|
||||||
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,24 +173,10 @@ Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
char str[32] = {0};
|
char str[32] = {0};
|
||||||
sprintf(str, "Images/grossini_dance_%02d.png", idx);
|
sprintf(str, "Images/grossini_dance_%02d.png", idx);
|
||||||
sprite = Sprite::create(str);
|
sprite = Sprite::create(str);
|
||||||
_parent->addChild(sprite, 0, tag+100);
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6:
|
case 6:
|
||||||
{
|
|
||||||
int y,x;
|
|
||||||
int r = (CCRANDOM_0_1() * 1400 / 100);
|
|
||||||
|
|
||||||
y = r / 5;
|
|
||||||
x = r % 5;
|
|
||||||
|
|
||||||
x *= 85;
|
|
||||||
y *= 121;
|
|
||||||
sprite = Sprite::createWithTexture(_batchNode->getTexture(), Rect(x,y,85,121));
|
|
||||||
_parent->addChild(sprite, 0, tag+100);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
|
@ -212,8 +188,9 @@ Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
|
|
||||||
x *= 85;
|
x *= 85;
|
||||||
y *= 121;
|
y *= 121;
|
||||||
sprite = Sprite::createWithTexture(_batchNode->getTexture(), Rect(x,y,85,121));
|
Texture2D *texture = cache->addImage("Images/grossini_dance_atlas.png");
|
||||||
_batchNode->addChild(sprite, 0, tag+100);
|
sprite = Sprite::createWithTexture(texture, Rect(x,y,85,121));
|
||||||
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,25 +206,11 @@ Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
char str[40] = {0};
|
char str[40] = {0};
|
||||||
sprintf(str, "Images/sprites_test/sprite-%d-%d.png", x, y);
|
sprintf(str, "Images/sprites_test/sprite-%d-%d.png", x, y);
|
||||||
sprite = Sprite::create(str);
|
sprite = Sprite::create(str);
|
||||||
_parent->addChild(sprite, 0, tag+100);
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
{
|
|
||||||
int y,x;
|
|
||||||
int r = (CCRANDOM_0_1() * 6400 / 100);
|
|
||||||
|
|
||||||
y = r / 8;
|
|
||||||
x = r % 8;
|
|
||||||
|
|
||||||
x *= 32;
|
|
||||||
y *= 32;
|
|
||||||
sprite = Sprite::createWithTexture(_batchNode->getTexture(), CC_RECT_PIXELS_TO_POINTS(Rect(x,y,32,32)));
|
|
||||||
_parent->addChild(sprite, 0, tag+100);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
case 12:
|
case 12:
|
||||||
{
|
{
|
||||||
|
@ -259,10 +222,52 @@ Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
|
|
||||||
x *= 32;
|
x *= 32;
|
||||||
y *= 32;
|
y *= 32;
|
||||||
sprite = Sprite::createWithTexture(_batchNode->getTexture(), CC_RECT_PIXELS_TO_POINTS(Rect(x,y,32,32)));
|
Texture2D *texture = cache->addImage("Images/spritesheet1.png");
|
||||||
_batchNode->addChild(sprite, 0, tag+100);
|
sprite = Sprite::createWithTexture(texture, CC_RECT_PIXELS_TO_POINTS(Rect(x,y,32,32)));
|
||||||
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
///
|
||||||
|
case 13:
|
||||||
|
{
|
||||||
|
int test = (CCRANDOM_0_1() * 3);
|
||||||
|
|
||||||
|
if(test==0) {
|
||||||
|
// Switch case 1
|
||||||
|
sprite = Sprite::create("Images/grossinis_sister1.png");
|
||||||
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
|
}
|
||||||
|
else if(test==1)
|
||||||
|
{
|
||||||
|
// Switch case 6
|
||||||
|
int y,x;
|
||||||
|
int r = (CCRANDOM_0_1() * 1400 / 100);
|
||||||
|
|
||||||
|
y = r / 5;
|
||||||
|
x = r % 5;
|
||||||
|
|
||||||
|
x *= 85;
|
||||||
|
y *= 121;
|
||||||
|
Texture2D *texture = cache->addImage("Images/grossini_dance_atlas.png");
|
||||||
|
sprite = Sprite::createWithTexture(texture, Rect(x,y,85,121));
|
||||||
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(test==2)
|
||||||
|
{
|
||||||
|
int y,x;
|
||||||
|
int r = (CCRANDOM_0_1() * 6400 / 100);
|
||||||
|
|
||||||
|
y = r / 8;
|
||||||
|
x = r % 8;
|
||||||
|
|
||||||
|
x *= 32;
|
||||||
|
y *= 32;
|
||||||
|
Texture2D *texture = cache->addImage("Images/spritesheet1.png");
|
||||||
|
sprite = Sprite::createWithTexture(texture, CC_RECT_PIXELS_TO_POINTS(Rect(x,y,32,32)));
|
||||||
|
_parentNode->addChild(sprite, 0, tag+100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -273,30 +278,7 @@ Sprite* SubTest::createSpriteWithTag(int tag)
|
||||||
|
|
||||||
void SubTest::removeByTag(int tag)
|
void SubTest::removeByTag(int tag)
|
||||||
{
|
{
|
||||||
switch (subtestNumber)
|
_parentNode->removeChildByTag(tag+100, true);
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 5:
|
|
||||||
case 9:
|
|
||||||
_parent->removeChildByTag(tag+100, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
case 12:
|
|
||||||
_batchNode->removeChildByTag(tag+100, true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
@ -443,9 +425,9 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
||||||
addChild( menuAutoTest, 3, kTagAutoTestMenu );
|
addChild( menuAutoTest, 3, kTagAutoTestMenu );
|
||||||
|
|
||||||
// Sub Tests
|
// Sub Tests
|
||||||
MenuItemFont::setFontSize(32);
|
MenuItemFont::setFontSize(28);
|
||||||
auto subMenu = Menu::create();
|
auto subMenu = Menu::create();
|
||||||
for (int i = 1; i <= 12; ++i)
|
for (int i = 1; i <= 13; ++i)
|
||||||
{
|
{
|
||||||
char str[10] = {0};
|
char str[10] = {0};
|
||||||
sprintf(str, "%d ", i);
|
sprintf(str, "%d ", i);
|
||||||
|
@ -457,8 +439,10 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
||||||
itemFont->setColor(Color3B(200,20,20));
|
itemFont->setColor(Color3B(200,20,20));
|
||||||
else if(i <= 8)
|
else if(i <= 8)
|
||||||
itemFont->setColor(Color3B(0,200,20));
|
itemFont->setColor(Color3B(0,200,20));
|
||||||
else
|
else if( i<=12)
|
||||||
itemFont->setColor(Color3B(0,20,200));
|
itemFont->setColor(Color3B(0,20,200));
|
||||||
|
else
|
||||||
|
itemFont->setColor(Color3B::GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
subMenu->alignItemsHorizontally();
|
subMenu->alignItemsHorizontally();
|
||||||
|
|
|
@ -40,8 +40,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int subtestNumber;
|
int subtestNumber;
|
||||||
SpriteBatchNode *_batchNode;
|
Node *_parentNode;
|
||||||
Node* _parent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpriteMenuLayer : public PerformBasicLayer
|
class SpriteMenuLayer : public PerformBasicLayer
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "PerformanceTouchesTest.h"
|
#include "PerformanceTouchesTest.h"
|
||||||
#include "PerformanceAllocTest.h"
|
#include "PerformanceAllocTest.h"
|
||||||
#include "PerformanceLabelTest.h"
|
#include "PerformanceLabelTest.h"
|
||||||
|
#include "PerformanceRendererTest.h"
|
||||||
|
#include "PerformanceContainerTest.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -26,6 +28,8 @@ struct {
|
||||||
{ "Texture Perf Test",[](Object*sender){runTextureTest();} },
|
{ "Texture Perf Test",[](Object*sender){runTextureTest();} },
|
||||||
{ "Touches Perf Test",[](Object*sender){runTouchesTest();} },
|
{ "Touches Perf Test",[](Object*sender){runTouchesTest();} },
|
||||||
{ "Label Perf Test",[](Object*sender){runLabelTest();} },
|
{ "Label Perf Test",[](Object*sender){runLabelTest();} },
|
||||||
|
{ "Renderer Perf Test",[](Object*sender){runRendererTest();} },
|
||||||
|
{ "Container Perf Test", [](Object* sender ) { runContainerPerformanceTest(); } }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int g_testMax = sizeof(g_testsName)/sizeof(g_testsName[0]);
|
static const int g_testMax = sizeof(g_testsName)/sizeof(g_testsName[0]);
|
||||||
|
@ -41,18 +45,83 @@ void PerformanceMainLayer::onEnter()
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
auto menu = Menu::create();
|
_itemMenu = Menu::create();
|
||||||
menu->setPosition( Point::ZERO );
|
_itemMenu->setPosition( Point::ZERO );
|
||||||
MenuItemFont::setFontName("Arial");
|
MenuItemFont::setFontName("Arial");
|
||||||
MenuItemFont::setFontSize(24);
|
MenuItemFont::setFontSize(24);
|
||||||
for (int i = 0; i < g_testMax; ++i)
|
for (int i = 0; i < g_testMax; ++i)
|
||||||
{
|
{
|
||||||
auto pItem = MenuItemFont::create(g_testsName[i].name, g_testsName[i].callback);
|
auto pItem = MenuItemFont::create(g_testsName[i].name, g_testsName[i].callback);
|
||||||
pItem->setPosition(Point(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
pItem->setPosition(Point(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||||
menu->addChild(pItem, kItemTagBasic + i);
|
_itemMenu->addChild(pItem, kItemTagBasic + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
addChild(menu);
|
addChild(_itemMenu);
|
||||||
|
|
||||||
|
// Register Touch Event
|
||||||
|
auto listener = EventListenerTouchOneByOne::create();
|
||||||
|
listener->setSwallowTouches(true);
|
||||||
|
|
||||||
|
listener->onTouchBegan = CC_CALLBACK_2(PerformanceMainLayer::onTouchBegan, this);
|
||||||
|
listener->onTouchMoved = CC_CALLBACK_2(PerformanceMainLayer::onTouchMoved, this);
|
||||||
|
|
||||||
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||||
|
|
||||||
|
auto mouseListener = EventListenerMouse::create();
|
||||||
|
mouseListener->onMouseScroll = CC_CALLBACK_1(PerformanceMainLayer::onMouseScroll, this);
|
||||||
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PerformanceMainLayer::onTouchBegan(Touch* touches, Event *event)
|
||||||
|
{
|
||||||
|
_beginPos = touches->getLocation();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void PerformanceMainLayer::onTouchMoved(Touch* touches, Event *event)
|
||||||
|
{
|
||||||
|
auto touchLocation = touches->getLocation();
|
||||||
|
float nMoveY = touchLocation.y - _beginPos.y;
|
||||||
|
|
||||||
|
auto curPos = _itemMenu->getPosition();
|
||||||
|
auto nextPos = Point(curPos.x, curPos.y + nMoveY);
|
||||||
|
|
||||||
|
if (nextPos.y < 0.0f)
|
||||||
|
{
|
||||||
|
_itemMenu->setPosition(Point::ZERO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextPos.y > ((g_testMax + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||||
|
{
|
||||||
|
_itemMenu->setPosition(Point(0, ((g_testMax + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_itemMenu->setPosition(nextPos);
|
||||||
|
_beginPos = touchLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformanceMainLayer::onMouseScroll(Event *event)
|
||||||
|
{
|
||||||
|
auto mouseEvent = static_cast<EventMouse*>(event);
|
||||||
|
float nMoveY = mouseEvent->getScrollY() * 6;
|
||||||
|
|
||||||
|
auto curPos = _itemMenu->getPosition();
|
||||||
|
auto nextPos = Point(curPos.x, curPos.y + nMoveY);
|
||||||
|
|
||||||
|
if (nextPos.y < 0.0f)
|
||||||
|
{
|
||||||
|
_itemMenu->setPosition(Point::ZERO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextPos.y > ((g_testMax + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||||
|
{
|
||||||
|
_itemMenu->setPosition(Point(0, ((g_testMax + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_itemMenu->setPosition(nextPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -7,6 +7,14 @@ class PerformanceMainLayer : public Layer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void onEnter();
|
virtual void onEnter();
|
||||||
|
|
||||||
|
bool onTouchBegan(Touch* touches, Event *event);
|
||||||
|
void onTouchMoved(Touch* touches, Event *event);
|
||||||
|
|
||||||
|
void onMouseScroll(Event *event);
|
||||||
|
protected:
|
||||||
|
Point _beginPos;
|
||||||
|
Menu* _itemMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerformBasicLayer : public Layer
|
class PerformBasicLayer : public Layer
|
||||||
|
|
|
@ -151,7 +151,6 @@ TestController::~TestController()
|
||||||
|
|
||||||
void TestController::menuCallback(Object * sender)
|
void TestController::menuCallback(Object * sender)
|
||||||
{
|
{
|
||||||
|
|
||||||
Director::getInstance()->purgeCachedData();
|
Director::getInstance()->purgeCachedData();
|
||||||
|
|
||||||
// get the userdata, it's the index of the menu item clicked
|
// get the userdata, it's the index of the menu item clicked
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
64ce8a88d0dee73cf5d9fbb8f3c80673c82b9575
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -186,7 +186,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$
|
||||||
<ClCompile Include="..\Classes\NewEventDispatcherTest\NewEventDispatcherTest.cpp" />
|
<ClCompile Include="..\Classes\NewEventDispatcherTest\NewEventDispatcherTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\NewRendererTest\NewRendererTest.cpp" />
|
<ClCompile Include="..\Classes\NewRendererTest\NewRendererTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\PerformanceTest\PerformanceAllocTest.cpp" />
|
<ClCompile Include="..\Classes\PerformanceTest\PerformanceAllocTest.cpp" />
|
||||||
|
<ClCompile Include="..\Classes\PerformanceTest\PerformanceContainerTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\PerformanceTest\PerformanceLabelTest.cpp" />
|
<ClCompile Include="..\Classes\PerformanceTest\PerformanceLabelTest.cpp" />
|
||||||
|
<ClCompile Include="..\Classes\PerformanceTest\PerformanceRendererTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\PhysicsTest\PhysicsTest.cpp" />
|
<ClCompile Include="..\Classes\PhysicsTest\PhysicsTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\ShaderTest\ShaderTest2.cpp" />
|
<ClCompile Include="..\Classes\ShaderTest\ShaderTest2.cpp" />
|
||||||
<ClCompile Include="..\Classes\SpineTest\SpineTest.cpp" />
|
<ClCompile Include="..\Classes\SpineTest\SpineTest.cpp" />
|
||||||
|
@ -331,7 +333,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$
|
||||||
<ClInclude Include="..\Classes\LabelTest\LabelTestNew.h" />
|
<ClInclude Include="..\Classes\LabelTest\LabelTestNew.h" />
|
||||||
<ClInclude Include="..\Classes\NewEventDispatcherTest\NewEventDispatcherTest.h" />
|
<ClInclude Include="..\Classes\NewEventDispatcherTest\NewEventDispatcherTest.h" />
|
||||||
<ClInclude Include="..\Classes\NewRendererTest\NewRendererTest.h" />
|
<ClInclude Include="..\Classes\NewRendererTest\NewRendererTest.h" />
|
||||||
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceAllocTest.h" />
|
||||||
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceContainerTest.h" />
|
||||||
<ClInclude Include="..\Classes\PerformanceTest\PerformanceLabelTest.h" />
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceLabelTest.h" />
|
||||||
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceRendererTest.h" />
|
||||||
<ClInclude Include="..\Classes\PhysicsTest\PhysicsTest.h" />
|
<ClInclude Include="..\Classes\PhysicsTest\PhysicsTest.h" />
|
||||||
<ClInclude Include="..\Classes\ShaderTest\ShaderTest2.h" />
|
<ClInclude Include="..\Classes\ShaderTest\ShaderTest2.h" />
|
||||||
<ClInclude Include="..\Classes\SpineTest\SpineTest.h" />
|
<ClInclude Include="..\Classes\SpineTest\SpineTest.h" />
|
||||||
|
|
|
@ -715,6 +715,12 @@
|
||||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\cons.cpp">
|
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\cons.cpp">
|
||||||
<Filter>Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode</Filter>
|
<Filter>Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Classes\PerformanceTest\PerformanceRendererTest.cpp">
|
||||||
|
<Filter>Classes\PerformanceTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Classes\PerformanceTest\PerformanceContainerTest.cpp">
|
||||||
|
<Filter>Classes\PerformanceTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="main.h">
|
<ClInclude Include="main.h">
|
||||||
|
@ -1318,5 +1324,14 @@
|
||||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\EventDef.h">
|
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\EventDef.h">
|
||||||
<Filter>Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode</Filter>
|
<Filter>Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceRendererTest.h">
|
||||||
|
<Filter>Classes\PerformanceTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceAllocTest.h">
|
||||||
|
<Filter>Classes\PerformanceTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Classes\PerformanceTest\PerformanceContainerTest.h">
|
||||||
|
<Filter>Classes\PerformanceTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Exit on error
|
|
||||||
set -e
|
|
||||||
|
|
||||||
rm -rf ../bin
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
#make global libs
|
|
||||||
cd ../cocos2d
|
|
||||||
#install depend libs
|
|
||||||
sudo ./build/install-deps-linux.sh
|
|
||||||
mkdir -p linux-build
|
|
||||||
cd linux-build
|
|
||||||
cmake .. -DBUILD_LIBS_LUA=OFF -DBUILD_HelloCpp=OFF -DBUILD_TestCpp=OFF -DBUILD_HelloLua=OFF -DBUILD_TestLua=OFF
|
|
||||||
make -j4
|
|
||||||
|
|
||||||
#make bin
|
|
||||||
cd $DIR
|
|
||||||
rm -rf bin
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
cmake ../..
|
|
||||||
make -j4
|
|
||||||
cd ..
|
|
||||||
mv ../bin bin
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize">
|
android:configChanges="orientation">
|
||||||
|
|
||||||
<!-- Tell NativeActivity the name of our .so -->
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data android:name="android.app.lib_name"
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Exit on error
|
|
||||||
set -e
|
|
||||||
|
|
||||||
rm -rf ../bin
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
#make global libs
|
|
||||||
cd ../cocos2d
|
|
||||||
#install depend libs
|
|
||||||
sudo ./build/install-deps-linux.sh
|
|
||||||
mkdir -p linux-build
|
|
||||||
cd linux-build
|
|
||||||
cmake .. -DBUILD_HelloCpp=OFF -DBUILD_TestCpp=OFF -DBUILD_HelloLua=OFF -DBUILD_TestLua=OFF
|
|
||||||
make -j4
|
|
||||||
|
|
||||||
#make bin
|
|
||||||
cd $DIR
|
|
||||||
rm -rf bin
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
cmake ../..
|
|
||||||
make -j4
|
|
||||||
cd ..
|
|
||||||
mv ../bin bin
|
|
||||||
cp ../cocos2d/cocos/scripting/lua/script/* bin/Resources
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# create_project.py
|
# obfuscate.py
|
||||||
# Create cross-platform cocos2d-x project
|
# Create Ant buildfile to obfuscate game source code
|
||||||
# Copyright (c) 2012 cocos2d-x.org
|
# Copyright (c) 2012 cocos2d-x.org
|
||||||
# Author: WangZhe
|
# Author: WangZhe
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ import sys
|
||||||
import os, os.path
|
import os, os.path
|
||||||
|
|
||||||
def dumpUsage():
|
def dumpUsage():
|
||||||
print "Usage: generate-config.py -input INPUT_PATH -output OUTPUT_PATH -cocos2d COCOS2D_ROOT_PATH"
|
print "Usage: %s -input INPUT_PATH -output OUTPUT_PATH -cocos2d COCOS2D_ROOT_PATH" % (os.path.basename(__file__))
|
||||||
print "Options:"
|
print "Options:"
|
||||||
print " -intput INPUT_PATH The path to javscript files directory"
|
print " -input INPUT_PATH The path to javascript files directory"
|
||||||
print " -output OUTPUT_PATH The path to the obfuscated javascript file"
|
print " -output OUTPUT_PATH The path to the obfuscated javascript file"
|
||||||
print " -cocos2d COCOS2D_ROOT_PATH The root path of cocos2d-x, e.g. /workspace/cocos2d-x"
|
print " -cocos2d COCOS2D_ROOT_PATH The root path of cocos2d-x, e.g. /workspace/cocos2d-x"
|
||||||
print ""
|
print ""
|
||||||
|
@ -123,7 +123,7 @@ checkParams()
|
||||||
generateXmlForCompiler()
|
generateXmlForCompiler()
|
||||||
# print "running ant to generate obfuscated main.js"
|
# print "running ant to generate obfuscated main.js"
|
||||||
# os.popen("ant -buildfile obfuscate.xml")
|
# os.popen("ant -buildfile obfuscate.xml")
|
||||||
print "Successful! obfuscate.xml is generated."
|
print "Successful! obfuscate.xml generated."
|
||||||
print "Note: Please reoder the files sequence in obfuscate.xml, keep it the same order as javascript \"requrie\" instruction,"
|
print "Note: Please reorder the file's sequence in obfuscate.xml, keep it the same order as javascript \"require\" instruction,"
|
||||||
print "then call \"ant -buildfile obfuscate.xml\" to obfuscate your js codes."
|
print "then call \"ant -buildfile obfuscate.xml\" to obfuscate your js code."
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
#Github pull reqest builder for Jenkins
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
def main():
|
||||||
|
#get payload from os env
|
||||||
|
payload_str = os.environ['payload']
|
||||||
|
#parse to json obj
|
||||||
|
payload = json.loads(payload_str)
|
||||||
|
|
||||||
|
#get pull number
|
||||||
|
pr_num = payload['number']
|
||||||
|
print 'pr_num:' + str(pr_num)
|
||||||
|
|
||||||
|
#build for pull request action 'open' and 'synchronize', skip 'close'
|
||||||
|
action = payload['action']
|
||||||
|
print 'action: ' + action
|
||||||
|
|
||||||
|
pr = payload['pull_request']
|
||||||
|
|
||||||
|
url = pr['html_url']
|
||||||
|
print "url:" + url
|
||||||
|
|
||||||
|
#get statuses url
|
||||||
|
statuses_url = pr['statuses_url']
|
||||||
|
|
||||||
|
#get pr target branch
|
||||||
|
branch = pr['base']['ref']
|
||||||
|
|
||||||
|
#set commit status to pending
|
||||||
|
target_url = os.environ['BUILD_URL']
|
||||||
|
|
||||||
|
if(action == 'closed'):
|
||||||
|
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
|
||||||
|
return(0)
|
||||||
|
|
||||||
|
r = requests.get(pr['url']+"/commits")
|
||||||
|
commits = r.json()
|
||||||
|
last_commit = commits[len(commits)-1]
|
||||||
|
message = last_commit['commit']['message']
|
||||||
|
|
||||||
|
pattern = re.compile("\[ci(\s+)skip\]", re.I)
|
||||||
|
result = pattern.search(message)
|
||||||
|
if result is not None:
|
||||||
|
print 'skip build for pull request #' + str(pr_num)
|
||||||
|
return(0)
|
||||||
|
|
||||||
|
data = {"state":"pending", "target_url":target_url}
|
||||||
|
access_token = os.environ['GITHUB_ACCESS_TOKEN']
|
||||||
|
Headers = {"Authorization":"token " + access_token}
|
||||||
|
|
||||||
|
try:
|
||||||
|
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
job_trigger_url = os.environ['JOB_TRIGGER_URL']+access_token
|
||||||
|
#send trigger and payload
|
||||||
|
post_data = {'payload':""}
|
||||||
|
post_data['payload']= payload_str
|
||||||
|
requests.post(job_trigger_url, data=post_data)
|
||||||
|
|
||||||
|
return(0)
|
||||||
|
|
||||||
|
# -------------- main --------------
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys_ret = 0
|
||||||
|
try:
|
||||||
|
sys_ret = main()
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
sys_ret = 1
|
||||||
|
finally:
|
||||||
|
sys.exit(sys_ret)
|
|
@ -57,7 +57,7 @@ def main():
|
||||||
|
|
||||||
set_description(pr_desc, target_url)
|
set_description(pr_desc, target_url)
|
||||||
|
|
||||||
if((action != 'opened') and (action != 'synchronize')):
|
if(action == 'closed'):
|
||||||
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
|
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
|
||||||
return(0)
|
return(0)
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0a2d046187d7848172fadf6ee4a7e80897e6a75c
|
5ae50c3f2080b46e18ba3f5aee4c5c686d54e13a
|
|
@ -54,7 +54,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
|
||||||
Copying::[*],
|
Copying::[*],
|
||||||
LabelProtocol::[*],
|
LabelProtocol::[*],
|
||||||
LabelTextFormatProtocol::[*],
|
LabelTextFormatProtocol::[*],
|
||||||
Label::[getLettersInfo],
|
Label::[getLettersInfo createWithTTF setTTFConfig],
|
||||||
.*Delegate::[*],
|
.*Delegate::[*],
|
||||||
PoolManager::[*],
|
PoolManager::[*],
|
||||||
Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap],
|
Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap],
|
||||||
|
|
|
@ -48,7 +48,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased],
|
Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased],
|
||||||
Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns],
|
Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns],
|
||||||
MenuItem.*::[create setCallback initWithCallback],
|
MenuItem.*::[create setCallback initWithCallback],
|
||||||
Label::[getLettersInfo],
|
Label::[getLettersInfo createWithTTF setTTFConfig],
|
||||||
Copying::[*],
|
Copying::[*],
|
||||||
LabelProtocol::[*],
|
LabelProtocol::[*],
|
||||||
LabelTextFormatProtocol::[*],
|
LabelTextFormatProtocol::[*],
|
||||||
|
@ -108,7 +108,6 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
ccFontDefinition::[*],
|
ccFontDefinition::[*],
|
||||||
Object::[autorelease isEqual acceptVisitor update],
|
Object::[autorelease isEqual acceptVisitor update],
|
||||||
UserDefault::[getInstance (s|g)etDataForKey],
|
UserDefault::[getInstance (s|g)etDataForKey],
|
||||||
Label::[getLettersInfo],
|
|
||||||
EGLViewProtocol::[setTouchDelegate],
|
EGLViewProtocol::[setTouchDelegate],
|
||||||
EGLView::[end swapBuffers],
|
EGLView::[end swapBuffers],
|
||||||
NewTextureAtlas::[*],
|
NewTextureAtlas::[*],
|
||||||
|
|
Loading…
Reference in New Issue