本文整理汇总了C#中Sprite.SetColor方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.SetColor方法的具体用法?C# Sprite.SetColor怎么用?C# Sprite.SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.SetColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static Node Create()
{
var cmp = new MyMouseSelector ();
var spr = new Sprite (1, 1);
spr.SetColor (255, 64, 64, 64);
var col = new CollisionObject ();
col.Shape = new BoxShape (1, 1, 1);
var node = new Node ("MouseSelector");
node.Attach (cmp);
node.Attach (spr);
node.Attach (col);
node.DrawPriority = -1;
node.Visible = false;
return node;
}
示例2: CreateSprites
void CreateSprites()
{
var cache = ResourceCache;
var graphics = Graphics;
UI ui = UI;
// Get the Urho3D fish texture
Texture2D decalTex = cache.GetTexture2D("Textures/UrhoDecal.dds");
for (uint i = 0; i < NumSprites; ++i)
{
// Create a new sprite, set it to use the texture
Sprite sprite = new Sprite();
sprite.Texture = decalTex;
// The UI root element is as big as the rendering window, set random position within it
sprite.Position = new IntVector2((int) (NextRandom()*graphics.Width), (int) (NextRandom()*graphics.Height));
// Set sprite size & hotspot in its center
sprite.Size = new IntVector2(128, 128);
sprite.HotSpot = new IntVector2(64, 64);
// Set random rotation in degrees and random scale
sprite.Rotation = NextRandom()*360.0f;
sprite.SetScale(NextRandom(1.0f) + 0.5f);
// Set random color and additive blending mode
sprite.SetColor(new Color(NextRandom(0.5f) + 0.5f, NextRandom(0.5f) + 0.5f, NextRandom(0.5f) + 0.5f));
sprite.BlendMode = BlendMode.Add;
// Add as a child of the root UI element
ui.Root.AddChild(sprite);
// Store sprites to our own container for easy movement update iteration
spritesWithVelocities[sprite] = new Vector2(NextRandom(200.0f) - 100.0f, NextRandom(200.0f) - 100.0f);
}
}
示例3: Test_SetColor
public void Test_SetColor()
{
var spr = new Sprite (64, 64);
spr.Color = new Color (1, 2, 3, 4);
Assert.AreEqual (new Color (1, 2, 3, 4), spr.Color);
spr.SetColor (5, 6, 7, 8);
Assert.AreEqual (new Color (5, 6, 7, 8), spr.Color);
}
示例4: FLowerBody
public FLowerBody(TextureManager _t,float w_h = 16)
{
Texture texture = _t.Get("Ef_etama2");
body = new Sprite();
body.Texture = texture;
body.SetWidth(w_h);
body.SetHeight(w_h);
body.SetUVs(2 * per_256, 12 * per_256, 4 * per_256, 14 * per_256);
body.SetColor(new Color(1, 1, 1, 1));
}
示例5: BreakPointBody
public BreakPointBody(TextureManager _t, int color, int select)
{
float x = color * 8 * per_256 + select * 2 * per_256;
Texture texture = _t.Get("Ef_etama2");
body = new Sprite();
body.Texture = texture;
body.SetWidth(8);
body.SetHeight(8);
float leftop_x = color * 8 * per_256 + select * 2 * per_256;
body.SetUVs(leftop_x, 30 * per_256,
leftop_x + 2 * per_256, 32 * per_256);
body.SetColor(new Color(1, 1, 1, 0.5f));
}