本文整理汇总了C#中Layer.AddSprite方法的典型用法代码示例。如果您正苦于以下问题:C# Layer.AddSprite方法的具体用法?C# Layer.AddSprite怎么用?C# Layer.AddSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer.AddSprite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
/// <summary>
/// Sets the screen up (UI components, multimedia content, etc.)
/// </summary>
public override void Initialize()
{
base.Initialize();
Image iMountain = ResourceManager.CreateImage("mountain");
Image iGround = ResourceManager.CreateImage("ground");
Image icloud = ResourceManager.CreateImage("cloud");
sCloud= new Sprite("cloud", icloud);
sMountain1= new Sprite("mountain1", iMountain);
sMountain1.Pivot=Vector2.UnitY;
sMountain2 = new Sprite("mountain2", iMountain);
sMountain2.Pivot = Vector2.UnitY;
sGround1 = new Sprite("ground1", iGround);
sGround1.Pivot= Vector2.UnitY;
sGround2 = new Sprite("ground2", iGround);
sGround2.Pivot = Vector2.UnitY;
lcloud = new Layer();
lcloud.AddSprite(sCloud);
lmountain = new Layer();
lmountain.AddSprite(sMountain1);
lmountain.AddSprite(sMountain2);
lground = new Layer();
lground.AddSprite(sGround1);
lground.AddSprite(sGround2);
AddComponent(sCloud, 400, 10);
AddComponent(sGround1, Preferences.ViewportManager.BottomLeftAnchor);
AddComponent(sGround2, Preferences.ViewportManager.BottomRightAnchor);
AddComponent(sMountain1, Preferences.ViewportManager.BottomLeftAnchor-Vector2.UnitY*sGround1.Size.Y*0.8f);
AddComponent(sMountain2, Preferences.ViewportManager.BottomRightAnchor - Vector2.UnitY * sGround1.Size.Y * 0.8f);
SendToFront(sGround1);
SendToFront(sGround2);
btnleft = new Button("Move Left");
AddComponent(btnleft, Vector2.Zero);
btnright = new Button("Move Right");
btnright.Pivot = Vector2.UnitX;
AddComponent(btnright, Preferences.ViewportManager.TopRightAnchor);
}