Spine.RegionAttachment.SetUVs C# (CSharp) Method

SetUVs() public method

public SetUVs ( float u, float v, float u2, float v2, bool rotate ) : void
u float
v float
u2 float
v2 float
rotate bool
return void
		public void SetUVs (float u, float v, float u2, float v2, bool rotate) {
			float[] uvs = this.uvs;
			if (rotate) {
				uvs[X2] = u;
				uvs[Y2] = v2;
				uvs[X3] = u;
				uvs[Y3] = v;
				uvs[X4] = u2;
				uvs[Y4] = v;
				uvs[X1] = u2;
				uvs[Y1] = v2;
			} else {
				uvs[X1] = u;
				uvs[Y1] = v2;
				uvs[X2] = u;
				uvs[Y2] = v;
				uvs[X3] = u2;
				uvs[Y3] = v;
				uvs[X4] = u2;
				uvs[Y4] = v2;
			}
		}

Usage Example

    public RegionAttachment NewRegionAttachment(Skin skin, String name, String path)
    {
        FAtlasElement element = Futile.atlasManager.GetElementWithName(name);
        RegionAttachment attachment = new RegionAttachment(name);

        if(element != null){
            attachment.RendererObject = element;
            attachment.SetUVs(element.uvBottomLeft.x, element.uvBottomLeft.y, element.uvTopRight.x, element.uvTopRight.y, false);
            attachment.RegionOffsetX = 0.0f;
            attachment.RegionOffsetY = 0.0f;
            attachment.RegionWidth = element.sourceSize.x;
            attachment.RegionHeight = element.sourceSize.y;
            attachment.RegionOriginalWidth = element.sourceSize.x;
            attachment.RegionOriginalHeight = element.sourceSize.y;

        }else{
            attachment.RendererObject = null;
            attachment.SetUVs(0.0f, 0.0f, 0.0f, 0.0f, false);
            attachment.RegionOffsetX = 0.0f;
            attachment.RegionOffsetY = 0.0f;
            attachment.RegionWidth = 0.0f;
            attachment.RegionHeight = 0.0f;
            attachment.RegionOriginalWidth = 0.0f;
            attachment.RegionOriginalHeight = 0.0f;

            Debug.Log("Element [" + name + "] not found in Futile.AtlasManager");
        }
        return attachment;
    }
All Usage Examples Of Spine.RegionAttachment::SetUVs