本文整理汇总了C#中Loon.Core.Graphics.Opengl.LTexture.SetTexCords方法的典型用法代码示例。如果您正苦于以下问题:C# LTexture.SetTexCords方法的具体用法?C# LTexture.SetTexCords怎么用?C# LTexture.SetTexCords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loon.Core.Graphics.Opengl.LTexture
的用法示例。
在下文中一共展示了LTexture.SetTexCords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
private LTexture Copy(int width, int height,
bool flipHorizontal, bool flipVertial)
{
int hashCode = 1;
hashCode = LSystem.Unite(hashCode, width);
hashCode = LSystem.Unite(hashCode, height);
hashCode = LSystem.Unite(hashCode, flipHorizontal);
hashCode = LSystem.Unite(hashCode, flipVertial);
if (childs == null)
{
childs = new System.Collections.Generic.Dictionary<Int32, LTexture>(10);
}
lock (childs)
{
LTexture cache = (LTexture)CollectionUtils.Get(childs, hashCode);
if (cache != null)
{
return cache;
}
if (dataCords == null)
{
SetVertCords(this.GetWidth(), this.GetHeight());
}
LTexture copy = new LTexture();
if (isLoaded)
{
copy.parent = this;
copy.imageData = imageData;
copy.textureID = textureID;
copy.isLoaded = isLoaded;
copy.replace = replace;
copy.isStatic = isStatic;
copy.reload = reload;
copy.format = format;
copy.hasAlpha = hasAlpha;
copy.SetVertCords(width, height);
copy.texWidth = texWidth;
copy.texHeight = texHeight;
copy.SetTexCords(xOff, yOff, widthRatio, heightRatio);
if (flipHorizontal)
{
Swap(8, 10, copy.dataCords);
Swap(12, 14, copy.dataCords);
}
if (flipVertial)
{
Swap(9, 13, copy.dataCords);
Swap(11, 15, copy.dataCords);
}
copy.xOff = dataCords[8];
copy.yOff = dataCords[9];
copy.widthRatio = dataCords[14];
copy.heightRatio = dataCords[15];
System.Array.Copy(crops, 0, copy.crops, 0, crops.Length);
}
else
{
copy.width = width;
copy.height = height;
copy.texWidth = texWidth;
copy.texHeight = texHeight;
copy.imageData = imageData;
copy.subX = 0;
copy.subY = 0;
copy.subWidth = width;
copy.subHeight = height;
copy.isVisible = false;
LSystem.Load(new CopyUpdate(this, copy, 0, 0, width, height, flipHorizontal, flipVertial));
}
isChild = true;
CollectionUtils.Put(childs, hashCode, copy);
return copy;
}
}
示例2: GetSubTexture
public LTexture GetSubTexture(int x, int y, int width,
int height)
{
int hashCode = 1;
hashCode = LSystem.Unite(hashCode, x);
hashCode = LSystem.Unite(hashCode, y);
hashCode = LSystem.Unite(hashCode, width);
hashCode = LSystem.Unite(hashCode, height);
if (childs == null)
{
childs = new System.Collections.Generic.Dictionary<Int32, LTexture>(10);
}
lock (childs)
{
LTexture cache = (LTexture)CollectionUtils.Get(childs, hashCode);
if (cache != null)
{
return cache;
}
LTexture sub = new LTexture();
if (isLoaded)
{
sub.parent = this;
sub.textureID = textureID;
sub.isLoaded = isLoaded;
sub.imageData = imageData;
sub.hasAlpha = hasAlpha;
sub.replace = replace;
sub.isStatic = isStatic;
sub.reload = reload;
sub.format = format;
sub.width = width;
sub.height = height;
sub.texWidth = texWidth;
sub.texHeight = texHeight;
sub.SetVertCords(width, height);
sub.xOff = (((float)x / this.width) * widthRatio) + xOff;
sub.yOff = (((float)y / this.height) * heightRatio) + yOff;
sub.widthRatio = (((float)width / this.width) * widthRatio)
+ sub.xOff;
sub.heightRatio = (((float)height / this.height) * heightRatio)
+ sub.yOff;
sub.SetTexCords(sub.xOff, sub.yOff, sub.widthRatio,
sub.heightRatio);
Crop(sub, x, y, width, height);
}
else
{
sub.width = width;
sub.height = height;
sub.texWidth = texWidth;
sub.texHeight = texHeight;
sub.imageData = imageData;
sub.subX = x;
sub.subY = y;
sub.subWidth = width;
sub.subHeight = height;
sub.isVisible = false;
LSystem.Load(new SubUpdate(this, sub, x, y, width, height));
}
isChild = true;
CollectionUtils.Put(childs, hashCode, sub);
return sub;
}
}