public void RenderSprite(Graphics.Sprite sprite, Vector2 pos, Vector2 srcPos, int srcWidth, int srcHeight, int color) { //Rectangle rc = new Rectangle(srcX, srcY, srcWidth, srcHeight); //if (sprite.Animation != null && sprite.Animation.Progressive && sprite.Frames != null) // spriteRenderer.Draw(sprite.Frames[0].Texture, rc, new SlimDX.Vector3(0, 0, 0), new SlimDX.Vector3(x, y, CalcZ(layer) + 0.001f), new SlimDX.Color4(color)); //spriteRenderer.Draw(sprite.Frame.Texture, rc, new SlimDX.Vector3(0, 0, 0), new SlimDX.Vector3(x, y, CalcZ(layer)), new SlimDX.Color4(color)); Graphics.SpriteEntity entity = new Graphics.SpriteEntity(); entity.Rectangle = new Rectangle(srcPos.x, srcPos.y, srcWidth, srcHeight); entity.Color = new SlimDX.Color4(color); entity.Factor = sprite.Resolution; long now = System.Diagnostics.Stopwatch.GetTimestamp(); if (now - sprite.Frame.TimeStamp < (long)(Stopwatch.Frequency / popInSpeed) && popInSpeed != 0) { entity.Color.Alpha *= (now - sprite.Frame.TimeStamp) / (float)Stopwatch.Frequency * popInSpeed; } if (sprite.Animation != null && sprite.Animation.Progressive && sprite.Frames != null) { entity.Texture = sprite.Frames[0].Texture; entity.Position = new SlimDX.Vector3(pos.x, pos.y, CalcZ(layer) + 0.001f); device.AddEntity(entity); } Graphics.SpriteEntity entity2 = new Burntime.Platform.Graphics.SpriteEntity(); entity2.Rectangle = entity.Rectangle; entity2.Color = entity.Color; entity2.Texture = sprite.Frame.Texture; entity2.Position = new SlimDX.Vector3(pos.x, pos.y, CalcZ(layer)); entity2.Factor = sprite.Resolution; device.AddEntity(entity2); }
public void RenderSprite(Graphics.Sprite sprite, Vector2 pos, float alpha) { Graphics.SpriteEntity entity = new Graphics.SpriteEntity(); entity.Rectangle = new Rectangle(0, 0, sprite.OriginalSize.x, sprite.OriginalSize.y); entity.Color = new SlimDX.Color4(alpha, 1, 1, 1); entity.Factor = sprite.Resolution; long now = System.Diagnostics.Stopwatch.GetTimestamp(); if (now - sprite.Frame.TimeStamp < (long)(Stopwatch.Frequency / popInSpeed) && popInSpeed != 0) { entity.Color.Alpha *= (now - sprite.Frame.TimeStamp) / (float)Stopwatch.Frequency * popInSpeed; } if (sprite.Animation != null && sprite.Animation.Progressive && sprite.Frames != null) { entity.Texture = sprite.Frames[0].Texture; entity.Position = new SlimDX.Vector3(pos.x, pos.y, CalcZ(layer) + 0.001f); device.AddEntity(entity); } Graphics.SpriteEntity entity2 = new Burntime.Platform.Graphics.SpriteEntity(); entity2.Rectangle = entity.Rectangle; entity2.Color = entity.Color; entity2.Texture = sprite.Frame.Texture; entity2.Position = new SlimDX.Vector3(pos.x, pos.y, CalcZ(layer)); entity2.Factor = sprite.Resolution; device.AddEntity(entity2); }
public void RenderSprite(Graphics.Sprite sprite, Vector2 pos, Vector2 srcPos, int srcWidth, int srcHeight) { //Rectangle rc = new Rectangle(srcX, srcY, srcWidth, srcHeight); //if (sprite.Animation != null && sprite.Animation.Progressive && sprite.Frames != null) // spriteRenderer.Draw(sprite.Frames[0].Texture, rc, new SlimDX.Vector3(0, 0, 0), new SlimDX.Vector3(x, y, CalcZ(layer) + 0.001f), new SlimDX.Color4(1, 1, 1, 1)); //spriteRenderer.Draw(sprite.Frame.Texture, rc, new SlimDX.Vector3(0, 0, 0), new SlimDX.Vector3(x, y, CalcZ(layer)), new SlimDX.Color4(1, 1, 1, 1)); }
public void RenderSprite(Graphics.Sprite sprite, Vector2 pos) { RenderSprite(sprite, pos, 1); }