cocos2d::ui::Scale9Sprite with CapInset
cocos2d::ui::Scale9Sprite is very useful when resizing sprites with edge decorations. To set those un-resizable parts, following methods can be used.
- void Scale9Sprite::setInsetLeft(float insetLeft)
- void Scale9Sprite::setInsetTop(float insertTop)
- void Scale9Sprite::setInsetRight(float insetRight)
- void Scale9Sprite::setInsetBottom(float insetBottom)
- void Scale9Sprite::setCapInsets(const Rect& capInsets)
For setCapInsets() method, the const Rect& capInsets specifies those resizable area with following semantics:
- insetLeft: capInsets.origin.x
- insetTop: capInsets.origin.y
- insetRight: _originalSize.width – capInset.origin.x – capInset.size.width
- insetBottom: _originalSize.width – capInset.origin.y – capInset.size.height