本文整理汇总了C#中cocos2d.CCTexture2D.getContentSize方法的典型用法代码示例。如果您正苦于以下问题:C# CCTexture2D.getContentSize方法的具体用法?C# CCTexture2D.getContentSize怎么用?C# CCTexture2D.getContentSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos2d.CCTexture2D
的用法示例。
在下文中一共展示了CCTexture2D.getContentSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initWithTexture
/// <summary>
/// Initializes an sprite with a texture.
/// The rect used will be the size of the texture.
/// The offset will be (0,0).
/// </summary>
public bool initWithTexture(CCTexture2D texture)
{
if (texture == null)
{
throw (new ArgumentNullException("texture", "Texture cannot be null"));
}
CCRect rect = new CCRect();
rect.size = texture.getContentSize();
return initWithTexture(texture, rect);
}
示例2: initWithTexture
/// <summary>
/// Initializes an sprite with a texture.
/// The rect used will be the size of the texture.
/// The offset will be (0,0).
/// </summary>
public bool initWithTexture(CCTexture2D texture)
{
Debug.Assert(texture != null);
CCRect rect = new CCRect();
rect.size = texture.getContentSize();
return initWithTexture(texture, rect);
}
示例3: initWithTexture
/// <summary>
/// initializes a CCSpriteBatchNode with a texture2d and capacity of children.
/// The capacity will be increased in 33% in runtime if it run out of space.
/// </summary>
/// <param name="tex"></param>
/// <param name="capacity"></param>
/// <returns></returns>
public bool initWithTexture(CCTexture2D tex, int capacity)
{
m_blendFunc.src = 1; // CC_BLEND_SRC = 1
m_blendFunc.dst = 0x0303; // CC_BLEND_DST = 0x0303
m_pobTextureAtlas = new CCTextureAtlas();
m_pobTextureAtlas.initWithTexture(tex, capacity);
updateBlendFunc();
contentSize= tex.getContentSize(); // @@ TotallyEvil - contentSize should return the size of the sprite sheet
// no lazy alloc in this node
m_pChildren = new List<CCNode>();
m_pobDescendants = new List<CCSprite>();
return true;
}