当前位置: 首页>>代码示例>>C++>>正文


C++ CScale9Sprite类代码示例

本文整理汇总了C++中CScale9Sprite的典型用法代码示例。如果您正苦于以下问题:C++ CScale9Sprite类的具体用法?C++ CScale9Sprite怎么用?C++ CScale9Sprite使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CScale9Sprite类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CScale9Sprite

CScale9Sprite* CScale9Sprite::resizableSpriteWithCapInsets(Rect capInsets)
{
    CScale9Sprite* pReturn = new CScale9Sprite();
    if ( pReturn && pReturn->initWithBatchNode(_scale9Image, m_spriteRect, capInsets) )
    {
        pReturn->autorelease();
        return pReturn;
    }
    CC_SAFE_DELETE(pReturn);
    return NULL;
}
开发者ID:110440,项目名称:Tui-x,代码行数:11,代码来源:Scale9Sprite.cpp

示例2: CCAssert

CScale9Sprite* CScale9Sprite::createWithSpriteFrameName(const char* spriteFrameName)
{
    CCAssert(spriteFrameName != NULL, "spriteFrameName must be non-NULL");

    CScale9Sprite* pReturn = new CScale9Sprite();
    if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName) )
    {
        pReturn->autorelease();
        return pReturn;
    }
    CC_SAFE_DELETE(pReturn);

    log("Could not allocate CScale9Sprite()");
    return NULL;
}
开发者ID:110440,项目名称:Tui-x,代码行数:15,代码来源:Scale9Sprite.cpp

示例3: setContentSize

void CButton::setNormalTexture(Texture2D *pTexture)
{
	if( pTexture )
	{
		if( m_pNormalImage )
		{
			if( m_bScale9Enabled )
			{
				CScale9Sprite* pImage = (CScale9Sprite*) m_pNormalImage;
				pImage->setTexture(pTexture);
				pImage->setContentSize(_contentSize);
			}
			else
			{
				Rect rect = Rect::ZERO;
				rect.size = pTexture->getContentSize();
				Sprite* pImage = (Sprite*) m_pNormalImage;
				pImage->setTexture(pTexture);
				pImage->setTextureRect(rect);
				setContentSize(pTexture->getContentSize());
			}
		}
		else
		{
			if( m_bScale9Enabled )
			{
				m_pNormalImage = CScale9Sprite::createWithTexture(pTexture);
				m_pNormalImage->setContentSize(_contentSize);
			}
			else
			{
				Rect rect;
				rect.origin = Point::ZERO;
				rect.size = pTexture->getContentSize();
				m_pNormalImage = Sprite::createWithTexture(pTexture);
				setContentSize(pTexture->getContentSize());
			}

			m_pNormalImage->setPosition(Point(_contentSize.width/2, _contentSize.height/2));
			addChild(m_pNormalImage);
		}
	}

	updateCascadeTextSize();
}
开发者ID:Eason-Xi,项目名称:Tui-x,代码行数:45,代码来源:Button.cpp

示例4: setDisabledSpriteFrame

void CButton::setDisabledSpriteFrame(SpriteFrame* pFrame)
{
	if( pFrame )
	{
		if( m_pDisabledImage )
		{
			if( m_bScale9Enabled )
			{
				CScale9Sprite* pImage = (CScale9Sprite*) m_pDisabledImage;
				pImage->initWithSpriteFrame(pFrame);
				pImage->setContentSize(_contentSize);
			}
			else
			{
				Sprite* pImage = (Sprite*) m_pDisabledImage;
				pImage->setSpriteFrame(pFrame);
			}
		}
		else
		{
			if( m_bScale9Enabled )
			{
				m_pDisabledImage = CScale9Sprite::createWithSpriteFrame(pFrame);
				m_pDisabledImage->setContentSize(_contentSize);
			}
			else
			{
				m_pDisabledImage = Sprite::createWithSpriteFrame(pFrame);
			}

			m_pDisabledImage->setPosition(Vec2(_contentSize.width/2, _contentSize.height/2));
			m_pDisabledImage->setVisible(false);
			addChild(m_pDisabledImage);
		}
	}

	updateCascadeTextSize();
}
开发者ID:Kudoo,项目名称:Tui-x,代码行数:38,代码来源:Button.cpp


注:本文中的CScale9Sprite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。