mirror of https://github.com/axmolengine/axmol.git
Merge pull request #10206 from sergeant-wizard/specify_default_capacity_for_sprite_batch_node
Specify default capacity for sprite batch node
This commit is contained in:
commit
8716164a5d
|
@ -67,7 +67,7 @@ SpriteBatchNode* SpriteBatchNode::create(const std::string& fileImage, ssize_t c
|
||||||
/*
|
/*
|
||||||
* init with Texture2D
|
* init with Texture2D
|
||||||
*/
|
*/
|
||||||
bool SpriteBatchNode::initWithTexture(Texture2D *tex, ssize_t capacity)
|
bool SpriteBatchNode::initWithTexture(Texture2D *tex, ssize_t capacity/* = DEFAULT_CAPACITY*/)
|
||||||
{
|
{
|
||||||
CCASSERT(capacity>=0, "Capacity must be >= 0");
|
CCASSERT(capacity>=0, "Capacity must be >= 0");
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ bool SpriteBatchNode::init()
|
||||||
/*
|
/*
|
||||||
* init with FileImage
|
* init with FileImage
|
||||||
*/
|
*/
|
||||||
bool SpriteBatchNode::initWithFile(const std::string& fileImage, ssize_t capacity)
|
bool SpriteBatchNode::initWithFile(const std::string& fileImage, ssize_t capacity/* = DEFAULT_CAPACITY*/)
|
||||||
{
|
{
|
||||||
Texture2D *texture2D = Director::getInstance()->getTextureCache()->addImage(fileImage);
|
Texture2D *texture2D = Director::getInstance()->getTextureCache()->addImage(fileImage);
|
||||||
return initWithTexture(texture2D, capacity);
|
return initWithTexture(texture2D, capacity);
|
||||||
|
|
|
@ -67,12 +67,12 @@ class CC_DLL SpriteBatchNode : public Node, public TextureProtocol
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** creates a SpriteBatchNode with a texture2d and capacity of children.
|
/** creates a SpriteBatchNode with a texture2d and capacity of children.
|
||||||
The capacity will be increased in 33% in runtime if it run out of space.
|
The capacity will be increased in 33% in runtime if it runs out of space.
|
||||||
*/
|
*/
|
||||||
static SpriteBatchNode* createWithTexture(Texture2D* tex, ssize_t capacity = DEFAULT_CAPACITY);
|
static SpriteBatchNode* createWithTexture(Texture2D* tex, ssize_t capacity = DEFAULT_CAPACITY);
|
||||||
|
|
||||||
/** creates a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
|
/** creates a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
|
||||||
The capacity will be increased in 33% in runtime if it run out of space.
|
The capacity will be increased in 33% in runtime if it runs out of space.
|
||||||
The file will be loaded using the TextureMgr.
|
The file will be loaded using the TextureMgr.
|
||||||
*/
|
*/
|
||||||
static SpriteBatchNode* create(const std::string& fileImage, ssize_t capacity = DEFAULT_CAPACITY);
|
static SpriteBatchNode* create(const std::string& fileImage, ssize_t capacity = DEFAULT_CAPACITY);
|
||||||
|
@ -168,16 +168,16 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
virtual ~SpriteBatchNode();
|
virtual ~SpriteBatchNode();
|
||||||
|
|
||||||
/** initializes a SpriteBatchNode with a texture2d and capacity of children.
|
/** initializes a SpriteBatchNode with a texture2d and capacity of children.
|
||||||
The capacity will be increased in 33% in runtime if it run out of space.
|
The capacity will be increased in 33% in runtime if it runs out of space.
|
||||||
*/
|
*/
|
||||||
bool initWithTexture(Texture2D *tex, ssize_t capacity);
|
bool initWithTexture(Texture2D *tex, ssize_t capacity = DEFAULT_CAPACITY);
|
||||||
/** initializes a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and a capacity of children.
|
/** initializes a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and a capacity of children.
|
||||||
The capacity will be increased in 33% in runtime if it run out of space.
|
The capacity will be increased in 33% in runtime if it runs out of space.
|
||||||
The file will be loaded using the TextureMgr.
|
The file will be loaded using the TextureMgr.
|
||||||
* @js init
|
* @js init
|
||||||
* @lua init
|
* @lua init
|
||||||
*/
|
*/
|
||||||
bool initWithFile(const std::string& fileImage, ssize_t capacity);
|
bool initWithFile(const std::string& fileImage, ssize_t capacity = DEFAULT_CAPACITY);
|
||||||
bool init();
|
bool init();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue