本文整理汇总了C#中Sprite.SetHeight方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.SetHeight方法的具体用法?C# Sprite.SetHeight怎么用?C# Sprite.SetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.SetHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BackGround
public BackGround(TextureManager _texturemanager, int level, Particle.Particles _p = null)
{
if (_p != null)
{
particles = _p;
allowrunParticles = true;
}
this.level = level;
renderer = Stage1State._renderer;
this.texturemanager = _texturemanager;
Texture texture = _texturemanager.Get("shade1");
background = new Sprite();
background.Texture = texture;
background.SetPosition(0, 225);
background.SetHeight(450);
background.SetWidth(385+10);
tree = new List<Tree>();
//添加一开始就有的树
for (int i = 0; i < 3; i++)
{
backgroundimage = new BackGroundImage(_texturemanager, renderer, "stg1bg", new Rectangle(0.01f, 0.01f, 0.48f, 0.48f), 385+10, 450);
SpeedY = 0.05f;
backgroundimage.SetPosition(0, 225);
Tree tree1 = new Tree(texturemanager, renderer, "stg1bg", false, 200, 200);
tree1.setTop(400);
tree1.setPosition(16 + 30 * (float)random.NextDouble() - 15, i*200 + 60 * (float)random.NextDouble() - 30);
tree.Add(tree1);
tree1 = new Tree(texturemanager, renderer, "stg1bg", true, 200, 200);
tree1.setTop(400);
tree1.setPosition(-100 + 30 * (float)random.NextDouble() - 15, i * 200 + 100 * (float)random.NextDouble() - 50);
tree.Add(tree1);
tree1 = new Tree(texturemanager, renderer, "stg1bg", true, 200, 200);
tree1.setTop(400);
tree1.setPosition(160 + 30 * (float)random.NextDouble() - 15, i * 200 + 60 * (float)random.NextDouble() - 30);
tree.Add(tree1);
}
}
示例2: BindTexures
/// <summary>
/// 给BattleAnimation快速部署纹理资源
/// </summary>
/// <param name="_t">纹理管理器</param>
/// <param name="name">纹理的普遍头命名</param>
/// <param name="Sprites">需要部署的sprite数组</param>
/// <param name="startindex">第一张纹理的序号</param>
/// <param name="count">部署的纹理张数</param>
public static void BindTexures(TextureManager _t, string name, Sprite[] Sprites,
int startindex,int count,int width = 32, int height = 32)
{
string head = name;
string middle = "";
string num;
Sprite sp;
for (int i = 0; i < count; i++)
{
num = i.ToString();
if (num.Length == 2)
{
middle = "0" + num;
}
else
middle = "00" + num;
sp = new Sprite();
sp.Texture = _t.Get(head + middle);
sp.SetWidth(width);
sp.SetHeight(height);
Sprites[i+startindex] = sp;
}
}
示例3: miniRice
public miniRice(TextureManager _t, int color)
{
this.color = color;
name = "miniRice";
if (color > 15)
color = 15;
if (color < 0)
color = 0;
Texture texture = _t.Get("etama1");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(8);
if (color <= 7)
{
sprite.SetUVs(color * per_256, 30 * per_256, (color + 1) * per_256, 31 * per_256);
}
else
{
color = color - 8;
sprite.SetUVs(color * per_256, 31 * per_256, (color + 1) * per_256, 32 * per_256);
}
}
示例4: LittleJade
public LittleJade(TextureManager _t, int color)
{
this.color = color;
name = "LittleJade";
Texture texture = _t.Get("etama1");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(32);
sprite.SetHeight(32);
if (color > 7)
color = 7;
if (color < 0)
color = 0;
sprite.SetUVs(color * 4 * per_256, 26 * per_256, (color + 1) * 4 * per_256, 30 * per_256);
}
示例5: BigButterfly
public BigButterfly(TextureManager _t, int color)
{
this.color = color;
name = "BigButterfly";
Texture texture = _t.Get("etama1");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(32);
sprite.SetHeight(32);
if (color > 7)
color = 7;
if (color < 0)
color = 0;
sprite.SetUVs(color * 4 * per_256, 22 * per_256, (color + 1) * 4 * per_256, 26 * per_256);
}
示例6: Rice_Double
public Rice_Double(TextureManager _t, int color)
{
this.color = color;
name = "Rice_Double";
Texture texture = _t.Get("etama1");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(16);
sprite.SetHeight(16);
if (color > 15)
color = 15;
if (color < 0)
color = 0;
sprite.SetUVs(color * 2 * per_256, 2 * per_256, (color + 1) * 2 * per_256, 4 * per_256);
}
示例7: 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));
}
示例8: littleStar
public littleStar(TextureManager _t, int color)
{
name = "littleStar";
Texture texture = _t.Get("etama6");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(16);
sprite.SetHeight(16);
if (color > 15)
color = 15;
if (color < 0)
color = 0;
sprite.SetUVs(color * 2 * per_256, 0, (color + 1) * 2 * per_256, 2 * per_256);
this.color = color;
}
示例9: initializeSprite
void initializeSprite()
{
//基于front00.png的纹理载入,在这里舍弃
//NumCharactors = new Dictionary<string, Sprite>();
//Texture texture = texturemanager.Get("front00");
//NumCharactors = new Dictionary<string, Sprite>();
//Sprite sp;
//float _x = 0.5f+ 10*per_512;
//float _y = 5 * per_512;
//for (int i = 0; i < 10; i++)
//{
// sp = new Sprite();
// sp.Texture = texture;
// sp.SetWidth(charactorwidth);
// sp.SetHeight(charactorheight);
// sp.SetUVs(_x + i * 2 * per_512, _y,_x + (i+1)*2*per_512, _y + 2.5f * per_512);
// NumCharactors.Add(i.ToString(), sp);
//}
float per_256 = per_512 * 2;
Texture texture = texturemanager.Get("front00");
Texture texture2 = texturemanager.Get("front");
//HighScore
hiScoreSprite = new Sprite();
hiScoreSprite.Texture = texture2;
hiScoreSprite.SetWidth(64);
hiScoreSprite.SetHeight(16);
hiScoreSprite.SetUVs(0, 10 * per_256, 8 * per_256, 12 * per_256);
//Score
ScSp = new Sprite();
ScSp.Texture = texture2;
ScSp.SetWidth(64);
ScSp.SetHeight(16);
ScSp.SetUVs(0, 12 * per_256, 8 * per_256, 14 * per_256);
//Player
PlSp = new Sprite();
PlSp.Texture = texture2;
PlSp.SetWidth(64);
PlSp.SetHeight(16);
PlSp.SetUVs(0, 14 * per_256, 8 * per_256, 16 * per_256);
//helpstar
HelpStar = new Sprite();
HelpStar.Texture = texture2;
HelpStar.SetWidth(16);
HelpStar.SetHeight(16);
HelpStar.SetUVs(8 * per_256, 10 * per_256, 10 * per_256, 12 * per_256);
//Spell
SpellSp = new Sprite();
SpellSp.Texture = texture2;
SpellSp.SetWidth(64);
SpellSp.SetHeight(16);
SpellSp.SetUVs(0, 16 * per_256, 8 * per_256, 18 * per_256);
//spellstar
SpellStar = new Sprite();
SpellStar.Texture = texture2;
SpellStar.SetWidth(16);
SpellStar.SetHeight(16);
SpellStar.SetUVs(10 * per_256, 10 * per_256, 12 * per_256, 12 * per_256);
//Power
PowSp = new Sprite();
PowSp.Texture = texture2;
PowSp.SetWidth(64);
PowSp.SetHeight(16);
PowSp.SetUVs(0, 18 * per_256, 8 * per_256, 20 * per_256);
//Graze
GrazeSp = new Sprite();
GrazeSp.Texture = texture2;
GrazeSp.SetWidth(64);
GrazeSp.SetHeight(16);
GrazeSp.SetUVs(0, 20 * per_256, 8 * per_256, 22 * per_256);
//Point
PoSp = new Sprite();
PoSp.Texture = texture2;
PoSp.SetWidth(64);
PoSp.SetHeight(16);
PoSp.SetUVs(0, 22 * per_256, 8 * per_256, 24 * per_256);
//Tim
TimSp = new Sprite();
TimSp.Texture = texture2;
TimSp.SetWidth(64);
TimSp.SetHeight(16);
TimSp.SetUVs(0, 24 * per_256, 8 * per_256, 26 * per_256);
//RankLevel 难度选择(4 种难度 , 1种特殊关卡)
RankLevel = new Sprite[5];
for (int i = 0; i < 5; i++)
{
RankLevel[i] = new Sprite();
RankLevel[i].Texture = texture;
RankLevel[i].SetWidth(64);
RankLevel[i].SetHeight(16);
RankLevel[i].SetUVs(0.5f + 1 * per_512, 38 * per_512 + i * 2 * per_512,
0.5f + 9 * per_512, 40 * per_512 + i * 2 * per_512);
//.........这里部分代码省略.........
示例10: initSprites
void initSprites()
{
Sprits = new Dictionary<string, DoubleSprites>();
Texture texture = texturemanager.Get("Title_01");
Sprite spr1 = new Sprite();
Sprite spr2 = new Sprite();
# region 0——9
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 0, 60, 3, 64);
changeUnit(ref spr2, 30, 60, 33, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("0", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 3, 60, 6, 64);
changeUnit(ref spr2, 33, 60, 36, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("1", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 6, 60, 9, 64);
changeUnit(ref spr2, 36, 60, 39, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("2", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 9, 60, 12, 64);
changeUnit(ref spr2, 39, 60, 42, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("3", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 12, 60, 15, 64);
changeUnit(ref spr2, 42, 60, 45, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("4", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 15, 60, 18, 64);
changeUnit(ref spr2, 45, 60, 48, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("5", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 18, 60, 21, 64);
changeUnit(ref spr2, 48, 60, 51, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("6", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 21, 60, 24, 64);
changeUnit(ref spr2, 51, 60, 54, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("7", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 24, 60, 27, 64);
changeUnit(ref spr2, 54, 60, 57, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("8", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture; //必须要先建立texture,再设置大小才能正确的进行工作
changeUnit(ref spr1, 27, 60, 30, 64);
changeUnit(ref spr2, 57, 60, 60, 64);
spr1.SetWidth(3 * 8); spr1.SetHeight(4 * 8);
spr2.SetWidth(3 * 8); spr2.SetHeight(4 * 8);
Sprits.Add("9", new DoubleSprites(spr1, spr2));
#endregion
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 0, 32, 10, 36);
changeUnit(ref spr2, 10, 32, 20, 36);
spr1.SetWidth(10 * 8); spr1.SetHeight(32);
spr2.SetWidth(10 * 8); spr2.SetHeight(32);
Sprits.Add("Quit", new DoubleSprites(spr1, spr2));
spr1 = new Sprite(); spr2 = new Sprite();
spr1.Texture = texture; spr2.Texture = texture;
changeUnit(ref spr1, 0, 44, 22, 48);
changeUnit(ref spr2, 22, 44, 44, 48);
//.........这里部分代码省略.........
示例11: initTextures
void initTextures(TextureManager texturemanager)
{
string head = "WriggleAttack1_st";
string middle = "";
string num;
Sprite sp;
for (int i = 1; i <= PicCount; i++)
{
num = i.ToString();
if (num.Length == 2)
{
middle = "0" + num;
}
else
middle = "00" + num;
sp = new Sprite();
sp.Texture = texturemanager.Get(head + middle);
sp.SetWidth(32);
sp.SetHeight(32);
Sprites.Add(sp);
}
}
示例12: InvalidateSprites
void InvalidateSprites()
{
Sprite sp = new Sprite();
Texture texture = texturemanager.Get("st01logo");
sp.Texture = texture;
sp.SetWidth(13 * 8);
sp.SetHeight(2 * 8);
sp.SetUVs(29 * per_512, 4 * per_128, 42 * per_512, 6 * per_128);
MainSprites.Add("st01logo", sp);
sp = new Sprite();
sp.Texture = texturemanager.Get("st01logo");
sp.SetUVs(2 * per_512, 6 * per_128, 46 * per_512, 10 * per_128);
BackGround.Add("st01logo", sp);
}
示例13: PlayerOne
public PlayerOne(TextureManager _t , Renderer renderer)
{
this.renderer = renderer;
Width = 32;
Height = 48;
position = new Vector2D(0, 50);
//Texture texture = _t.Get("Player00");
//sprite = new Sprite();
//sprite.Texture = texture;
//sprite.SetWidth(Width);
//sprite.SetHeight(Height);
//sprite.SetPosition(position.X, position.Y);
//multiSprite = new MultiSprite(sprite);
//RecTangleF[] rects = new RecTangleF[8];
//for (int i = 0; i < 8;i++ )
// rects[i] = new RecTangleF(0 + i * 4 * per_256, 0, 4 * per_256 + i * 4 * per_256, 6 * per_256);
//multiSprite.RegeditState(0, rects); //将此rectangleF注册到0号state
//multiSprite.State = 0; //将状态切换为0号state
Texture texture = _t.Get("Player2");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(Width);
sprite.SetHeight(Height);
sprite.SetPosition(position.X, position.Y);
multiSprite = new MultiSprite(sprite);
RecTangleF[] rects = new RecTangleF[4];
for (int i = 0; i < 4; i++)
rects[i] = new RecTangleF(0 + i * 4 * per_256, 0, 4 * per_256 + i * 4 * per_256, 6 * per_256);
multiSprite.RegeditState(0, rects); //将此rectangleF注册到0号state
rects = new RecTangleF[3];
for (int i = 0; i < 3; i++)
rects[i] = new RecTangleF( i * 4 * per_256, 6 * per_256,
4 * per_256 + i * 4 * per_256, 12 * per_256);
multiSprite.RegeditState(1, rects); //将此rectangleF注册到1号state (过渡移动)
rects = new RecTangleF[4];
for (int i = 0; i < 4; i++)
rects[i] = new RecTangleF(12*per_256 + i * 4 * per_256, 6*per_256,
12*per_256+ 4 * per_256 + i * 4 * per_256, 12 * per_256);
multiSprite.RegeditState(2, rects); //将此rectangleF注册到2号state (移动)
rects = new RecTangleF[3];
for (int i = 0; i < 3; i++)
rects[i] = new RecTangleF(4 * per_256 + i * 4 * per_256, 6 * per_256,
i * 4 * per_256, 12 * per_256);
multiSprite.RegeditState(3, rects); //将此rectangleF注册到3号state (过渡移动,右)
rects = new RecTangleF[4];
for (int i = 0; i < 4; i++)
rects[i] = new RecTangleF(12 * per_256 + 4 * per_256 + i * 4 * per_256, 6 * per_256,
12 * per_256 + i * 4 * per_256 , 12 * per_256);
multiSprite.RegeditState(4, rects); //将此rectangleF注册到4号state (移动)
multiSprite.RegeditCollection(1, 2); //将1号动画连接到2号动画上
multiSprite.RegeditCollection(3, 4); //将3号动画连接到4号动画上
multiSprite.State = 1; //将状态切换为1号state
}
示例14: Bonus_Font
public Bonus_Font(TextureManager _t)
{
texturemanager = _t;
Sprites = new Dictionary<string, Sprite>();
Sprite sprite;
Texture texture = _t.Get("fontex");
for (int i = 0; i < 10; i++)
{
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(i * per_256, 26 * per_256, (i + 1) * per_256, 28 * per_256);
Sprites.Add(i.ToString(), sprite);
}
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(10 * per_256, 26 * per_256, 11 * per_256, 28 * per_256);
Sprites.Add("%", sprite);
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(11 * per_256, 26 * per_256, 12 * per_256, 28 * per_256);
Sprites.Add(".", sprite);
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(12 * per_256, 26 * per_256, 13 * per_256, 28 * per_256);
Sprites.Add("-", sprite);
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(13 * per_256, 26 * per_256, 14 * per_256, 28 * per_256);
Sprites.Add("+", sprite);
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(14 * per_256, 26 * per_256, 15 * per_256, 28 * per_256);
Sprites.Add("(", sprite);
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(15 * per_256, 26 * per_256, 16 * per_256, 28 * per_256);
Sprites.Add(")", sprite);
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(8);
sprite.SetHeight(16);
sprite.SetUVs(17 * per_256, 24 * per_256, 18 * per_256, 26 * per_256);
Sprites.Add("/", sprite);
}
示例15: MiddleRound
public MiddleRound(TextureManager _t, int color)
{
this.color = color;
name = "MiddleRound";
Texture texture = _t.Get("etama1");
sprite = new Sprite();
sprite.Texture = texture;
sprite.SetWidth(16);
sprite.SetHeight(16);
if (color > 9)
color = 9;
if (color < 0)
color = 0;
sprite.SetUVs((color + 4) * 2 * per_256, 30 * per_256, (color + 5) * 2 * per_256, 32 * per_256);
}