Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into cocos-console-test

This commit is contained in:
shujunqiao 2014-03-28 17:50:29 +08:00
commit 9ffb26fdc9
22 changed files with 184 additions and 87 deletions

View File

@ -1 +1 @@
a3a8c79daf8c98f2aea9b8ed339e11ff81a0f1ce 2edbaaa897088877d60090c2c8fc6725e699e4ee

View File

@ -676,9 +676,9 @@ CC_DEPRECATED_ATTRIBUTE typedef GridBase CCGridBase;
CC_DEPRECATED_ATTRIBUTE typedef Grid3D CCGrid3D; CC_DEPRECATED_ATTRIBUTE typedef Grid3D CCGrid3D;
CC_DEPRECATED_ATTRIBUTE typedef TiledGrid3D CCTiledGrid3D; CC_DEPRECATED_ATTRIBUTE typedef TiledGrid3D CCTiledGrid3D;
CC_DEPRECATED_ATTRIBUTE typedef Sprite CCSprite; CC_DEPRECATED_ATTRIBUTE typedef Sprite CCSprite;
CC_DEPRECATED_ATTRIBUTE typedef LabelTTF CCLabelTTF; #define CCLabelTTF LabelTTF
CC_DEPRECATED_ATTRIBUTE typedef SpriteBatchNode CCSpriteBatchNode; CC_DEPRECATED_ATTRIBUTE typedef SpriteBatchNode CCSpriteBatchNode;
CC_DEPRECATED_ATTRIBUTE typedef LabelBMFont CCLabelBMFont; #define CCLabelBMFont LabelBMFont
CC_DEPRECATED_ATTRIBUTE typedef Layer CCLayer; CC_DEPRECATED_ATTRIBUTE typedef Layer CCLayer;
//CC_DEPRECATED_ATTRIBUTE typedef KeypadDelegate CCKeypadDelegate; //CC_DEPRECATED_ATTRIBUTE typedef KeypadDelegate CCKeypadDelegate;
CC_DEPRECATED_ATTRIBUTE typedef Layer CCLayerRGBA; CC_DEPRECATED_ATTRIBUTE typedef Layer CCLayerRGBA;

View File

@ -59,91 +59,91 @@ FontAtlas * FontAtlasCache::getFontAtlasTTF(const TTFConfig & config)
fontSize = Label::DistanceFieldFontSize / contentScaleFactor; fontSize = Label::DistanceFieldFontSize / contentScaleFactor;
} }
std::string atlasName = generateFontName(config.fontFilePath, fontSize, GlyphCollection::DYNAMIC, useDistanceField); auto atlasName = generateFontName(config.fontFilePath, fontSize, GlyphCollection::DYNAMIC, useDistanceField);
atlasName.append("_outline_"); atlasName.append("_outline_");
std::stringstream ss; std::stringstream ss;
ss << config.outlineSize; ss << config.outlineSize;
atlasName.append(ss.str()); atlasName.append(ss.str());
FontAtlas *tempAtlas = _atlasMap[atlasName]; auto it = _atlasMap.find(atlasName);
if ( !tempAtlas ) if ( it == _atlasMap.end() )
{ {
FontFreeType *font = FontFreeType::create(config.fontFilePath, fontSize * contentScaleFactor, config.glyphs, auto font = FontFreeType::create(config.fontFilePath, fontSize * contentScaleFactor, config.glyphs,
config.customGlyphs,useDistanceField,config.outlineSize * contentScaleFactor); config.customGlyphs,useDistanceField,config.outlineSize * contentScaleFactor);
if (font) if (font)
{ {
tempAtlas = font->createFontAtlas(); auto tempAtlas = font->createFontAtlas();
if (tempAtlas) if (tempAtlas)
{
_atlasMap[atlasName] = tempAtlas; _atlasMap[atlasName] = tempAtlas;
} return _atlasMap[atlasName];
else }
{
return nullptr;
} }
} }
else else
{ {
tempAtlas->retain(); _atlasMap[atlasName]->retain();
return _atlasMap[atlasName];
} }
return tempAtlas; return nullptr;
} }
FontAtlas * FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Point& imageOffset /* = Point::ZERO */) FontAtlas * FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Point& imageOffset /* = Point::ZERO */)
{ {
std::string atlasName = generateFontName(fontFileName, 0, GlyphCollection::CUSTOM,false); std::string atlasName = generateFontName(fontFileName, 0, GlyphCollection::CUSTOM,false);
FontAtlas *tempAtlas = _atlasMap[atlasName]; auto it = _atlasMap.find(atlasName);
if ( !tempAtlas ) if ( it == _atlasMap.end() )
{ {
Font *font = FontFNT::create(fontFileName,imageOffset); auto font = FontFNT::create(fontFileName,imageOffset);
if(font) if(font)
{ {
tempAtlas = font->createFontAtlas(); auto tempAtlas = font->createFontAtlas();
if (tempAtlas) if (tempAtlas)
{
_atlasMap[atlasName] = tempAtlas; _atlasMap[atlasName] = tempAtlas;
} return _atlasMap[atlasName];
else }
{
return nullptr;
} }
} }
else else
{ {
tempAtlas->retain(); _atlasMap[atlasName]->retain();
return _atlasMap[atlasName];
} }
return tempAtlas; return nullptr;
} }
FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile) FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile)
{ {
std::string atlasName = generateFontName(plistFile, 0, GlyphCollection::CUSTOM,false); std::string atlasName = generateFontName(plistFile, 0, GlyphCollection::CUSTOM,false);
FontAtlas *tempAtlas = _atlasMap[atlasName]; auto it = _atlasMap.find(atlasName);
if ( !tempAtlas ) if ( it == _atlasMap.end() )
{ {
Font *font = FontCharMap::create(plistFile); auto font = FontCharMap::create(plistFile);
if(font) if(font)
{ {
tempAtlas = font->createFontAtlas(); auto tempAtlas = font->createFontAtlas();
if (tempAtlas) if (tempAtlas)
{
_atlasMap[atlasName] = tempAtlas; _atlasMap[atlasName] = tempAtlas;
} return _atlasMap[atlasName];
else }
{
return nullptr;
} }
} }
else else
{ {
tempAtlas->retain(); _atlasMap[atlasName]->retain();
return _atlasMap[atlasName];
} }
return tempAtlas; return nullptr;
} }
FontAtlas * FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap) FontAtlas * FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
@ -151,57 +151,57 @@ FontAtlas * FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidt
char tmp[30]; char tmp[30];
sprintf(tmp,"name:%u_%d_%d_%d",texture->getName(),itemWidth,itemHeight,startCharMap); sprintf(tmp,"name:%u_%d_%d_%d",texture->getName(),itemWidth,itemHeight,startCharMap);
std::string atlasName = generateFontName(tmp, 0, GlyphCollection::CUSTOM,false); std::string atlasName = generateFontName(tmp, 0, GlyphCollection::CUSTOM,false);
FontAtlas *tempAtlas = _atlasMap[atlasName];
if ( !tempAtlas ) auto it = _atlasMap.find(atlasName);
if ( it == _atlasMap.end() )
{ {
Font *font = FontCharMap::create(texture,itemWidth,itemHeight,startCharMap); auto font = FontCharMap::create(texture,itemWidth,itemHeight,startCharMap);
if(font) if(font)
{ {
tempAtlas = font->createFontAtlas(); auto tempAtlas = font->createFontAtlas();
if (tempAtlas) if (tempAtlas)
{
_atlasMap[atlasName] = tempAtlas; _atlasMap[atlasName] = tempAtlas;
} return _atlasMap[atlasName];
else }
{
return nullptr;
} }
} }
else else
{ {
tempAtlas->retain(); _atlasMap[atlasName]->retain();
return _atlasMap[atlasName];
} }
return tempAtlas; return nullptr;
} }
FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
{ {
std::string atlasName = generateFontName(charMapFile, 0, GlyphCollection::CUSTOM,false); std::string atlasName = generateFontName(charMapFile, 0, GlyphCollection::CUSTOM,false);
FontAtlas *tempAtlas = _atlasMap[atlasName];
if ( !tempAtlas ) auto it = _atlasMap.find(atlasName);
if ( it == _atlasMap.end() )
{ {
Font *font = FontCharMap::create(charMapFile,itemWidth,itemHeight,startCharMap); auto font = FontCharMap::create(charMapFile,itemWidth,itemHeight,startCharMap);
if(font) if(font)
{ {
tempAtlas = font->createFontAtlas(); auto tempAtlas = font->createFontAtlas();
if (tempAtlas) if (tempAtlas)
{
_atlasMap[atlasName] = tempAtlas; _atlasMap[atlasName] = tempAtlas;
} return _atlasMap[atlasName];
else }
{
return nullptr;
} }
} }
else else
{ {
tempAtlas->retain(); _atlasMap[atlasName]->retain();
return _atlasMap[atlasName];
} }
return tempAtlas; return nullptr;
} }
std::string FontAtlasCache::generateFontName(const std::string& fontFileName, int size, GlyphCollection theGlyphs, bool useDistanceField) std::string FontAtlasCache::generateFontName(const std::string& fontFileName, int size, GlyphCollection theGlyphs, bool useDistanceField)

View File

@ -1361,7 +1361,7 @@ const Size& Label::getContentSize() const
{ {
const_cast<Label*>(this)->updateContent(); const_cast<Label*>(this)->updateContent();
} }
return Node::getContentSize(); return _contentSize;
} }
Rect Label::getBoundingBox() const Rect Label::getBoundingBox() const

View File

@ -243,7 +243,7 @@ public:
virtual const Size& getContentSize() const override; virtual const Size& getContentSize() const override;
virtual Rect getBoundingBox() const; virtual Rect getBoundingBox() const override;
FontAtlas* getFontAtlas() { return _fontAtlas; } FontAtlas* getFontAtlas() { return _fontAtlas; }
/** Listen "come to background" message /** Listen "come to background" message

View File

@ -38,6 +38,13 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only)
using namespace std; using namespace std;
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (push)
#pragma warning (disable: 4996)
#endif
NS_CC_BEGIN NS_CC_BEGIN
LabelBMFont * LabelBMFont::create() LabelBMFont * LabelBMFont::create()
@ -174,6 +181,27 @@ Node* LabelBMFont::getChildByTag(int tag)
return _label->getLetter(tag); return _label->getLetter(tag);
} }
Sprite* LabelBMFont::getLetter(int ID)
{
return _label->getLetter(ID);
}
void LabelBMFont::setColor(const Color3B& color)
{
_label->setColor(color);
}
const Size& LabelBMFont::getContentSize() const
{
const_cast<LabelBMFont*>(this)->setContentSize(_label->getContentSize());
return _contentSize;
}
Rect LabelBMFont::getBoundingBox() const
{
return _label->getBoundingBox();
}
//LabelBMFont - Debug draw //LabelBMFont - Debug draw
#if CC_LABELBMFONT_DEBUG_DRAW #if CC_LABELBMFONT_DEBUG_DRAW
void LabelBMFont::draw() void LabelBMFont::draw()
@ -188,4 +216,10 @@ void LabelBMFont::draw()
#endif // CC_LABELBMFONT_DEBUG_DRAW #endif // CC_LABELBMFONT_DEBUG_DRAW
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (pop)
#endif
NS_CC_END NS_CC_END

View File

@ -68,7 +68,7 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only)
@since v0.8 @since v0.8
*/ */
class CC_DLL LabelBMFont : public Node, public LabelProtocol, public BlendProtocol class CC_DLL CC_DEPRECATED_ATTRIBUTE LabelBMFont : public Node, public LabelProtocol, public BlendProtocol
{ {
public: public:
/** /**
@ -111,10 +111,13 @@ public:
virtual const BlendFunc &getBlendFunc() const override; virtual const BlendFunc &getBlendFunc() const override;
virtual Sprite * getLetter(int ID) { return _label->getLetter(ID);} virtual Sprite * getLetter(int ID);
virtual Node * getChildByTag(int tag) override; virtual Node * getChildByTag(int tag) override;
virtual void setColor(const Color3B& color) override { _label->setColor(color);} virtual void setColor(const Color3B& color) override;
virtual const Size& getContentSize() const override;
virtual Rect getBoundingBox() const override;
virtual std::string getDescription() const override; virtual std::string getDescription() const override;

View File

@ -29,6 +29,13 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (push)
#pragma warning (disable: 4996)
#endif
LabelTTF::LabelTTF() LabelTTF::LabelTTF()
{ {
_renderLabel = Label::create(); _renderLabel = Label::create();
@ -271,4 +278,15 @@ const Size& LabelTTF::getContentSize() const
return _contentSize; return _contentSize;
} }
Rect LabelTTF::getBoundingBox() const
{
return _renderLabel->getBoundingBox();
}
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (pop)
#endif
NS_CC_END NS_CC_END

View File

@ -56,7 +56,7 @@ class Label;
* @endcode * @endcode
* *
*/ */
class CC_DLL LabelTTF : public Node, public LabelProtocol, public BlendProtocol class CC_DLL CC_DEPRECATED_ATTRIBUTE LabelTTF : public Node, public LabelProtocol, public BlendProtocol
{ {
public: public:
/** /**
@ -143,6 +143,8 @@ public:
virtual void setFlippedX(bool flippedX); virtual void setFlippedX(bool flippedX);
virtual void setFlippedY(bool flippedY); virtual void setFlippedY(bool flippedY);
virtual Rect getBoundingBox() const override;
/** /**
* @js NA * @js NA
* @lua NA * @lua NA

View File

@ -154,15 +154,12 @@ Node::~Node()
} }
#endif #endif
CC_SAFE_RELEASE_NULL(_actionManager); // User object has to be released before others, since userObject may have a weak reference of this node
CC_SAFE_RELEASE_NULL(_scheduler); // It may invoke `node->stopAllAction();` while `_actionManager` is null if the next line is after `CC_SAFE_RELEASE_NULL(_actionManager)`.
CC_SAFE_RELEASE_NULL(_userObject);
_eventDispatcher->removeEventListenersForTarget(this);
// attributes // attributes
CC_SAFE_RELEASE_NULL(_shaderProgram); CC_SAFE_RELEASE_NULL(_shaderProgram);
CC_SAFE_RELEASE_NULL(_userObject);
for (auto& child : _children) for (auto& child : _children)
{ {
@ -178,6 +175,11 @@ Node::~Node()
#endif #endif
CC_SAFE_RELEASE_NULL(_actionManager);
CC_SAFE_RELEASE_NULL(_scheduler);
_eventDispatcher->removeEventListenersForTarget(this);
#if CC_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0 #if CC_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0
_eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this); _eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this);
#endif #endif

View File

@ -624,6 +624,12 @@ void ParticleSystem::onEnter()
this->scheduleUpdateWithPriority(1); this->scheduleUpdateWithPriority(1);
} }
void ParticleSystem::onExit()
{
this->unscheduleUpdate();
Node::onExit();
}
void ParticleSystem::stopSystem() void ParticleSystem::stopSystem()
{ {
_isActive = false; _isActive = false;

View File

@ -191,7 +191,6 @@ public:
//! whether or not the system is full //! whether or not the system is full
bool isFull(); bool isFull();
virtual void onEnter();
//! should be overridden by subclasses //! should be overridden by subclasses
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition); virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition);
//! should be overridden by subclasses //! should be overridden by subclasses
@ -355,6 +354,8 @@ public:
inline void setPositionType(PositionType type) { _positionType = type; }; inline void setPositionType(PositionType type) { _positionType = type; };
// Overrides // Overrides
virtual void onEnter() override;
virtual void onExit() override;
virtual void update(float dt) override; virtual void update(float dt) override;
virtual Texture2D* getTexture() const override; virtual Texture2D* getTexture() const override;
virtual void setTexture(Texture2D *texture) override; virtual void setTexture(Texture2D *texture) override;

View File

@ -94,11 +94,6 @@
-- @param self -- @param self
-- @return FontDefinition#FontDefinition ret (return value: cc.FontDefinition) -- @return FontDefinition#FontDefinition ret (return value: cc.FontDefinition)
--------------------------------
-- @function [parent=#Label] getBoundingBox
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)
-------------------------------- --------------------------------
-- @function [parent=#Label] getFontName -- @function [parent=#Label] getFontName
-- @param self -- @param self
@ -343,6 +338,11 @@
-- @param self -- @param self
-- @return size_table#size_table ret (return value: size_table) -- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#Label] getBoundingBox
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)
-------------------------------- --------------------------------
-- @function [parent=#Label] updateDisplayedColor -- @function [parent=#Label] updateDisplayedColor
-- @param self -- @param self

View File

@ -89,6 +89,11 @@
-- @param #point_table point -- @param #point_table point
-- @return LabelBMFont#LabelBMFont ret (retunr value: cc.LabelBMFont) -- @return LabelBMFont#LabelBMFont ret (retunr value: cc.LabelBMFont)
--------------------------------
-- @function [parent=#LabelBMFont] getBoundingBox
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)
-------------------------------- --------------------------------
-- @function [parent=#LabelBMFont] getDescription -- @function [parent=#LabelBMFont] getDescription
-- @param self -- @param self
@ -105,6 +110,11 @@
-- @param #int int -- @param #int int
-- @return Node#Node ret (return value: cc.Node) -- @return Node#Node ret (return value: cc.Node)
--------------------------------
-- @function [parent=#LabelBMFont] getContentSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
-------------------------------- --------------------------------
-- @function [parent=#LabelBMFont] LabelBMFont -- @function [parent=#LabelBMFont] LabelBMFont
-- @param self -- @param self

View File

@ -163,11 +163,9 @@
-- @return LabelTTF#LabelTTF ret (return value: cc.LabelTTF) -- @return LabelTTF#LabelTTF ret (return value: cc.LabelTTF)
-------------------------------- --------------------------------
-- @function [parent=#LabelTTF] visit -- @function [parent=#LabelTTF] getBoundingBox
-- @param self -- @param self
-- @param #cc.Renderer renderer -- @return rect_table#rect_table ret (return value: rect_table)
-- @param #kmMat4 kmmat4
-- @param #bool bool
-------------------------------- --------------------------------
-- @function [parent=#LabelTTF] getDescription -- @function [parent=#LabelTTF] getDescription
@ -179,6 +177,13 @@
-- @param self -- @param self
-- @return size_table#size_table ret (return value: size_table) -- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#LabelTTF] visit
-- @param self
-- @param #cc.Renderer renderer
-- @param #kmMat4 kmmat4
-- @param #bool bool
-------------------------------- --------------------------------
-- @function [parent=#LabelTTF] LabelTTF -- @function [parent=#LabelTTF] LabelTTF
-- @param self -- @param self

View File

@ -406,9 +406,9 @@
-- @return color4F_table#color4F_table ret (return value: color4F_table) -- @return color4F_table#color4F_table ret (return value: color4F_table)
-------------------------------- --------------------------------
-- @function [parent=#ParticleSystem] getEndColor -- @function [parent=#ParticleSystem] getRotationIsDir
-- @param self -- @param self
-- @return color4F_table#color4F_table ret (return value: color4F_table) -- @return bool#bool ret (return value: bool)
-------------------------------- --------------------------------
-- @function [parent=#ParticleSystem] setScale -- @function [parent=#ParticleSystem] setScale
@ -421,9 +421,9 @@
-- @return float#float ret (return value: float) -- @return float#float ret (return value: float)
-------------------------------- --------------------------------
-- @function [parent=#ParticleSystem] getRotationIsDir -- @function [parent=#ParticleSystem] getEndColor
-- @param self -- @param self
-- @return bool#bool ret (return value: bool) -- @return color4F_table#color4F_table ret (return value: color4F_table)
-------------------------------- --------------------------------
-- @function [parent=#ParticleSystem] getLifeVar -- @function [parent=#ParticleSystem] getLifeVar

View File

@ -1 +1 @@
506177408f7bc44ccba9d2518adbf47e8994bc83 55307bad4398fdd7bedf9a96f00adb57cbaa7d2e

View File

@ -1561,7 +1561,6 @@ int register_all_cocos2dx(lua_State* tolua_S);
#endif // __cocos2dx_h__ #endif // __cocos2dx_h__

View File

@ -28,7 +28,6 @@
#include "CCControlButton.h" #include "CCControlButton.h"
#include "CCScale9Sprite.h" #include "CCScale9Sprite.h"
#include "CCLabel.h" #include "CCLabel.h"
#include "CCLabelBMFont.h"
#include "CCAction.h" #include "CCAction.h"
#include "CCActionInterval.h" #include "CCActionInterval.h"

View File

@ -1495,7 +1495,7 @@ LabelTTFOldNew::LabelTTFOldNew()
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();
float delta = s.height/4; float delta = s.height/4;
auto label1 = LabelTTF::create("Cocos2d-x Label Test", "arial", 24); auto label1 = Label::create("Cocos2d-x Label Test", "arial", 24);
addChild(label1, 0, kTagBitmapAtlas1); addChild(label1, 0, kTagBitmapAtlas1);
label1->setPosition(Point(s.width/2, delta * 2)); label1->setPosition(Point(s.width/2, delta * 2));
label1->setColor(Color3B::RED); label1->setColor(Color3B::RED);
@ -1511,7 +1511,7 @@ void LabelTTFOldNew::onDraw(const kmMat4 &transform, bool transformUpdated)
kmGLPushMatrix(); kmGLPushMatrix();
kmGLLoadMatrix(&transform); kmGLLoadMatrix(&transform);
auto label1 = (LabelTTF*)getChildByTag(kTagBitmapAtlas1); auto label1 = (Label*)getChildByTag(kTagBitmapAtlas1);
auto labelSize = label1->getContentSize(); auto labelSize = label1->getContentSize();
auto origin = Director::getInstance()->getWinSize(); auto origin = Director::getInstance()->getWinSize();

View File

@ -24,6 +24,15 @@ THE SOFTWARE.
package org.cocos2dx.cpp_tests; package org.cocos2dx.cpp_tests;
import org.cocos2dx.lib.Cocos2dxActivity; import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
public class AppActivity extends Cocos2dxActivity { public class AppActivity extends Cocos2dxActivity {
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// TestCpp should create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
} }

View File

@ -1,6 +1,15 @@
package org.cocos2dx.lua_tests; package org.cocos2dx.lua_tests;
import org.cocos2dx.lib.Cocos2dxActivity; import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
public class AppActivity extends Cocos2dxActivity{ public class AppActivity extends Cocos2dxActivity{
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// Tests should create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
} }