本文整理汇总了C#中Loon.Core.Graphics.Opengl.LTexture.GetSubTexture方法的典型用法代码示例。如果您正苦于以下问题:C# LTexture.GetSubTexture方法的具体用法?C# LTexture.GetSubTexture怎么用?C# LTexture.GetSubTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loon.Core.Graphics.Opengl.LTexture
的用法示例。
在下文中一共展示了LTexture.GetSubTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSplitTextures
public static LTexture[] GetSplitTextures(LTexture image, int width,
int height)
{
if (image == null)
{
return null;
}
if (!image.IsLoaded())
{
image.LoadTexture();
}
int frame = 0;
int wlength = image.GetWidth() / width;
int hlength = image.GetHeight() / height;
int total = wlength * hlength;
LTexture[] images = new LTexture[total];
for (int y = 0; y < hlength; y++)
{
for (int x = 0; x < wlength; x++)
{
images[frame] = image.GetSubTexture((x * width), (y * height),
width, height);
frame++;
}
}
return images;
}
示例2: GetSplit2Textures
public static LTexture[][] GetSplit2Textures(LTexture image, int width,
int height)
{
if (image == null)
{
return null;
}
if (!image.IsLoaded())
{
image.LoadTexture();
}
int wlength = image.GetWidth() / width;
int hlength = image.GetHeight() / height;
LTexture[][] textures = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), wlength, hlength);
for (int y = 0; y < hlength; y++)
{
for (int x = 0; x < wlength; x++)
{
textures[x][y] = image.GetSubTexture((x * width), (y * height),
width, height);
}
}
return textures;
}