本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Texture2D.GetTexcoordsFromPixelCoords方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.GetTexcoordsFromPixelCoords方法的具体用法?C# Texture2D.GetTexcoordsFromPixelCoords怎么用?C# Texture2D.GetTexcoordsFromPixelCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Texture2D
的用法示例。
在下文中一共展示了Texture2D.GetTexcoordsFromPixelCoords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FigureMovementAnimationComponent
public FigureMovementAnimationComponent(Entity referringEntity, Texture2D texture) : base(referringEntity)
{
var forward = Animation.CreateDiscrete(0.65f, new[]
{
texture.GetTexcoordsFromPixelCoords(0, 0),
texture.GetTexcoordsFromPixelCoords(32, 0),
texture.GetTexcoordsFromPixelCoords(0, 0),
texture.GetTexcoordsFromPixelCoords(64, 0),
}, OnUpdate, true);
var left = Animation.CreateDiscrete(0.65f, new[]
{
texture.GetTexcoordsFromPixelCoords(0, 32),
texture.GetTexcoordsFromPixelCoords(32, 32),
texture.GetTexcoordsFromPixelCoords(0, 32),
texture.GetTexcoordsFromPixelCoords(64, 32),
}, OnUpdate, true);
var right = Animation.CreateDiscrete(0.65f, new[]
{
texture.GetTexcoordsFromPixelCoords(0, 96),
texture.GetTexcoordsFromPixelCoords(32, 96),
texture.GetTexcoordsFromPixelCoords(0, 96),
texture.GetTexcoordsFromPixelCoords(64, 96),
}, OnUpdate, true);
var backward = Animation.CreateDiscrete(0.65f, new[]
{
texture.GetTexcoordsFromPixelCoords(0, 64),
texture.GetTexcoordsFromPixelCoords(32, 64),
texture.GetTexcoordsFromPixelCoords(0, 64),
texture.GetTexcoordsFromPixelCoords(64, 64),
}, OnUpdate, true);
AddAnimation(ForwardAnimation, forward);
AddAnimation(BackwardAnimation, backward ?? forward);
AddAnimation(LeftAnimation, left ?? forward);
AddAnimation(RightAnimation, right ?? forward);
}