2014-07-29 10:26:53 +08:00
|
|
|
|
/****************************************************************************
|
|
|
|
|
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 __cocos2d_libs__UIScale9Sprite__
|
|
|
|
|
#define __cocos2d_libs__UIScale9Sprite__
|
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
#include "2d/CCNode.h"
|
|
|
|
|
#include "2d/CCSpriteFrame.h"
|
|
|
|
|
#include "2d/CCSpriteBatchNode.h"
|
2014-09-10 08:17:07 +08:00
|
|
|
|
#include "platform/CCPlatformMacros.h"
|
2014-07-29 17:51:34 +08:00
|
|
|
|
#include "ui/GUIExport.h"
|
2015-10-29 10:41:58 +08:00
|
|
|
|
#include "renderer/CCTrianglesCommand.h"
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* @addtogroup ui
|
|
|
|
|
* @{
|
|
|
|
|
*/
|
2015-03-26 15:47:14 +08:00
|
|
|
|
NS_CC_BEGIN
|
2015-12-03 17:53:02 +08:00
|
|
|
|
class DrawNode;
|
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
|
|
/**
|
2015-03-26 15:47:14 +08:00
|
|
|
|
*@brief A 9-slice sprite for cocos2d-x.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*
|
|
|
|
|
* 9-slice scaling allows you to specify how scaling is applied
|
|
|
|
|
* to specific areas of a sprite. With 9-slice scaling (3x3 grid),
|
|
|
|
|
* you can ensure that the sprite does not become distorted when
|
|
|
|
|
* scaled.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* Note: When you set _scale9Enabled to false,
|
|
|
|
|
* then you could call `scale9Sprite->getSprite()` to return the inner Sprite pointer.
|
|
|
|
|
* Then you could call any methods of Sprite class with the return pointers.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*
|
|
|
|
|
*/
|
2015-03-25 22:16:41 +08:00
|
|
|
|
class CC_GUI_DLL Scale9Sprite : public Node , public cocos2d::BlendProtocol
|
2014-07-29 10:39:38 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* Default constructor.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
* @js ctor
|
2015-03-30 15:47:47 +08:00
|
|
|
|
* @lua new
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
Scale9Sprite();
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
/**
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* Default destructor.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
* @js NA
|
|
|
|
|
* @lua NA
|
|
|
|
|
*/
|
|
|
|
|
virtual ~Scale9Sprite();
|
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* Builtin shader state.
|
2015-12-21 07:21:45 +08:00
|
|
|
|
* Currently support Normal and Gray state.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*/
|
2014-12-23 15:03:31 +08:00
|
|
|
|
enum class State
|
|
|
|
|
{
|
|
|
|
|
NORMAL,
|
|
|
|
|
GRAY
|
|
|
|
|
};
|
|
|
|
|
|
2015-10-29 23:13:36 +08:00
|
|
|
|
enum class RenderingType
|
|
|
|
|
{
|
|
|
|
|
SIMPLE,
|
|
|
|
|
SLICE
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
public:
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Create an empty Scale9Sprite.
|
|
|
|
|
*
|
|
|
|
|
* @return A Scale9Sprite instance.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
static Scale9Sprite* create();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with a texture file, a delimitation zone and
|
|
|
|
|
* with the specified cap insets.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithFile(const char *file, const Rect& rect, const Rect& capInsets)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param file A texture file name.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param capInsets A specified cap insets.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* create(const std::string& file, const Rect& rect, const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with a texture file. The whole texture will be
|
|
|
|
|
* broken down into a 3×3 grid of equal blocks.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithFile(const Rect& capInsets, const char *file)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param capInsets A specified cap insets.
|
|
|
|
|
* @param file A texture file name.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* create(const Rect& capInsets, const std::string& file);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with a texture file and a delimitation zone. The
|
|
|
|
|
* texture will be broken down into a 3×3 grid of equal blocks.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithFile(const char *file, const Rect& rect)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param file A texture file name.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* create(const std::string& file, const Rect& rect);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with a texture file. The whole texture will be
|
|
|
|
|
* broken down into a 3×3 grid of equal blocks.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithFile(const char *file)
|
2015-03-27 17:09:54 +08:00
|
|
|
|
* @param file A texture file name.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* create(const std::string& file);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with an sprite frame.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithSpriteFrame(SpriteFrame *spriteFrame)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param spriteFrame A sprite frame pointer.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* createWithSpriteFrame(SpriteFrame* spriteFrame);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with an sprite frame and the centre of its zone.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithSpriteFrame(SpriteFrame *spriteFrame, const Rect& capInsets)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param spriteFrame A sprite frame pointer.
|
|
|
|
|
* @param capInsets A delimitation zone.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* createWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a 9-slice sprite with an sprite frame name.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithSpriteFrameName(const char *spriteFrameName)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param spriteFrameName A sprite frame name.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* createWithSpriteFrameName(const std::string& spriteFrameName);
|
|
|
|
|
|
|
|
|
|
/**
|
2015-03-26 15:47:14 +08:00
|
|
|
|
* Creates a 9-slice sprite with an sprite frame name and the centre of its zone.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @see initWithSpriteFrameName(const char *spriteFrameName, const Rect& capInsets)
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param spriteFrameName A sprite frame name.
|
|
|
|
|
* @param capInsets A delimitation zone.
|
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
static Scale9Sprite* createWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with a texture file, a delimitation zone and
|
|
|
|
|
* with the specified cap insets.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param file The name of the texture file.
|
|
|
|
|
* @param rect The rectangle that describes the sub-part of the texture that
|
|
|
|
|
* is the whole image. If the shape is the whole texture, set this to the
|
|
|
|
|
* texture's full rect.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initialize success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithFile(const std::string& file, const Rect& rect, const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with a texture file and a delimitation zone. The
|
|
|
|
|
* texture will be broken down into a 3×3 grid of equal blocks.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param file The name of the texture file.
|
|
|
|
|
* @param rect The rectangle that describes the sub-part of the texture that
|
|
|
|
|
* is the whole image. If the shape is the whole texture, set this to the
|
|
|
|
|
* texture's full rect.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithFile(const std::string& file, const Rect& rect);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with a texture file and with the specified cap
|
|
|
|
|
* insets.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param file The name of the texture file.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithFile(const Rect& capInsets, const std::string& file);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with a texture file. The whole texture will be
|
|
|
|
|
* broken down into a 3×3 grid of equal blocks.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param file The name of the texture file.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithFile(const std::string& file);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with an sprite frame and with the specified
|
|
|
|
|
* cap insets.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param spriteFrame The sprite frame object.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with an sprite frame.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param spriteFrame The sprite frame object.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithSpriteFrame(SpriteFrame* spriteFrame);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with an sprite frame name and with the specified
|
|
|
|
|
* cap insets.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param spriteFrameName The sprite frame name.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a 9-slice sprite with an sprite frame name.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param spriteFrameName The sprite frame name.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
//override function
|
2015-03-15 02:33:15 +08:00
|
|
|
|
virtual bool init() override;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initializes a 9-slice sprite with an sprite instance.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param sprite The sprite instance.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param rotated Whether the sprite is rotated or not.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
|
|
|
|
* @return True if initializes success, false otherwise.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
virtual bool init(Sprite* sprite, const Rect& rect, bool rotated, const Rect& capInsets);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initializes a 9-slice sprite with an sprite instance.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @param sprite The sprite instance.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
|
|
|
|
* @return True if initializes success, false otherwise.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
virtual bool init(Sprite* sprite, const Rect& rect, const Rect& capInsets);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
2014-12-04 03:17:47 +08:00
|
|
|
|
/**
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @brief Initializes a 9-slice sprite with an sprite instance.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
2014-12-04 03:17:47 +08:00
|
|
|
|
*
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param sprite The sprite instance.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param rotated Whether the sprite is rotated or not.
|
|
|
|
|
* @param offset The offset when slice the sprite.
|
|
|
|
|
* @param originalSize The original size of sprite.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-12-04 03:17:47 +08:00
|
|
|
|
*/
|
2015-03-25 18:17:58 +08:00
|
|
|
|
virtual bool init(Sprite* sprite,
|
|
|
|
|
const Rect& rect,
|
|
|
|
|
bool rotated,
|
|
|
|
|
const Vec2 &offset,
|
|
|
|
|
const Size &originalSize,
|
|
|
|
|
const Rect& capInsets);
|
2014-12-04 03:17:47 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @brief Initializes a 9-slice sprite with a sprite batchnode.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
2014-12-04 03:17:47 +08:00
|
|
|
|
*
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @deprecated Use @see `init` instead.
|
|
|
|
|
* @param batchnode A batch node pointer.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param rotated Whether the sprite in batch node is rotated or not.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
|
|
|
|
* @return True if initializes success, false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
CC_DEPRECATED(v3) virtual bool initWithBatchNode(SpriteBatchNode* batchnode,
|
|
|
|
|
const Rect& rect,
|
|
|
|
|
bool rotated,
|
|
|
|
|
const Rect& capInsets);
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initializes a 9-slice sprite with a sprite batch node.
|
|
|
|
|
* Once the sprite is created, you can then call its "setContentSize:" method
|
|
|
|
|
* to resize the sprite will all it's 9-slice goodness intract.
|
|
|
|
|
* It respects the anchorPoint too.
|
|
|
|
|
*
|
|
|
|
|
* @deprecated Use @see `init` instead.
|
|
|
|
|
* @param batchnode A batch node pointer.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
|
|
|
|
* @return True if initializes success, false otherwise.
|
2014-12-04 03:17:47 +08:00
|
|
|
|
*/
|
2015-03-25 18:17:58 +08:00
|
|
|
|
CC_DEPRECATED(v3) virtual bool initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, const Rect& capInsets);
|
2015-03-25 22:16:41 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the source blending function.
|
|
|
|
|
*
|
2015-03-26 15:47:14 +08:00
|
|
|
|
* @param blendFunc A structure with source and destination factor to specify pixel arithmetic. e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}.
|
2015-03-25 22:16:41 +08:00
|
|
|
|
* @js NA
|
|
|
|
|
* @lua NA
|
|
|
|
|
*/
|
|
|
|
|
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the blending function that is currently being used.
|
|
|
|
|
*
|
|
|
|
|
* @return A BlendFunc structure with source and destination factor which specified pixel arithmetic.
|
|
|
|
|
* @js NA
|
|
|
|
|
* @lua NA
|
|
|
|
|
*/
|
|
|
|
|
virtual const BlendFunc &getBlendFunc() const override;
|
2014-09-01 17:06:22 +08:00
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new sprite object with the specified cap insets.
|
|
|
|
|
* You use this method to add cap insets to a sprite or to change the existing
|
|
|
|
|
* cap insets of a sprite. In both cases, you get back a new image and the
|
|
|
|
|
* original sprite remains untouched.
|
|
|
|
|
*
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @return A Scale9Sprite instance.
|
2014-07-29 10:39:38 +08:00
|
|
|
|
*/
|
2014-09-27 20:54:07 +08:00
|
|
|
|
Scale9Sprite* resizableSpriteWithCapInsets(const Rect& capInsets) const;
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Update Scale9Sprite with a specified sprite.
|
|
|
|
|
*
|
|
|
|
|
* @param sprite A sprite pointer.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param rotated Whether the sprite is rotated or not.
|
|
|
|
|
* @param capInsets The Values to use for the cap insets.
|
|
|
|
|
* @return True if update success, false otherwise.
|
2015-03-28 16:02:47 +08:00
|
|
|
|
* @js NA
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool updateWithSprite(Sprite* sprite,
|
|
|
|
|
const Rect& rect,
|
|
|
|
|
bool rotated,
|
|
|
|
|
const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Update Scale9Sprite with a specified sprite.
|
|
|
|
|
*
|
|
|
|
|
* @param sprite A sprite pointer.
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
* @param rotated Whether the sprite is rotated or not.
|
|
|
|
|
* @param offset The offset when slice the sprite.
|
2015-12-21 07:21:45 +08:00
|
|
|
|
* @param originalSize The original size of the sprite.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param capInsets The Values to use for the cap insets.
|
|
|
|
|
* @return True if update success, false otherwise.
|
2015-03-28 16:02:47 +08:00
|
|
|
|
* @js NA
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool updateWithSprite(Sprite* sprite,
|
|
|
|
|
const Rect& rect,
|
|
|
|
|
bool rotated,
|
|
|
|
|
const Vec2 &offset,
|
|
|
|
|
const Size &originalSize,
|
|
|
|
|
const Rect& capInsets);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Update Scale9Sprite with a specified sprite.
|
|
|
|
|
*
|
|
|
|
|
* @deprecated Use @see `updateWithSprite` instead.
|
|
|
|
|
* @param sprite A sprite pointer.
|
|
|
|
|
* @param originalRect A delimitation zone.
|
|
|
|
|
* @param rotated Whether the sprite is rotated or not.
|
|
|
|
|
* @param capInsets The Values to use for the cap insets.
|
|
|
|
|
* @return True if update success, false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
CC_DEPRECATED(v3) bool updateWithBatchNode(SpriteBatchNode* batchnode,
|
|
|
|
|
const Rect& originalRect,
|
|
|
|
|
bool rotated,
|
|
|
|
|
const Rect& capInsets);
|
2014-09-01 17:06:22 +08:00
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Change inner sprite's sprite frame.
|
|
|
|
|
*
|
|
|
|
|
* @param spriteFrame A sprite frame pointer.
|
|
|
|
|
* @param capInsets The values to use for the cap insets.
|
|
|
|
|
*/
|
2014-09-27 20:54:07 +08:00
|
|
|
|
virtual void setSpriteFrame(SpriteFrame * spriteFrame, const Rect& capInsets = Rect::ZERO);
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
|
|
|
|
// overrides
|
|
|
|
|
virtual void setContentSize(const Size & size) override;
|
2014-07-30 15:52:27 +08:00
|
|
|
|
virtual void setAnchorPoint(const Vec2& anchorPoint) override;
|
2015-10-29 10:41:58 +08:00
|
|
|
|
|
2014-12-23 15:03:31 +08:00
|
|
|
|
/**
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* Change the state of 9-slice sprite.
|
|
|
|
|
* @see `State`
|
|
|
|
|
* @param state A enum value in State.
|
|
|
|
|
* @since v3.4
|
2014-12-23 15:03:31 +08:00
|
|
|
|
*/
|
|
|
|
|
void setState(State state);
|
|
|
|
|
|
2015-07-15 14:35:13 +08:00
|
|
|
|
/**
|
|
|
|
|
* Query the current bright state.
|
|
|
|
|
* @return @see `State`
|
|
|
|
|
* @since v3.7
|
|
|
|
|
*/
|
|
|
|
|
State getState()const;
|
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief Query the sprite's original size.
|
|
|
|
|
*
|
|
|
|
|
* @return Sprite size.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
Size getOriginalSize() const;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-09 16:59:11 +08:00
|
|
|
|
* @brief Change the preferred size of Scale9Sprite.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*
|
|
|
|
|
* @param size A delimitation zone.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void setPreferredSize(const Size& size);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-09 16:59:11 +08:00
|
|
|
|
* @brief Query the Scale9Sprite's preferred size.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*
|
2015-10-09 16:59:11 +08:00
|
|
|
|
* @return Scale9Sprite's preferred size.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
Size getPreferredSize() const;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Change the cap inset size.
|
|
|
|
|
*
|
|
|
|
|
* @param rect A delimitation zone.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void setCapInsets(const Rect& rect);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-09 16:59:11 +08:00
|
|
|
|
* @brief Query the Scale9Sprite's preferred size.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*
|
|
|
|
|
* @return Scale9Sprite's cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
Rect getCapInsets()const;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Change the left sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @param leftInset The values to use for the cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void setInsetLeft(float leftInset);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Query the left sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @return The left sprite's cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
float getInsetLeft()const;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Change the top sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @param topInset The values to use for the cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void setInsetTop(float topInset);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Query the top sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @return The top sprite's cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
float getInsetTop()const;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Change the right sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @param rightInset The values to use for the cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void setInsetRight(float rightInset);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Query the right sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @return The right sprite's cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
float getInsetRight()const;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Change the bottom sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @param bottomInset The values to use for the cap inset.
|
|
|
|
|
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void setInsetBottom(float bottomInset);
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Query the bottom sprite's cap inset.
|
|
|
|
|
*
|
|
|
|
|
* @return The bottom sprite's cap inset.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
float getInsetBottom()const;
|
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief Toggle 9-slice feature.
|
|
|
|
|
* If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite.
|
2015-12-14 10:14:39 +08:00
|
|
|
|
* @warning: Don't use setScale9Enabled(false), use setRenderingType(RenderingType::SIMPLE) instead.
|
2015-12-14 10:09:06 +08:00
|
|
|
|
* The setScale9Enabled(false) is kept only for back back compatibility.
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param enabled True to enable 9-slice, false otherwise.
|
2015-03-28 16:02:47 +08:00
|
|
|
|
* @js NA
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*/
|
|
|
|
|
void setScale9Enabled(bool enabled);
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
2015-03-25 18:17:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief Query whether the Scale9Sprite is enable 9-slice or not.
|
|
|
|
|
*
|
|
|
|
|
* @return True if 9-slice is enabled, false otherwise.
|
2015-03-28 16:02:47 +08:00
|
|
|
|
* @js NA
|
2015-03-25 18:17:58 +08:00
|
|
|
|
*/
|
|
|
|
|
bool isScale9Enabled()const;
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
|
|
|
|
/// @} end of Children and Parent
|
|
|
|
|
|
2015-12-03 17:53:02 +08:00
|
|
|
|
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
2014-07-29 10:39:38 +08:00
|
|
|
|
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
|
|
|
|
|
|
|
|
|
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
|
|
|
|
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
|
|
|
|
virtual void disableCascadeColor() override;
|
2014-08-22 11:49:39 +08:00
|
|
|
|
virtual void disableCascadeOpacity() override;
|
2016-02-11 21:18:41 +08:00
|
|
|
|
virtual void setGLProgram(GLProgram *glprogram) override;
|
|
|
|
|
virtual void setGLProgramState(GLProgramState *glProgramState) override;
|
2015-03-25 18:17:58 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get the original no 9-sliced sprite
|
|
|
|
|
*
|
|
|
|
|
* @return A sprite instance.
|
|
|
|
|
*/
|
2014-07-29 10:39:38 +08:00
|
|
|
|
Sprite* getSprite()const;
|
|
|
|
|
|
2014-07-29 14:33:22 +08:00
|
|
|
|
/**
|
|
|
|
|
* Sets whether the widget should be flipped horizontally or not.
|
|
|
|
|
*
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param flippedX true if the widget should be flipped horizontally, false otherwise.
|
2014-07-29 14:33:22 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual void setFlippedX(bool flippedX);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the flag which indicates whether the widget is flipped horizontally or not.
|
|
|
|
|
*
|
|
|
|
|
* It only flips the texture of the widget, and not the texture of the widget's children.
|
|
|
|
|
* Also, flipping the texture doesn't alter the anchorPoint.
|
|
|
|
|
* If you want to flip the anchorPoint too, and/or to flip the children too use:
|
|
|
|
|
* widget->setScaleX(sprite->getScaleX() * -1);
|
|
|
|
|
*
|
2015-01-20 15:10:03 +08:00
|
|
|
|
* @return true if the widget is flipped horizontally, false otherwise.
|
2014-07-29 14:33:22 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool isFlippedX()const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets whether the widget should be flipped vertically or not.
|
|
|
|
|
*
|
2015-03-25 18:17:58 +08:00
|
|
|
|
* @param flippedY true if the widget should be flipped vertically, false otherwise.
|
2014-07-29 14:33:22 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual void setFlippedY(bool flippedY);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the flag which indicates whether the widget is flipped vertically or not.
|
|
|
|
|
*
|
|
|
|
|
* It only flips the texture of the widget, and not the texture of the widget's children.
|
|
|
|
|
* Also, flipping the texture doesn't alter the anchorPoint.
|
|
|
|
|
* If you want to flip the anchorPoint too, and/or to flip the children too use:
|
|
|
|
|
* widget->setScaleY(widget->getScaleY() * -1);
|
|
|
|
|
*
|
2015-10-09 16:59:11 +08:00
|
|
|
|
* @return true if the widget is flipped vertically, false otherwise.
|
2014-07-29 14:33:22 +08:00
|
|
|
|
*/
|
|
|
|
|
virtual bool isFlippedY()const;
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
2014-11-07 11:09:22 +08:00
|
|
|
|
//override the setScale function of Node
|
|
|
|
|
virtual void setScaleX(float scaleX) override;
|
|
|
|
|
virtual void setScaleY(float scaleY) override;
|
|
|
|
|
virtual void setScale(float scale) override;
|
2015-01-20 15:10:03 +08:00
|
|
|
|
virtual void setScale(float scaleX, float scaleY) override;
|
2014-11-07 11:09:22 +08:00
|
|
|
|
using Node::setScaleZ;
|
|
|
|
|
virtual float getScaleX() const override;
|
|
|
|
|
virtual float getScaleY() const override;
|
|
|
|
|
virtual float getScale() const override;
|
|
|
|
|
using Node::getScaleZ;
|
2015-03-25 22:16:41 +08:00
|
|
|
|
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
|
2015-12-14 10:09:06 +08:00
|
|
|
|
virtual void setGlobalZOrder(float globalZOrder) override;
|
|
|
|
|
|
2015-10-29 23:13:36 +08:00
|
|
|
|
/**
|
|
|
|
|
* Set the slice sprite rendering type.
|
|
|
|
|
* When setting to SIMPLE, only 4 vertexes is used to rendering.
|
|
|
|
|
* otherwise 16 vertexes will be used to rendering.
|
|
|
|
|
* @see RenderingType
|
|
|
|
|
*/
|
|
|
|
|
void setRenderingType(RenderingType type);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the slice sprite rendering type.
|
|
|
|
|
*/
|
|
|
|
|
RenderingType getRenderingType()const;
|
2015-11-18 13:38:29 +08:00
|
|
|
|
|
|
|
|
|
void resetRender();
|
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
protected:
|
|
|
|
|
void updateCapInset();
|
2014-09-27 20:54:07 +08:00
|
|
|
|
void createSlicedSprites();
|
2014-07-29 10:39:38 +08:00
|
|
|
|
void cleanupSlicedSprites();
|
2015-10-29 21:53:58 +08:00
|
|
|
|
void adjustNoneScale9ImagePosition();
|
2015-10-30 09:58:02 +08:00
|
|
|
|
void configureSimpleModeRendering();
|
2015-03-25 22:16:41 +08:00
|
|
|
|
void applyBlendFunc();
|
|
|
|
|
void updateBlendFunc(Texture2D *texture);
|
2015-10-29 10:41:58 +08:00
|
|
|
|
std::vector<Vec2> calculateUV(Texture2D *tex, const Rect& capInsets,
|
2015-12-18 05:32:59 +08:00
|
|
|
|
const Size& originalSize, const Vec4& offsets);
|
|
|
|
|
std::vector<Vec2> calculateVertices(const Rect& capInsets, const Size& originalSize, const Vec4& offsets);
|
2015-10-29 10:41:58 +08:00
|
|
|
|
TrianglesCommand::Triangles calculateTriangles(const std::vector<Vec2>& uv,
|
|
|
|
|
const std::vector<Vec2>& vertices);
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
|
|
|
|
Rect _spriteRect;
|
|
|
|
|
bool _spriteFrameRotated;
|
|
|
|
|
Rect _capInsetsInternal;
|
|
|
|
|
|
|
|
|
|
Sprite* _scale9Image; //the original sprite
|
|
|
|
|
|
|
|
|
|
bool _scale9Enabled;
|
2015-03-25 22:16:41 +08:00
|
|
|
|
BlendFunc _blendFunc;
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
|
|
|
|
/** Original sprite's size. */
|
|
|
|
|
Size _originalSize;
|
2015-12-18 05:32:59 +08:00
|
|
|
|
Vec2 _offset;
|
2015-01-20 15:10:03 +08:00
|
|
|
|
/** Preferred sprite's size. By default the preferred size is the original size. */
|
2014-07-29 10:39:38 +08:00
|
|
|
|
|
|
|
|
|
//if the preferredSize component is given as -1, it is ignored
|
|
|
|
|
Size _preferredSize;
|
2015-10-29 10:41:58 +08:00
|
|
|
|
|
2014-07-29 10:39:38 +08:00
|
|
|
|
/** Sets the left side inset */
|
|
|
|
|
float _insetLeft;
|
|
|
|
|
/** Sets the top side inset */
|
|
|
|
|
float _insetTop;
|
|
|
|
|
/** Sets the right side inset */
|
|
|
|
|
float _insetRight;
|
|
|
|
|
/** Sets the bottom side inset */
|
|
|
|
|
float _insetBottom;
|
|
|
|
|
|
2014-07-29 14:33:22 +08:00
|
|
|
|
bool _flippedX;
|
|
|
|
|
bool _flippedY;
|
2015-05-21 16:04:37 +08:00
|
|
|
|
bool _isPatch9;
|
2015-07-15 14:35:13 +08:00
|
|
|
|
State _brightState;
|
2015-10-29 10:41:58 +08:00
|
|
|
|
Vec2 _nonSliceSpriteAnchor;
|
2015-12-03 17:53:02 +08:00
|
|
|
|
|
2015-10-29 10:41:58 +08:00
|
|
|
|
V3F_C4B_T2F* _sliceVertices;
|
|
|
|
|
unsigned short* _sliceIndices;
|
2015-10-29 21:53:58 +08:00
|
|
|
|
bool _sliceSpriteDirty;
|
2015-10-29 23:13:36 +08:00
|
|
|
|
RenderingType _renderingType;
|
2015-12-03 17:53:02 +08:00
|
|
|
|
|
|
|
|
|
#if CC_SPRITE_DEBUG_DRAW
|
|
|
|
|
DrawNode *_debugDrawNode;
|
|
|
|
|
#endif //CC_SPRITE_DEBUG_DRAW
|
|
|
|
|
bool _insideBounds; /// whether or not the sprite was inside bounds the previous frame
|
|
|
|
|
TrianglesCommand _trianglesCommand; ///
|
2014-07-29 10:39:38 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}} //end of namespace
|
2015-03-25 18:17:58 +08:00
|
|
|
|
// end of ui group
|
|
|
|
|
/// @}
|
2014-07-29 10:26:53 +08:00
|
|
|
|
|
|
|
|
|
#endif /* defined(__cocos2d_libs__UIScale9Sprite__) */
|